Skip to content

Support fanotify FAN_REPORT_FID on all filesystems

Amir Goldstein linux-fsdevel 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/22 patches 0 repliesNew
  2. v2 posting 1/22 patches 4 repliesSuperseded
  3. v12 patches 10 repliesSuperseded

Changes in v2 from the cover letter

- Add missing fsnotify_put_mark()
- Improve readablity of fanotify_test_fsid()
- Rename fanotify_check_mark_fsid() => fanotify_set_mark_fsid()
- Remove fanotify_mark_fsid() wrapper

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fanotify: store fsid in mark instead of in connectorfs/notify/fanotify/fanotify.c fs/notify/fanotify/fanotify.h fs/notify/fanotify/fanotify_user.c +2 more+42 -700 replies
2/2fanotify: allow "weak" fsid when watching a single filesystemfs/notify/fanotify/fanotify.c fs/notify/fanotify/fanotify.h fs/notify/fanotify/fanotify_user.c +1 more+101 -330 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH REPOST v2 0/2] Support fanotify FAN_REPORT_FID on all filesystems

Jan,

In the vfs fanotify update for v6.7-rc1 [1], we considerably increased the amount of filesystems that can setup inode marks with FAN_REPORT_FID:
- NFS export is no longer required for setting up inode marks
- All the simple fs gained a non-zero fsid

This leaves the following in-tree filesystems where inode marks with FAN_REPORT_FID cannot be set:
- nfs, fuse, afs, coda (zero fsid)
- btrfs non-root subvol (fsid not a unique identifier of sb)

This patch set takes care of these remaining cases, by allowing inode marks, as long as all inode marks in the group are contained to the same filesystem and same fsid (i.e. subvol).

I've written some basic sanity tests [2] and a man-page update draft [3]. The LTP tests excersize the new code by running tests that did not run before on ntfs-3g fuse filesystem and skipping the test cases with mount and sb marks.

I've also tested fsnotifywait --recursive on fuse and on btrfs subvol. It works as expected - if tree travesal crosses filesystem or subvol boundary, setting the subdir mark fails with -EXDEV.

Thanks,
Amir.

[1] https://lore.kernel.org/linux-fsdevel/20231107-vfs-fsid-5037e344d215@brauner/
[2] https://github.com/amir73il/ltp/commits/fanotify_fsid
[3] https://github.com/amir73il/man-pages/commits/fanotify_fsid

Changes since v1:
- Add missing fsnotify_put_mark()
- Improve readablity of fanotify_test_fsid()
- Rename fanotify_check_mark_fsid() => fanotify_set_mark_fsid()
- Remove fanotify_mark_fsid() wrapper

Amir Goldstein (2):
fanotify: store fsid in mark instead of in connector
fanotify: allow "weak" fsid when watching a single filesystem

 fs/notify/fanotify/fanotify.c      |  34 ++------
 fs/notify/fanotify/fanotify.h      |  16 ++++
 fs/notify/fanotify/fanotify_user.c | 124 ++++++++++++++++++++++++-----
 fs/notify/mark.c                   |  52 ++----------
 include/linux/fsnotify_backend.h   |  14 ++--
 5 files changed, 140 insertions(+), 100 deletions(-)
Signature · 1 line
2.34.1