> > On Tue, Sep 7, 2021 at 9:33 AM Murphy Zhou <jencce.kernel@xxxxxxxxx> wrote: > > > Hi, > > > Since this commit: > > > commit ec44610fe2b86daef70f3f53f47d2a2542d7094f > > > Author: Amir Goldstein <amir73il@xxxxxxxxx> > > > Date: Tue Aug 10 18:12:19 2021 +0300 > > > fsnotify: count all objects with attached connectors > > > Kernel fsnotify can't finish a stress testcase that used to pass quickly. > > > Kernel hung at umount. Can not be killed but restarting the server. > > > Reproducer text is attached. > > Hi Murphy, > > 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? > > 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). > @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 :). Kind regards, Petr > @Amir: thanks! > Kind regards, > Petr > [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 > > Thanks, > > Amir. > > From 14d3c313062dfbc86b3d2c4d7deec56a096432f7 Mon Sep 17 00:00:00 2001 > > From: Amir Goldstein <amir73il@xxxxxxxxx> > > Date: Thu, 9 Sep 2021 13:46:34 +0300 > > Subject: [PATCH] fsnotify: fix sb_connectors leak > > Fix a leak in s_fsnotify_connectors counter in case of a race between > > concurrent add of new fsnotify mark to an object. > > The task that lost the race fails to drop the counter before freeing > > the unused connector. > > Fixes: ec44610fe2b8 ("fsnotify: count all objects with attached connectors") > > Reported-by: Murphy Zhou <jencce.kernel@xxxxxxxxx> > > Link: https://lore.kernel.org/linux-fsdevel/20210907063338.ycaw6wvhzrfsfdlp@xxxxxxxxxxxxxxxxxxxxxxxxx/ > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > > --- > > fs/notify/mark.c | 1 + > > 1 file changed, 1 insertion(+) > > 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); > > }