diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2012-02-22 05:51:57 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:58:15 -0500 |
commit | 32db80f6f6326617ed40b2d157709226af4f062b (patch) | |
tree | 1dd2b7bc012dd4cde1721e3689c9051b0efaad22 /drivers/block/drbd/drbd_actlog.c | |
parent | 25b0d6c8c16b2bf6a0430ec9cf137297db4e85e5 (diff) |
drbd: Consider the disk-timeout also for meta-data IO operations
If the backing device is already frozen during attach, we failed
to recognize that. The current disk-timeout code works on top
of the drbd_request objects. During attach we do not allow IO
and therefore never generate a drbd_request object but block
before that in drbd_make_request().
This patch adds the timeout to all drbd_md_sync_page_io().
Before this patch we used to go from D_ATTACHING directly
to D_DISKLESS if IO failed during attach. We can no longer
do this since we have to stay in D_FAILED until all IO
ops issued to the backing device returned.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_actlog.c')
-rw-r--r-- | drivers/block/drbd/drbd_actlog.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c index d69fb7d61817..b2355994a4d6 100644 --- a/drivers/block/drbd/drbd_actlog.c +++ b/drivers/block/drbd/drbd_actlog.c | |||
@@ -129,9 +129,21 @@ static bool md_io_allowed(struct drbd_conf *mdev) | |||
129 | return ds >= D_NEGOTIATING || ds == D_ATTACHING; | 129 | return ds >= D_NEGOTIATING || ds == D_ATTACHING; |
130 | } | 130 | } |
131 | 131 | ||
132 | void wait_until_done_or_disk_failure(struct drbd_conf *mdev, unsigned int *done) | 132 | void wait_until_done_or_disk_failure(struct drbd_conf *mdev, struct drbd_backing_dev *bdev, |
133 | unsigned int *done) | ||
133 | { | 134 | { |
134 | wait_event(mdev->misc_wait, *done || !md_io_allowed(mdev)); | 135 | long dt; |
136 | |||
137 | rcu_read_lock(); | ||
138 | dt = rcu_dereference(bdev->disk_conf)->disk_timeout; | ||
139 | rcu_read_unlock(); | ||
140 | dt = dt * HZ / 10; | ||
141 | if (dt == 0) | ||
142 | dt = MAX_SCHEDULE_TIMEOUT; | ||
143 | |||
144 | dt = wait_event_timeout(mdev->misc_wait, *done || !md_io_allowed(mdev), dt); | ||
145 | if (dt == 0) | ||
146 | dev_err(DEV, "meta-data IO operation timed out\n"); | ||
135 | } | 147 | } |
136 | 148 | ||
137 | static int _drbd_md_sync_page_io(struct drbd_conf *mdev, | 149 | static int _drbd_md_sync_page_io(struct drbd_conf *mdev, |
@@ -171,7 +183,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev, | |||
171 | bio_endio(bio, -EIO); | 183 | bio_endio(bio, -EIO); |
172 | else | 184 | else |
173 | submit_bio(rw, bio); | 185 | submit_bio(rw, bio); |
174 | wait_until_done_or_disk_failure(mdev, &mdev->md_io.done); | 186 | wait_until_done_or_disk_failure(mdev, bdev, &mdev->md_io.done); |
175 | if (bio_flagged(bio, BIO_UPTODATE)) | 187 | if (bio_flagged(bio, BIO_UPTODATE)) |
176 | err = mdev->md_io.error; | 188 | err = mdev->md_io.error; |
177 | 189 | ||