]> Git Repo - linux.git/commitdiff
shmem: allow reporting fanotify events with file handles on tmpfs
authorAmir Goldstein <[email protected]>
Mon, 22 Mar 2021 17:39:44 +0000 (19:39 +0200)
committerJan Kara <[email protected]>
Mon, 19 Apr 2021 14:03:48 +0000 (16:03 +0200)
Since kernel v5.1, fanotify_init(2) supports the flag FAN_REPORT_FID
for identifying objects using file handle and fsid in events.

fanotify_mark(2) fails with -ENODEV when trying to set a mark on
filesystems that report null f_fsid in stasfs(2).

Use the digest of uuid as f_fsid for tmpfs to uniquely identify tmpfs
objects as best as possible and allow setting an fanotify mark that
reports events with file handles on tmpfs.

Link: https://lore.kernel.org/r/[email protected]
Acked-by: Hugh Dickins <[email protected]>
Reviewed-by: Christian Brauner <[email protected]>
Signed-off-by: Amir Goldstein <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
mm/shmem.c

index b2db4ed0fbc7c936b2603dc1a2dfcef3bbeae088..162d8f8993bbf4b8ae49cdc89cc3fb29d6806dd0 100644 (file)
@@ -2846,6 +2846,9 @@ static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
                buf->f_ffree = sbinfo->free_inodes;
        }
        /* else leave those fields 0 like simple_statfs */
+
+       buf->f_fsid = uuid_to_fsid(dentry->d_sb->s_uuid.b);
+
        return 0;
 }
 
This page took 0.055172 seconds and 4 git commands to generate.