Skip to content

Commit 59cda49

Browse files
amir73iljankara
authored andcommitted
shmem: allow reporting fanotify events with file handles on tmpfs
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/20210322173944.449469-3-amir73il@gmail.com Acked-by: Hugh Dickins <hughd@google.com> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
1 parent 9591c3a commit 59cda49

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

mm/shmem.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,6 +2846,9 @@ static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
28462846
buf->f_ffree = sbinfo->free_inodes;
28472847
}
28482848
/* else leave those fields 0 like simple_statfs */
2849+
2850+
buf->f_fsid = uuid_to_fsid(dentry->d_sb->s_uuid.b);
2851+
28492852
return 0;
28502853
}
28512854

0 commit comments

Comments
 (0)