aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/page-io.c
diff options
context:
space:
mode:
authorzhangyi (F) <yi.zhang@huawei.com>2019-02-10 23:26:06 -0500
committerTheodore Ts'o <tytso@mit.edu>2019-02-10 23:26:06 -0500
commit597599268e3b91cac71faf48743f4783dec682fc (patch)
tree21b1920d57bef665bf26da39c818aee067948964 /fs/ext4/page-io.c
parentjbd2: clear dirty flag when revoking a buffer from an older transaction (diff)
downloadlinux-dev-597599268e3b91cac71faf48743f4783dec682fc.tar.xz
linux-dev-597599268e3b91cac71faf48743f4783dec682fc.zip
jbd2: discard dirty data when forgetting an un-journalled buffer
We do not unmap and clear dirty flag when forgetting a buffer without journal or does not belongs to any transaction, so the invalid dirty data may still be written to the disk later. It's fine if the corresponding block is never used before the next mount, and it's also fine that we invoke clean_bdev_aliases() related functions to unmap the block device mapping when re-allocating such freed block as data block. But this logic is somewhat fragile and risky that may lead to data corruption if we forget to clean bdev aliases. So, It's better to discard dirty data during forget time. We have been already handled all the cases of forgetting journalled buffer, this patch deal with the remaining two cases. - buffer is not journalled yet, - buffer is journalled but doesn't belongs to any transaction. We invoke __bforget() instead of __brelese() when forgetting an un-journalled buffer in jbd2_journal_forget(). After this patch we can remove all clean_bdev_aliases() related calls in ext4. Suggested-by: Jan Kara <jack@suse.cz> Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4/page-io.c')
0 files changed, 0 insertions, 0 deletions