Skip to content

Commit

Permalink
block: fix blkdev_issue_flush() not detecting and passing EOPNOTSUPP …
Browse files Browse the repository at this point in the history
…back

This is important to eg dm, that tries to decide whether to stop using
barriers or not.

Tested as working by Anders Henke <anders.henke@1und1.de>

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed Mar 4, 2008
1 parent 56d94a3 commit cc66b45
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions block/blk-barrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cc66b45

Please sign in to comment.