From: syzbot <syzbot+4235e4d7b6fd75704528@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] f2fs: fix infinite loop in block_operations() on CP error
Date: Sat, 06 Dec 2025 02:34:18 -0800 [thread overview]
Message-ID: <693406aa.a70a0220.38f243.0022.GAE@google.com> (raw)
In-Reply-To: <69332cf9.a70a0220.243dc6.0011.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] f2fs: fix infinite loop in block_operations() on CP error
Author: kartikey406@gmail.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
When IO errors occur and CP_ERROR_FLAG is set, the retry loops in
block_operations() can spin forever. The sync functions (f2fs_sync_dirty_inodes,
f2fs_sync_inode_meta, f2fs_sync_node_pages) may return success even though
dirty pages remain due to IO errors, causing infinite retry loops.
The hung task traces show:
f2fs: block_ops check DIRTY_IMETA=1
f2fs: block_ops retry_flush_quotas cnt=0
f2fs: block_ops retry_flush_dents dirty_dents=0
f2fs: block_ops check DIRTY_IMETA=1
... (repeats forever)
Add f2fs_cp_error() checks after each sync operation in block_operations()
to break out of retry loops when the filesystem is in error state.
Reported-by: syzbot+4235e4d7b6fd75704528@syzkaller.appspotmail.com
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
fs/f2fs/checkpoint.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index bbe07e3a6c75..a6f831ed3d9b 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1236,6 +1236,8 @@ static int block_operations(struct f2fs_sb_info *sbi)
f2fs_do_quota_sync(sbi->sb, -1);
up_read(&sbi->sb->s_umount);
}
+ if (unlikely(f2fs_cp_error(sbi)))
+ return -EIO;
cond_resched();
goto retry_flush_quotas;
}
@@ -1247,6 +1249,8 @@ static int block_operations(struct f2fs_sb_info *sbi)
err = f2fs_sync_dirty_inodes(sbi, DIR_INODE, true);
if (err)
return err;
+ if (unlikely(f2fs_cp_error(sbi)))
+ return -EIO;
cond_resched();
goto retry_flush_quotas;
}
@@ -1263,6 +1267,8 @@ static int block_operations(struct f2fs_sb_info *sbi)
err = f2fs_sync_inode_meta(sbi);
if (err)
return err;
+ if (unlikely(f2fs_cp_error(sbi)))
+ return -EIO;
cond_resched();
goto retry_flush_quotas;
}
@@ -1280,6 +1286,11 @@ static int block_operations(struct f2fs_sb_info *sbi)
f2fs_unlock_all(sbi);
return err;
}
+ if (unlikely(f2fs_cp_error(sbi))) {
+ f2fs_up_write(&sbi->node_change);
+ f2fs_unlock_all(sbi);
+ return -EIO;
+ }
cond_resched();
goto retry_flush_nodes;
}
--
2.43.0
prev parent reply other threads:[~2025-12-06 10:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 19:05 [syzbot] [f2fs?] INFO: task hung in f2fs_release_file (3) syzbot
2025-12-06 1:58 ` Forwarded: [PATCH] f2fs: fix hung task in block_operations during checkpoint syzbot
2025-12-06 2:31 ` syzbot
2025-12-06 4:47 ` syzbot
2025-12-06 5:34 ` syzbot
2025-12-06 6:26 ` syzbot
2025-12-06 6:55 ` syzbot
2025-12-06 8:03 ` syzbot
2025-12-06 8:50 ` syzbot
2025-12-06 10:34 ` syzbot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=693406aa.a70a0220.38f243.0022.GAE@google.com \
--to=syzbot+4235e4d7b6fd75704528@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox