Re: [PATCH] fsnotify: move fsnotify_open() hook into do_dentry_open()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 12, 2023 at 10:54:31AM +0200, Jan Kara wrote:
> On Sun 11-06-23 15:24:29, Amir Goldstein wrote:
> > fsnotify_open() hook is called only from high level system calls
> > context and not called for the very many helpers to open files.
> > 
> > This may makes sense for many of the special file open cases, but it is
> > inconsistent with fsnotify_close() hook that is called for every last
> > fput() of on a file object with FMODE_OPENED.
> > 
> > As a result, it is possible to observe ACCESS, MODIFY and CLOSE events
> > without ever observing an OPEN event.
> > 
> > Fix this inconsistency by replacing all the fsnotify_open() hooks with
> > a single hook inside do_dentry_open().
> > 
> > If there are special cases that would like to opt-out of the possible
> > overhead of fsnotify() call in fsnotify_open(), they would probably also
> > want to avoid the overhead of fsnotify() call in the rest of the fsnotify
> > hooks, so they should be opening that file with the __FMODE_NONOTIFY flag.
> > 
> > However, in the majority of those cases, the s_fsnotify_connectors
> > optimization in fsnotify_parent() would be sufficient to avoid the
> > overhead of fsnotify() call anyway.
> > 
> > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> 
> Thanks! The cleanup looks nice so I've applied it with the typo fixup from
> Christian. I have a slight worry this might break something subtle
> somewhere but after searching for a while I didn't find anything and the
> machine boots and ltp tests pass so it's worth a try :)

Yep, I agree. If we can reduce cluttering multiple places with
fsnotify_open() and instead move it to a central location it's a
maintenance win in the long term.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux