[PATCH v2 0/3] fsnotify: fix softlockups iterating over d_subdirs

From: Stephen Brennan
Date: Thu Oct 20 2022 - 21:03:35 EST


Hi Amir, Jan, Al,

Here is my swing at v2 of this series. I've taken Amir's suggestion and
stored the flag state in the connector. There's one issue with that:
when the connector is disconnected, we lose the state information, and
we lose the mutual exclusion of conn->lock. It becomes possible for a
new connector to appear and start doing its own updates. Thankfully I'm
pretty confident that there's no case where it would be actually wrong.

I've tested this without the final patch (since that one triggered the
strange dentry refcount warning) and everything works great. Now that
(hopefully) the changes related to fsnotify connectors and things are
solidified, I'll try to look harder at the sleepable iteration, and see
if I can identify why that's not working, and hopefully solicit some
advice & feedback from Al.

There's definitely a few nits and cleanups to be done yet on the series.
Pretty sure I need to clean up the indentation and a few other
checkpatch oddities, so feel free to hit me with whatever changes you
want to see, however small :)

Stephen Brennan (3):
fsnotify: Use d_find_any_alias to get dentry associated with inode
fsnotify: Protect i_fsnotify_mask and child flags with inode rwsem
fsnotify: allow sleepable child flag update

fs/notify/fsnotify.c | 92 +++++++++++++++++++--------
fs/notify/fsnotify.h | 31 ++++++++-
fs/notify/mark.c | 106 ++++++++++++++++++++-----------
include/linux/fsnotify_backend.h | 8 +++
4 files changed, 175 insertions(+), 62 deletions(-)

--
2.34.1