[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_E51B7925E5BAF4BBCF33739E5E1BFA4B9F08@qq.com>
Date: Wed, 14 Aug 2024 08:48:40 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+78ff2855f26377625419@...kaller.appspotmail.com
Cc: chao@...nel.org,
jaegeuk@...nel.org,
linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [f2fs?] WARNING: lock held when returning to user space in f2fs_commit_atomic_write
unlock i_gc_rwsem[WRITE] before quiting f2fs_commit_atomic_write
Fixes: 7566a155c666 ("f2fs: atomic: fix to not allow GC to pollute atomic_file")
Reported-by: syzbot+78ff2855f26377625419@...kaller.appspotmail.com
#syz test: net-next 9e6869691724
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 741e46f9d0fd..a43054ab0cf1 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -389,13 +389,13 @@ int f2fs_commit_atomic_write(struct inode *inode)
err = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX);
if (err)
- return err;
+ goto out;
/* writeback GCing page of cow_inode */
err = filemap_write_and_wait_range(fi->cow_inode->i_mapping,
0, LLONG_MAX);
if (err)
- return err;
+ goto out;
filemap_invalidate_lock(inode->i_mapping);
@@ -407,6 +407,7 @@ int f2fs_commit_atomic_write(struct inode *inode)
f2fs_unlock_op(sbi);
filemap_invalidate_unlock(inode->i_mapping);
+out:
f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
return err;
Powered by blists - more mailing lists