diff options
author | Ming Lei <[email protected]> | 2021-09-23 10:37:51 +0800 |
---|---|---|
committer | Jens Axboe <[email protected]> | 2021-09-24 11:06:58 -0600 |
commit | f278eb3d8178f9c31f8dfad7e91440e603dd7f1a (patch) | |
tree | 86c4b040a5325188562ef075c9256d32de6fdff7 /scripts | |
parent | 5afedf670caf30a2b5a52da96eb7eac7dee6a9c9 (diff) |
block: hold ->invalidate_lock in blkdev_fallocate
When running ->fallocate(), blkdev_fallocate() should hold
mapping->invalidate_lock to prevent page cache from being accessed,
otherwise stale data may be read in page cache.
Without this patch, blktests block/009 fails sometimes. With this patch,
block/009 can pass always.
Also as Jan pointed out, no pages can be created in the discarded area
while you are holding the invalidate_lock, so remove the 2nd
truncate_bdev_range().
Cc: Jan Kara <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions