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

Message ID 20221021010310.29521-1-stephen.s.brennan@oracle.com
Headers
Series fsnotify: fix softlockups iterating over d_subdirs |

Message

Stephen Brennan Oct. 21, 2022, 1:03 a.m. UTC
  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(-)