summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-08-27 19:53:40 +0200
committerJens Axboe <axboe@kernel.dk>2024-08-28 16:49:25 +0200
commite33a97a830b230b79a98dbbb4121d4741a2be619 (patch)
treec0c850d96fef8a215b5f59112f13bf395a376f7f
parentMerge tag 'nvme-6.11-2024-08-22' of git://git.infradead.org/nvme into block-6.11 (diff)
downloadlinux-e33a97a830b230b79a98dbbb4121d4741a2be619.tar.xz
linux-e33a97a830b230b79a98dbbb4121d4741a2be619.zip
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: 64b582ca88ca1 ("block: Read max write zeroes once for __blkdev_issue_write_zeroes()") Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: John Garry <john.g.garry@oracle.com> Link: https://lore.kernel.org/r/20240827175340.GB1977952@frogsfrogsfrogs Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 83eb7761c2bf..4c9f20a689f7 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -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
* "not supported" here.
*/
- if (ret && !limit)
+ if (ret && !bdev_write_zeroes_sectors(bdev))
return -EOPNOTSUPP;
return ret;
}