From: Jens Axboe Date: Tue, 4 Mar 2008 10:47:46 +0000 (+0100) Subject: block: fix blkdev_issue_flush() not detecting and passing EOPNOTSUPP back X-Git-Tag: v2.6.25-rc4~98^2 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc66b4512cae8df4ed1635483210aabf7690ec27;p=linux-2.6-omap-h63xx.git block: fix blkdev_issue_flush() not detecting and passing EOPNOTSUPP back This is important to eg dm, that tries to decide whether to stop using barriers or not. Tested as working by Anders Henke Signed-off-by: Jens Axboe --- diff --git a/block/blk-barrier.c b/block/blk-barrier.c index 6901eedeffc..55c5f1fc4f1 100644 --- a/block/blk-barrier.c +++ b/block/blk-barrier.c @@ -259,8 +259,11 @@ int blk_do_ordered(struct request_queue *q, struct request **rqp) static void bio_end_empty_barrier(struct bio *bio, int err) { - if (err) + if (err) { + if (err == -EOPNOTSUPP) + set_bit(BIO_EOPNOTSUPP, &bio->bi_flags); clear_bit(BIO_UPTODATE, &bio->bi_flags); + } complete(bio->bi_private); } @@ -309,7 +312,9 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector) *error_sector = bio->bi_sector; ret = 0; - if (!bio_flagged(bio, BIO_UPTODATE)) + if (bio_flagged(bio, BIO_EOPNOTSUPP)) + ret = -EOPNOTSUPP; + else if (!bio_flagged(bio, BIO_UPTODATE)) ret = -EIO; bio_put(bio);