f2fs: compress: disallow disabling compress on non-empty compressed file
authorHyeong-Jun Kim <hj514.kim@samsung.com>
Wed, 27 Oct 2021 04:16:00 +0000 (13:16 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 09:39:12 +0000 (10:39 +0100)
commit0a17fff6f045137d67294858590036007f1aa7d6
tree5edb7acdedd59e8011c755c708d71f04b15a4b3b
parent4ce685cc9a0b1a3c253477a61fbee9aba72b736f
f2fs: compress: disallow disabling compress on non-empty compressed file

[ Upstream commit 02d58cd253d7536c412993573fc6b3b4454960eb ]

Compresse file and normal file has differ in i_addr addressing,
specifically addrs per inode/block. So, we will face data loss, if we
disable the compression flag on non-empty files. Therefore we should
disallow not only enabling but disabling the compression flag on
non-empty files.

Fixes: 4c8ff7095bef ("f2fs: support data compression")
Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Hyeong-Jun Kim <hj514.kim@samsung.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/f2fs.h