--- /dev/null
+From 569d490fe49ba3a309e7bcf32236cb5a3ee9662f Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Sat, 26 Aug 2023 17:28:48 +0200
+Subject: Revert "f2fs: don't reset unchangable mount option in f2fs_remount()"
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+This reverts commit e2fb24ce37caeaecff08af4e9967c8462624312b which is
+commit 458c15dfbce62c35fefd9ca637b20a051309c9f1 upstream.
+
+Something is currently broken in the f2fs code, Guenter has reported
+boot problems with it for a few releases now, so revert the most recent
+f2fs changes in the hope to get this back to a working filesystem.
+
+Reported-by: Guenter Roeck <linux@roeck-us.net>
+Link: https://lore.kernel.org/r/b392e1a8-b987-4993-bd45-035db9415a6e@roeck-us.net
+Cc: Chao Yu <chao@kernel.org>
+Cc: Jaegeuk Kim <jaegeuk@kernel.org>
+Cc: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/f2fs/super.c | 30 ++++++++++++------------------
+ 1 file changed, 12 insertions(+), 18 deletions(-)
+
+--- a/fs/f2fs/super.c
++++ b/fs/f2fs/super.c
+@@ -2040,22 +2040,9 @@ static int f2fs_show_options(struct seq_
+ return 0;
+ }
+
+-static void default_options(struct f2fs_sb_info *sbi, bool remount)
++static void default_options(struct f2fs_sb_info *sbi)
+ {
+ /* init some FS parameters */
+- if (!remount) {
+- set_opt(sbi, READ_EXTENT_CACHE);
+- clear_opt(sbi, DISABLE_CHECKPOINT);
+-
+- if (f2fs_hw_support_discard(sbi) || f2fs_hw_should_discard(sbi))
+- set_opt(sbi, DISCARD);
+-
+- if (f2fs_sb_has_blkzoned(sbi))
+- F2FS_OPTION(sbi).discard_unit = DISCARD_UNIT_SECTION;
+- else
+- F2FS_OPTION(sbi).discard_unit = DISCARD_UNIT_BLOCK;
+- }
+-
+ if (f2fs_sb_has_readonly(sbi))
+ F2FS_OPTION(sbi).active_logs = NR_CURSEG_RO_TYPE;
+ else
+@@ -2078,16 +2065,23 @@ static void default_options(struct f2fs_
+ set_opt(sbi, INLINE_XATTR);
+ set_opt(sbi, INLINE_DATA);
+ set_opt(sbi, INLINE_DENTRY);
++ set_opt(sbi, READ_EXTENT_CACHE);
+ set_opt(sbi, NOHEAP);
++ clear_opt(sbi, DISABLE_CHECKPOINT);
+ set_opt(sbi, MERGE_CHECKPOINT);
+ F2FS_OPTION(sbi).unusable_cap = 0;
+ sbi->sb->s_flags |= SB_LAZYTIME;
+ if (!f2fs_sb_has_readonly(sbi) && !f2fs_readonly(sbi->sb))
+ set_opt(sbi, FLUSH_MERGE);
+- if (f2fs_sb_has_blkzoned(sbi))
++ if (f2fs_hw_support_discard(sbi) || f2fs_hw_should_discard(sbi))
++ set_opt(sbi, DISCARD);
++ if (f2fs_sb_has_blkzoned(sbi)) {
+ F2FS_OPTION(sbi).fs_mode = FS_MODE_LFS;
+- else
++ F2FS_OPTION(sbi).discard_unit = DISCARD_UNIT_SECTION;
++ } else {
+ F2FS_OPTION(sbi).fs_mode = FS_MODE_ADAPTIVE;
++ F2FS_OPTION(sbi).discard_unit = DISCARD_UNIT_BLOCK;
++ }
+
+ #ifdef CONFIG_F2FS_FS_XATTR
+ set_opt(sbi, XATTR_USER);
+@@ -2259,7 +2253,7 @@ static int f2fs_remount(struct super_blo
+ clear_sbi_flag(sbi, SBI_NEED_SB_WRITE);
+ }
+
+- default_options(sbi, true);
++ default_options(sbi);
+
+ /* parse mount options */
+ err = parse_options(sb, data, true);
+@@ -4156,7 +4150,7 @@ try_onemore:
+ sbi->s_chksum_seed = f2fs_chksum(sbi, ~0, raw_super->uuid,
+ sizeof(raw_super->uuid));
+
+- default_options(sbi, false);
++ default_options(sbi);
+ /* parse mount options */
+ options = kstrdup((const char *)data, GFP_KERNEL);
+ if (data && !options) {
--- /dev/null
+From 26cb3bf5b61a2f7bd7d791a92e7b34408eabf13c Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Sat, 26 Aug 2023 17:29:00 +0200
+Subject: Revert "f2fs: fix to do sanity check on direct node in truncate_dnode()"
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+This reverts commit a78a8bcdc26de5ef3a0ee27c9c6c512e54a6051c which is
+commit a6ec83786ab9f13f25fb18166dee908845713a95 upstream.
+
+Something is currently broken in the f2fs code, Guenter has reported
+boot problems with it for a few releases now, so revert the most recent
+f2fs changes in the hope to get this back to a working filesystem.
+
+Reported-by: Guenter Roeck <linux@roeck-us.net>
+Link: https://lore.kernel.org/r/b392e1a8-b987-4993-bd45-035db9415a6e@roeck-us.net
+Cc: Chao Yu <chao@kernel.org>
+Cc: Jaegeuk Kim <jaegeuk@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/f2fs/f2fs.h | 1 +
+ fs/f2fs/file.c | 5 +++++
+ fs/f2fs/node.c | 14 ++------------
+ include/linux/f2fs_fs.h | 1 -
+ 4 files changed, 8 insertions(+), 13 deletions(-)
+
+--- a/fs/f2fs/f2fs.h
++++ b/fs/f2fs/f2fs.h
+@@ -3431,6 +3431,7 @@ static inline bool __is_valid_data_blkad
+ * file.c
+ */
+ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
++void f2fs_truncate_data_blocks(struct dnode_of_data *dn);
+ int f2fs_do_truncate_blocks(struct inode *inode, u64 from, bool lock);
+ int f2fs_truncate_blocks(struct inode *inode, u64 from, bool lock);
+ int f2fs_truncate(struct inode *inode);
+--- a/fs/f2fs/file.c
++++ b/fs/f2fs/file.c
+@@ -628,6 +628,11 @@ void f2fs_truncate_data_blocks_range(str
+ dn->ofs_in_node, nr_free);
+ }
+
++void f2fs_truncate_data_blocks(struct dnode_of_data *dn)
++{
++ f2fs_truncate_data_blocks_range(dn, ADDRS_PER_BLOCK(dn->inode));
++}
++
+ static int truncate_partial_data_page(struct inode *inode, u64 from,
+ bool cache_only)
+ {
+--- a/fs/f2fs/node.c
++++ b/fs/f2fs/node.c
+@@ -923,7 +923,6 @@ static int truncate_node(struct dnode_of
+
+ static int truncate_dnode(struct dnode_of_data *dn)
+ {
+- struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode);
+ struct page *page;
+ int err;
+
+@@ -931,25 +930,16 @@ static int truncate_dnode(struct dnode_o
+ return 1;
+
+ /* get direct node */
+- page = f2fs_get_node_page(sbi, dn->nid);
++ page = f2fs_get_node_page(F2FS_I_SB(dn->inode), dn->nid);
+ if (PTR_ERR(page) == -ENOENT)
+ return 1;
+ else if (IS_ERR(page))
+ return PTR_ERR(page);
+
+- if (IS_INODE(page) || ino_of_node(page) != dn->inode->i_ino) {
+- f2fs_err(sbi, "incorrect node reference, ino: %lu, nid: %u, ino_of_node: %u",
+- dn->inode->i_ino, dn->nid, ino_of_node(page));
+- set_sbi_flag(sbi, SBI_NEED_FSCK);
+- f2fs_handle_error(sbi, ERROR_INVALID_NODE_REFERENCE);
+- f2fs_put_page(page, 1);
+- return -EFSCORRUPTED;
+- }
+-
+ /* Make dnode_of_data for parameter */
+ dn->node_page = page;
+ dn->ofs_in_node = 0;
+- f2fs_truncate_data_blocks_range(dn, ADDRS_PER_BLOCK(dn->inode));
++ f2fs_truncate_data_blocks(dn);
+ err = truncate_node(dn);
+ if (err) {
+ f2fs_put_page(page, 1);
+--- a/include/linux/f2fs_fs.h
++++ b/include/linux/f2fs_fs.h
+@@ -104,7 +104,6 @@ enum f2fs_error {
+ ERROR_INCONSISTENT_SIT,
+ ERROR_CORRUPTED_VERITY_XATTR,
+ ERROR_CORRUPTED_XATTR,
+- ERROR_INVALID_NODE_REFERENCE,
+ ERROR_MAX,
+ };
+
--- /dev/null
+From 0f0afb4610c6ab6375157376f2bc26356fd2d615 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Sat, 26 Aug 2023 17:28:54 +0200
+Subject: Revert "f2fs: fix to set flush_merge opt and show noflush_merge"
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+This reverts commit 6ba0594a81f91d6fd8ca9bd4ad23aa1618635a0f which is
+commit 967eaad1fed5f6335ea97a47d45214744dc57925 upstream.
+
+Something is currently broken in the f2fs code, Guenter has reported
+boot problems with it for a few releases now, so revert the most recent
+f2fs changes in the hope to get this back to a working filesystem.
+
+Reported-by: Guenter Roeck <linux@roeck-us.net>
+Link: https://lore.kernel.org/r/b392e1a8-b987-4993-bd45-035db9415a6e@roeck-us.net
+Cc: Chao Yu <chao@kernel.org>
+Cc: Jaegeuk Kim <jaegeuk@kernel.org>
+Cc: Yangtao Li <frank.li@vivo.com>
+Cc: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/f2fs/super.c | 13 ++-----------
+ 1 file changed, 2 insertions(+), 11 deletions(-)
+
+--- a/fs/f2fs/super.c
++++ b/fs/f2fs/super.c
+@@ -1347,12 +1347,6 @@ default_check:
+ return -EINVAL;
+ }
+
+- if ((f2fs_sb_has_readonly(sbi) || f2fs_readonly(sbi->sb)) &&
+- test_opt(sbi, FLUSH_MERGE)) {
+- f2fs_err(sbi, "FLUSH_MERGE not compatible with readonly mode");
+- return -EINVAL;
+- }
+-
+ if (f2fs_sb_has_readonly(sbi) && !f2fs_readonly(sbi->sb)) {
+ f2fs_err(sbi, "Allow to mount readonly mode only");
+ return -EROFS;
+@@ -1939,10 +1933,8 @@ static int f2fs_show_options(struct seq_
+ seq_puts(seq, ",inline_dentry");
+ else
+ seq_puts(seq, ",noinline_dentry");
+- if (test_opt(sbi, FLUSH_MERGE))
++ if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE))
+ seq_puts(seq, ",flush_merge");
+- else
+- seq_puts(seq, ",noflush_merge");
+ if (test_opt(sbi, NOBARRIER))
+ seq_puts(seq, ",nobarrier");
+ if (test_opt(sbi, FASTBOOT))
+@@ -2071,8 +2063,7 @@ static void default_options(struct f2fs_
+ set_opt(sbi, MERGE_CHECKPOINT);
+ F2FS_OPTION(sbi).unusable_cap = 0;
+ sbi->sb->s_flags |= SB_LAZYTIME;
+- if (!f2fs_sb_has_readonly(sbi) && !f2fs_readonly(sbi->sb))
+- set_opt(sbi, FLUSH_MERGE);
++ set_opt(sbi, FLUSH_MERGE);
+ if (f2fs_hw_support_discard(sbi) || f2fs_hw_should_discard(sbi))
+ set_opt(sbi, DISCARD);
+ if (f2fs_sb_has_blkzoned(sbi)) {
objtool-x86-fix-srso-mess.patch
+revert-f2fs-don-t-reset-unchangable-mount-option-in-f2fs_remount.patch
+revert-f2fs-fix-to-set-flush_merge-opt-and-show-noflush_merge.patch
+revert-f2fs-fix-to-do-sanity-check-on-direct-node-in-truncate_dnode.patch
nfsv4.2-fix-error-handling-in-nfs42_proc_getxattr.patch
nfsv4-fix-out-path-in-__nfs4_get_acl_uncached.patch
xprtrdma-remap-receive-buffers-after-a-reconnect.patch