Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f2fs:compress: fix a bug #1

Open
wants to merge 3 commits into
base: g-dev-test
Choose a base branch
from

Conversation

jluyangsonghua
Copy link

f2fs:compress: Update isize after compress_write_end, otherwise apendwriting some files would fail when cluster.idx did not add

Jaegeuk Kim and others added 3 commits May 24, 2020 20:57
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: <stable@vger.kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Cc: Bart Van Assche <bvanassche@acm.org>
Fixes: 5db470e ("loop: drop caches if offset or block_size are changed")
Reported-by: Gwendal Grignou <gwendal@chromium.org>
Reported-by: grygorii tertychnyi <gtertych@cisco.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
…writing some files would fail when cluster.idx did not add
@jaegeuk jaegeuk force-pushed the g-dev-test branch 7 times, most recently from af52b58 to b657155 Compare May 30, 2020 01:50
@jaegeuk jaegeuk force-pushed the g-dev-test branch 13 times, most recently from db2167c to d0adea0 Compare June 9, 2020 13:49
@jaegeuk jaegeuk force-pushed the g-dev-test branch 5 times, most recently from 32a5f29 to f13578d Compare June 21, 2020 16:42
@jaegeuk jaegeuk force-pushed the g-dev-test branch 2 times, most recently from 460a9b8 to c20a5c8 Compare June 24, 2020 16:07
@jaegeuk jaegeuk force-pushed the g-dev-test branch 16 times, most recently from 607d493 to 477e5b3 Compare April 11, 2024 15:50
@jaegeuk jaegeuk force-pushed the g-dev-test branch 7 times, most recently from 0f894ad to e22afea Compare April 19, 2024 17:58
@jaegeuk jaegeuk force-pushed the g-dev-test branch 4 times, most recently from d74f720 to ae015df Compare April 29, 2024 17:41
@jaegeuk jaegeuk force-pushed the g-dev-test branch 2 times, most recently from 96886cd to 1314b19 Compare June 18, 2024 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant