Thread (6 messages) 6 messages, 3 authors, 2021-09-10

Re: [regression] fsnotify fails stress test since fsnotify_for_v5.15-rc1 merged

From: Murphy Zhou <hidden>
Date: 2021-09-10 01:21:04

On Thu, Sep 09, 2021 at 01:14:05PM +0200, Petr Vorel wrote:
quoted
quoted
On Tue, Sep 7, 2021 at 9:33 AM Murphy Zhou [off-list ref] wrote:
quoted
quoted
quoted
Hi,
quoted
quoted
quoted
Since this commit:
quoted
quoted
quoted
commit ec44610fe2b86daef70f3f53f47d2a2542d7094f
Author: Amir Goldstein [off-list ref]
Date:   Tue Aug 10 18:12:19 2021 +0300
quoted
quoted
quoted
    fsnotify: count all objects with attached connectors


quoted
quoted
quoted
Kernel fsnotify can't finish a stress testcase that used to pass quickly.
quoted
quoted
quoted
Kernel hung at umount. Can not be killed but restarting the server.
quoted
quoted
quoted
Reproducer text is attached.
quoted
quoted
Hi Murphy,
quoted
quoted
Thank you for the detailed report.
I was able to reproduce the hang and the attached patch fixes it for me.
Cloud you please verify the fix yourself as well?
quoted
quoted
This is a good regression test.
Did you consider contributing it to LTP?
I think the LTP team could also help converting your reproducer to
an LTP test (CC: Petr).
quoted
@Murphy: yes, please contribute that to LTP. There are already fanotify tests [1],
here is the C API [2] and shell API [3] (if needed, it should be enough to write
it just in C). If you have any questions, don't hesitate ask on LTP ML and Cc
me.
I see you've contributed to LTP already :).
Ya :) Thank you for the links. That's very helpful!
Kind regards,
Petr
quoted
@Amir: thanks!
quoted
Kind regards,
Petr
quoted
[1] https://github.com/linux-test-project/ltp/tree/master/testcases/kernel/syscalls/fanotify/
[2] https://github.com/linux-test-project/ltp/wiki/C-Test-API
[3] https://github.com/linux-test-project/ltp/wiki/Shell-Test-API
quoted
quoted
Thanks,
Amir.
quoted
quoted
From 14d3c313062dfbc86b3d2c4d7deec56a096432f7 Mon Sep 17 00:00:00 2001
From: Amir Goldstein <amir73il@gmail.com>
Date: Thu, 9 Sep 2021 13:46:34 +0300
Subject: [PATCH] fsnotify: fix sb_connectors leak
quoted
quoted
Fix a leak in s_fsnotify_connectors counter in case of a race between
concurrent add of new fsnotify mark to an object.
quoted
quoted
The task that lost the race fails to drop the counter before freeing
the unused connector.
quoted
quoted
Fixes: ec44610fe2b8 ("fsnotify: count all objects with attached connectors")
Reported-by: Murphy Zhou <redacted>
Link: https://lore.kernel.org/linux-fsdevel/20210907063338.ycaw6wvhzrfsfdlp@xzhoux.usersys.redhat.com/ (local)
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/notify/mark.c | 1 +
 1 file changed, 1 insertion(+)
quoted
quoted
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 95006d1d29ab..fa1d99101f89 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -531,6 +531,7 @@ static int fsnotify_attach_connector_to_object(fsnotify_connp_t *connp,
 		/* Someone else created list structure for us */
 		if (inode)
 			fsnotify_put_inode_ref(inode);
+		fsnotify_put_sb_connectors(conn);
 		kmem_cache_free(fsnotify_mark_connector_cachep, conn);
 	}
-- 
Murphy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help