summaryrefslogtreecommitdiff
path: root/lib/reed_solomon
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2019-12-27 13:44:56 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2020-01-18 03:48:42 +0300
commit3e5e479a39ce9ed60cd63f7565cc1d9da77c2a4e (patch)
treef858046976316236bc79e49855de71ebd4270272 /lib/reed_solomon
parent4eea93e3ff98aa185302d562f0df1ad501c51e70 (diff)
downloadlinux-3e5e479a39ce9ed60cd63f7565cc1d9da77c2a4e.tar.xz
f2fs: fix to add swap extent correctly
As Youling reported in mailing list: https://www.linuxquestions.org/questions/linux-newbie-8/the-file-system-f2fs-is-broken-4175666043/ https://www.linux.org/threads/the-file-system-f2fs-is-broken.26490/ There is a test case can corrupt f2fs image: - dd if=/dev/zero of=/swapfile bs=1M count=4096 - chmod 600 /swapfile - mkswap /swapfile - swapon --discard /swapfile The root cause is f2fs_swap_activate() intends to return zero value to setup_swap_extents() to enable SWP_FS mode (swap file goes through fs), in this flow, setup_swap_extents() setups swap extent with wrong block address range, result in discard_swap() erasing incorrect address. Because f2fs_swap_activate() has pinned swapfile, its data block address will not change, it's safe to let swap to handle IO through raw device, so we can get rid of SWAP_FS mode and initial swap extents inside f2fs_swap_activate(), by this way, later discard_swap() can trim in right address range. Fixes: 4969c06a0d83 ("f2fs: support swap file w/ DIO") Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'lib/reed_solomon')
0 files changed, 0 insertions, 0 deletions