]> git.baikalelectronics.ru Git - kernel.git/commit
block: Discard page cache of zone reset target range
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 11 Mar 2021 07:25:46 +0000 (16:25 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 11 Mar 2021 18:49:25 +0000 (11:49 -0700)
commit471432257c03cff0eef87a71bebf22daa6cb8579
treee20c2e385bedcf60b2f8ac24f7038f87ed934d26
parentcff237eea49b3781ab3d0cdffdb0b835005f1175
block: Discard page cache of zone reset target range

When zone reset ioctl and data read race for a same zone on zoned block
devices, the data read leaves stale page cache even though the zone
reset ioctl zero clears all the zone data on the device. To avoid
non-zero data read from the stale page cache after zone reset, discard
page cache of reset target zones in blkdev_zone_mgmt_ioctl(). Introduce
the helper function blkdev_truncate_zone_range() to discard the page
cache. Ensure the page cache discarded by calling the helper function
before and after zone reset in same manner as fallocate does.

This patch can be applied back to the stable kernel version v5.10.y.
Rework is needed for older stable kernels.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fixes: 88beedd71aa2 ("blk-zoned: implement ioctls")
Cc: <stable@vger.kernel.org> # 5.10+
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20210311072546.678999-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-zoned.c