Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
loop: avoid EAGAIN, if offset or block_size are changed
Previously, there was a bug where user could see stale buffer cache (e.g, 512B) attached in the 4KB-sized pager cache, when the block size was changed from 512B to 4KB. That was fixed by: commit 5db470e ("loop: drop caches if offset or block_size are changed") But, there were some regression reports saying the fix returns EAGAIN easily. So, this patch removes previously added EAGAIN condition, nrpages != 0. Instead, it changes the flow like this: - sync_blockdev() - blk_mq_freeze_queue() : change the loop configuration - blk_mq_unfreeze_queue() - sync_blockdev() - invalidate_bdev() After invalidating the buffer cache, we must see the full valid 4KB page. Additional concern came from Bart in which we can lose some data when changing the lo_offset. In that case, this patch adds: - sync_blockdev() - blk_set_queue_dying - blk_mq_freeze_queue() : change the loop configuration - blk_mq_unfreeze_queue() - blk_queue_flag_clear(QUEUE_FLAG_DYING); - sync_blockdev() - invalidate_bdev() Report: https://bugs.chromium.org/p/chromium/issues/detail?id=938958#c38 Cc: <[email protected]> Cc: Jens Axboe <[email protected]> Cc: [email protected] Cc: Bart Van Assche <[email protected]> Fixes: 5db470e ("loop: drop caches if offset or block_size are changed") Reported-by: Gwendal Grignou <[email protected]> Reported-by: grygorii tertychnyi <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
- Loading branch information