lkml.org 
[lkml]   [2021]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] f2fs: remove circular locking between sb_internal and fs_reclaim
Date
From: Daeho Jeong <daehojeong@google.com>

We detected the below circular locking dependency between sb_internal
and fs_reclaim. So, removed it by calling dquot_initialize() before
sb_start_intwrite().

======================================================
WARNING: possible circular locking dependency detected
------------------------------------------------------
kswapd0/133 is trying to acquire lock:
ffffff80d5fb9680 (sb_internal#2){.+.+}-{0:0}, at: evict+0xd4/0x2f8

but task is already holding lock:
ffffffda597c93a8 (fs_reclaim){+.+.}-{0:0}, at:
__fs_reclaim_acquire+0x4/0x50

which lock already depends on the new lock.
...
other info that might help us debug this:

Chain exists of:

sb_internal#2 --> &s->s_dquot.dqio_sem --> fs_reclaim

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(fs_reclaim);
lock(&s->s_dquot.dqio_sem);
lock(fs_reclaim);
lock(sb_internal#2);

Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
fs/f2fs/super.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 86eeb019cc52..a133932333c5 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1370,6 +1370,8 @@ static int f2fs_drop_inode(struct inode *inode)
/* should remain fi->extent_tree for writepage */
f2fs_destroy_extent_node(inode);

+ dquot_initialize(inode);
+
sb_start_intwrite(inode->i_sb);
f2fs_i_size_write(inode, 0);

--
2.33.0.1079.g6e70778dc9-goog
\
 
 \ /
  Last update: 2021-10-14 21:06    [W:0.104 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site