aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_actlog.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-12-14 12:01:21 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-05-09 09:16:30 -0400
commit7caacb69ac468ea713e8e8ba77be8040d8fe7bbe (patch)
treea2cfa89a0b77fe22160ca51767c37269c677b263 /drivers/block/drbd/drbd_actlog.c
parent4afc433cf8066c112bd2bdd949d78ff8e8b4ba3f (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.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c
index 601ad9ef0437..08bd7c1b36e1 100644
--- a/drivers/block/drbd/drbd_actlog.c
+++ b/drivers/block/drbd/drbd_actlog.c
@@ -88,9 +88,16 @@ static bool md_io_allowed(struct drbd_conf *mdev)
88 return ds >= D_NEGOTIATING || ds == D_ATTACHING; 88 return ds >= D_NEGOTIATING || ds == D_ATTACHING;
89} 89}
90 90
91void wait_until_done_or_disk_failure(struct drbd_conf *mdev, unsigned int *done) 91void wait_until_done_or_disk_failure(struct drbd_conf *mdev, struct drbd_backing_dev *bdev,
92 unsigned int *done)
92{ 93{
93 wait_event(mdev->misc_wait, *done || !md_io_allowed(mdev)); 94 long dt = bdev->dc.disk_timeout * HZ / 10;
95 if (dt == 0)
96 dt = MAX_SCHEDULE_TIMEOUT;
97
98 dt = wait_event_timeout(mdev->misc_wait, *done || !md_io_allowed(mdev), dt);
99 if (dt == 0)
100 dev_err(DEV, "meta-data IO operation timed out\n");
94} 101}
95 102
96static int _drbd_md_sync_page_io(struct drbd_conf *mdev, 103static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
@@ -130,7 +137,7 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
130 bio_endio(bio, -EIO); 137 bio_endio(bio, -EIO);
131 else 138 else
132 submit_bio(rw, bio); 139 submit_bio(rw, bio);
133 wait_until_done_or_disk_failure(mdev, &mdev->md_io.done); 140 wait_until_done_or_disk_failure(mdev, bdev, &mdev->md_io.done);
134 ok = bio_flagged(bio, BIO_UPTODATE) && mdev->md_io.error == 0; 141 ok = bio_flagged(bio, BIO_UPTODATE) && mdev->md_io.error == 0;
135 142
136 out: 143 out: