Commit a8a4e51e authored by Philipp Reisner's avatar Philipp Reisner

drbd: REQ_HARDBARRIER -> REQ_FUA transition for meta data accesses

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 2451fc3b
...@@ -78,11 +78,10 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev, ...@@ -78,11 +78,10 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
init_completion(&md_io.event); init_completion(&md_io.event);
md_io.error = 0; md_io.error = 0;
if ((rw & WRITE) && !test_bit(MD_NO_BARRIER, &mdev->flags)) if ((rw & WRITE) && !test_bit(MD_NO_FUA, &mdev->flags))
rw |= REQ_HARDBARRIER; rw |= REQ_FUA;
rw |= REQ_UNPLUG | REQ_SYNC; rw |= REQ_UNPLUG | REQ_SYNC;
retry:
bio = bio_alloc(GFP_NOIO, 1); bio = bio_alloc(GFP_NOIO, 1);
bio->bi_bdev = bdev->md_bdev; bio->bi_bdev = bdev->md_bdev;
bio->bi_sector = sector; bio->bi_sector = sector;
...@@ -100,17 +99,6 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev, ...@@ -100,17 +99,6 @@ static int _drbd_md_sync_page_io(struct drbd_conf *mdev,
wait_for_completion(&md_io.event); wait_for_completion(&md_io.event);
ok = bio_flagged(bio, BIO_UPTODATE) && md_io.error == 0; ok = bio_flagged(bio, BIO_UPTODATE) && md_io.error == 0;
/* check for unsupported barrier op.
* would rather check on EOPNOTSUPP, but that is not reliable.
* don't try again for ANY return value != 0 */
if (unlikely((bio->bi_rw & REQ_HARDBARRIER) && !ok)) {
/* Try again with no barrier */
dev_warn(DEV, "Barriers not supported on meta data device - disabling\n");
set_bit(MD_NO_BARRIER, &mdev->flags);
rw &= ~REQ_HARDBARRIER;
bio_put(bio);
goto retry;
}
out: out:
bio_put(bio); bio_put(bio);
return ok; return ok;
......
...@@ -835,8 +835,7 @@ enum { ...@@ -835,8 +835,7 @@ enum {
NO_BARRIER_SUPP, /* underlying block device doesn't implement barriers */ NO_BARRIER_SUPP, /* underlying block device doesn't implement barriers */
CONSIDER_RESYNC, CONSIDER_RESYNC,
MD_NO_BARRIER, /* meta data device does not support barriers, MD_NO_FUA, /* Users wants us to not use FUA/FLUSH on meta data dev */
so don't even try */
SUSPEND_IO, /* suspend application io */ SUSPEND_IO, /* suspend application io */
BITMAP_IO, /* suspend application io; BITMAP_IO, /* suspend application io;
once no more io in flight, start bitmap io */ once no more io in flight, start bitmap io */
...@@ -2404,13 +2403,13 @@ static inline void drbd_md_flush(struct drbd_conf *mdev) ...@@ -2404,13 +2403,13 @@ static inline void drbd_md_flush(struct drbd_conf *mdev)
{ {
int r; int r;
if (test_bit(MD_NO_BARRIER, &mdev->flags)) if (test_bit(MD_NO_FUA, &mdev->flags))
return; return;
r = blkdev_issue_flush(mdev->ldev->md_bdev, GFP_KERNEL, NULL, r = blkdev_issue_flush(mdev->ldev->md_bdev, GFP_KERNEL, NULL,
BLKDEV_IFL_WAIT); BLKDEV_IFL_WAIT);
if (r) { if (r) {
set_bit(MD_NO_BARRIER, &mdev->flags); set_bit(MD_NO_FUA, &mdev->flags);
dev_err(DEV, "meta data flush failed with status %d, disabling md-flushes\n", r); dev_err(DEV, "meta data flush failed with status %d, disabling md-flushes\n", r);
} }
} }
......
...@@ -1103,9 +1103,9 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp ...@@ -1103,9 +1103,9 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp
/* Reset the "barriers don't work" bits here, then force meta data to /* Reset the "barriers don't work" bits here, then force meta data to
* be written, to ensure we determine if barriers are supported. */ * be written, to ensure we determine if barriers are supported. */
if (nbc->dc.no_md_flush) if (nbc->dc.no_md_flush)
set_bit(MD_NO_BARRIER, &mdev->flags); set_bit(MD_NO_FUA, &mdev->flags);
else else
clear_bit(MD_NO_BARRIER, &mdev->flags); clear_bit(MD_NO_FUA, &mdev->flags);
/* Point of no return reached. /* Point of no return reached.
* Devices and memory are no longer released by error cleanup below. * Devices and memory are no longer released by error cleanup below.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment