Skip to content

Report overlayfs file ids with fanotify

Amir Goldstein linux-unionfs 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/24 patches 3 repliesIn review
  2. v2 posting 1/24 patches 3 repliesSuperseded
  3. v1 RFC3 patches 4 repliesSuperseded

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4ovl: support encoding non-decodable file handlesfs/overlayfs/export.c fs/overlayfs/inode.c fs/overlayfs/overlayfs.h +2 more+32 -70 replies
2/4ovl: add support for unique fsid per instanceDocumentation/filesystems/overlayfs.rst fs/overlayfs/copy_up.c fs/overlayfs/namei.c +4 more+69 -130 replies
3/4ovl: store persistent uuid/fsid with uuid=onDocumentation/filesystems/overlayfs.rst fs/overlayfs/overlayfs.h fs/overlayfs/params.c +2 more+57 -30 replies
4/4ovl: auto generate uuid for new overlay filesystemsDocumentation/filesystems/overlayfs.rst fs/overlayfs/overlayfs.h fs/overlayfs/params.c +1 more+34 -30 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/4] Report overlayfs file ids with fanotify

Miklos,

This is the second part of the work to support fanotify reporting of events with file ids on overlayfs. The fanotify_event_info_fid struct reported with fanotify events has an object file handle and an fsid, so fanotify requires that filesystems can encode file handles and have a non-zero f_fsid.

The first part [1] that was merged to v6.5-rc1, relaxed the fanotify requirements for filesystems to support reporting events with fid to require only the ->encode_fh() export operation.

Patch 1 changes overlayfs export_operations to meet the new requirements with the default overlay configurations (i.e. no need for nfs_export=on), thus, allowing an fanotify watch with FAN_REPORT_FID on overlayfs. There are LTS tests [2] for fanotify(FAN_REPORT_FID) + overlayfs.

Patches 2-4 are not strcitly needed to support reporting fanotify events with fid, because overlayfs already reports a non-zero f_fsid, it's just not a unique fsid. So before allowing to report events with overlayfs fids, I wanted to fix overlayfs fsid to be more unique.

I wanted to implement a persistent and unique fsid for overlayfs. I wanted it to be the default behavior, but needed to avoid breaking applications that rely on an existing overlayfs fsid to persist. I came up with a solution that is described in patch 4 (uuid=auto) that meets all the requirement above.
There is an xfstest to test the persistent-unique fsid feature [3].

This patch set has been in overlayfs-next for soaking since v6.5-rc1. If you have any reservations that we will not be able to resolve in time for 6.6, especially regarding the on-disk format and backward compat, we could also merge only patch 1 and leave the fsid patches for later.

Thanks,
Amir.

[1] https://lore.kernel.org/linux-fsdevel/[email protected]/
[2] https://github.com/amir73il/ltp/commits/ovl_encode_fid
[3] https://github.com/amir73il/xfstests/commits/ovl_fsid

Amir Goldstein (4):
ovl: support encoding non-decodable file handles
ovl: add support for unique fsid per instance
ovl: store persistent uuid/fsid with uuid=on
ovl: auto generate uuid for new overlay filesystems

 Documentation/filesystems/overlayfs.rst | 25 ++++++++++
 fs/overlayfs/copy_up.c                  |  2 +-
 fs/overlayfs/export.c                   | 26 ++++++++---
 fs/overlayfs/inode.c                    |  2 +-
 fs/overlayfs/namei.c                    |  5 +-
 fs/overlayfs/overlayfs.h                | 22 +++++++++
 fs/overlayfs/ovl_entry.h                |  3 +-
 fs/overlayfs/params.c                   | 31 +++++++++++--
 fs/overlayfs/super.c                    | 29 ++++++++++--
 fs/overlayfs/util.c                     | 61 +++++++++++++++++++++++++
 10 files changed, 186 insertions(+), 20 deletions(-)
Signature · 1 line
2.34.1