FROMGIT: f2fs: let's avoid to get cp_rwsem twice by f2fs_evict_inode by d_invalidate
f2fs_unlink
-> f2fs_lock_op
-> d_invalidate
-> shrink_dentry_list
-> iput_final
-> f2fs_evict_inode
-> f2fs_lock_op
Bug: 260792398
Signed-off-by: Han Qi <hanqi@vivo.com>
Change-Id: I281afd7ffa0c66509ec5984fd7774ccd4ddef1f4
(cherry picked from commit 14dc00a0e2dbea4b685ab9723ff511fcfd223c18 git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 3048074..9611bde 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -613,6 +613,8 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
goto fail;
}
f2fs_delete_entry(de, page, dir, inode);
+ f2fs_unlock_op(sbi);
+
#ifdef CONFIG_UNICODE
/* VFS negative dentries are incompatible with Encoding and
* Case-insensitiveness. Eventually we'll want avoid
@@ -623,8 +625,6 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
if (IS_CASEFOLDED(dir))
d_invalidate(dentry);
#endif
- f2fs_unlock_op(sbi);
-
if (IS_DIRSYNC(dir))
f2fs_sync_fs(sbi->sb, 1);
fail: