Commit e33a97a8 authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Jens Axboe

block: fix detection of unsupported WRITE SAME in blkdev_issue_write_zeroes

On error, blkdev_issue_write_zeroes used to recheck the block device's
WRITE SAME queue limits after submitting WRITE SAME bios.  As stated in
the comment, the purpose of this was to collapse all IO errors to
EOPNOTSUPP if the effect of issuing bios was that WRITE SAME got turned
off in the queue limits.  Therefore, it does not make sense to reuse the
zeroes limit that was read earlier in the function because we only care
about the queue limit *now*, not what it was at the start of the
function.

Found by running generic/351 from fstests.

Fixes: 64b582ca ("block: Read max write zeroes once for __blkdev_issue_write_zeroes()")
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240827175340.GB1977952@frogsfrogsfrogsSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e6b09a17
...@@ -174,7 +174,7 @@ static int blkdev_issue_write_zeroes(struct block_device *bdev, sector_t sector, ...@@ -174,7 +174,7 @@ static int blkdev_issue_write_zeroes(struct block_device *bdev, sector_t sector,
* on an I/O error, in which case we'll turn any error into * on an I/O error, in which case we'll turn any error into
* "not supported" here. * "not supported" here.
*/ */
if (ret && !limit) if (ret && !bdev_write_zeroes_sectors(bdev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
return ret; return ret;
} }
......
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