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). 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); } -- 2.25.1