]> git.baikalelectronics.ru Git - kernel.git/commit
block: Hold invalidate_lock in BLKRESETZONE ioctl
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 11 Nov 2021 08:52:38 +0000 (17:52 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 11 Nov 2021 18:52:46 +0000 (11:52 -0700)
commit5d5f0127dbf4d901b5f0a852de3ad6093608f54b
tree5c5352e8e1bc89aa6f832c02a088a96368c074a0
parent8d22ad9a0e3f5de88bcfa188e8d40adb5a659508
block: Hold invalidate_lock in BLKRESETZONE ioctl

When BLKRESETZONE ioctl and data read race, the data read leaves stale
page cache. The commit 904a62f0c2dd ("block: Discard page cache of zone
reset target range") added page cache truncation to avoid stale page
cache after the ioctl. However, the stale page cache still can be read
during the reset zone operation for the ioctl. To avoid the stale page
cache completely, hold invalidate_lock of the block device file mapping.

Fixes: 904a62f0c2dd ("block: Discard page cache of zone reset target range")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: stable@vger.kernel.org # v5.15
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20211111085238.942492-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-zoned.c