On Tue, Aug 10, 2021 at 1:47 PM Jan Kara <jack@xxxxxxx> wrote: > > On Tue 03-08-21 21:03:43, Amir Goldstein wrote: > > Rename s_fsnotify_inode_refs to s_fsnotify_conectors and count all > > objects with attached connectors, not only inodes with attached > > connectors. > > > > This will be used to optimize fsnotify() calls on sb without any > > type of marks. > > > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > > --- > > fs/notify/fsnotify.c | 6 +++--- > > fs/notify/mark.c | 45 +++++++++++++++++++++++++++++++++++++++++--- > > include/linux/fs.h | 4 ++-- > > 3 files changed, 47 insertions(+), 8 deletions(-) > > > > diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c > > index 30d422b8c0fc..a5de7f32c493 100644 > > --- a/fs/notify/fsnotify.c > > +++ b/fs/notify/fsnotify.c > > @@ -87,9 +87,9 @@ static void fsnotify_unmount_inodes(struct super_block *sb) > > > > if (iput_inode) > > iput(iput_inode); > > - /* Wait for outstanding inode references from connectors */ > > - wait_var_event(&sb->s_fsnotify_inode_refs, > > - !atomic_long_read(&sb->s_fsnotify_inode_refs)); > > + /* Wait for outstanding object references from connectors */ > > + wait_var_event(&sb->s_fsnotify_connectors, > > + !atomic_long_read(&sb->s_fsnotify_connectors)); > > } > > I think this is wrong and will deadlock unmount if there's pending sb mark > because s_fsnotify_connectors won't drop to 0. I think you need to move > this wait to fsnotify_sb_delete() after fsnotify_clear_marks_by_sb(). Oops. Thanks for catching this. Amir.