This is a note to let you know that I've just added the patch titled f2fs: set the default compress_level on ioctl to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: f2fs-set-the-default-compress_level-on-ioctl.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From f5f3bd903a5d3e3b2ba89f11e0e29db25e60c048 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Date: Fri, 8 Sep 2023 15:41:42 -0700 Subject: f2fs: set the default compress_level on ioctl From: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> commit f5f3bd903a5d3e3b2ba89f11e0e29db25e60c048 upstream. Otherwise, we'll get a broken inode. # touch $FILE # f2fs_io setflags compression $FILE # f2fs_io set_coption 2 8 $FILE [ 112.227612] F2FS-fs (dm-51): sanity_check_compress_inode: inode (ino=8d3fe) has unsupported compress level: 0, run fsck to fix Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/f2fs/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -4006,6 +4006,15 @@ static int f2fs_ioc_set_compress_option( F2FS_I(inode)->i_compress_algorithm = option.algorithm; F2FS_I(inode)->i_log_cluster_size = option.log_cluster_size; F2FS_I(inode)->i_cluster_size = BIT(option.log_cluster_size); + /* Set default level */ + if (F2FS_I(inode)->i_compress_algorithm == COMPRESS_ZSTD) + F2FS_I(inode)->i_compress_level = F2FS_ZSTD_DEFAULT_CLEVEL; + else + F2FS_I(inode)->i_compress_level = 0; + /* Adjust mount option level */ + if (option.algorithm == F2FS_OPTION(sbi).compress_algorithm && + F2FS_OPTION(sbi).compress_level) + F2FS_I(inode)->i_compress_level = F2FS_OPTION(sbi).compress_level; f2fs_mark_inode_dirty_sync(inode, true); if (!f2fs_is_compress_backend_ready(inode)) Patches currently in stable-queue which might be from jaegeuk@xxxxxxxxxx are queue-6.6/f2fs-avoid-format-overflow-warning.patch queue-6.6/f2fs-do-not-return-efscorrupted-but-try-to-run-online-repair.patch queue-6.6/f2fs-fix-error-path-of-__f2fs_build_free_nids.patch queue-6.6/f2fs-split-initial-and-dynamic-conditions-for-extent_cache.patch queue-6.6/f2fs-set-the-default-compress_level-on-ioctl.patch queue-6.6/f2fs-fix-error-handling-of-__get_node_page.patch