diff mbox series

[v2,3/3] fanotify: support setting marks in btrfs sub-volumes

Message ID 20231026155224.129326-4-amir73il@gmail.com (mailing list archive)
State New, archived
Headers show
Series fanotify support for btrfs sub-volumes | expand

Commit Message

Amir Goldstein Oct. 26, 2023, 3:52 p.m. UTC
Setting fanotify marks that report events with fid on btrfs sub-volumes
was not supported, because in the case of btrfs sub-volumes, there is no
uniform fsid that can be reported in events.

Now that we report the fsid on the object whose path was used to setup
the mark, we can allow support setting marks in btrfs sub-volumes.

Users that make multiple fanotify_mark(2) calls on the same filesystem
are expected to call statfs(2) on every path were a mark was setup and
can expect that any of those fsid could be reported in any of the events.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/notify/fanotify/fanotify_user.c | 13 -------------
 1 file changed, 13 deletions(-)
diff mbox series

Patch

diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index fdd39bf91806..59a7a720fd08 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -1566,7 +1566,6 @@  SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
 
 static int fanotify_test_fsid(struct dentry *dentry, __kernel_fsid_t *fsid)
 {
-	__kernel_fsid_t root_fsid;
 	int err;
 
 	/*
@@ -1579,18 +1578,6 @@  static int fanotify_test_fsid(struct dentry *dentry, __kernel_fsid_t *fsid)
 	if (!fsid->val[0] && !fsid->val[1])
 		return -ENODEV;
 
-	/*
-	 * Make sure dentry is not of a filesystem subvolume (e.g. btrfs)
-	 * which uses a different fsid than sb root.
-	 */
-	err = vfs_get_fsid(dentry->d_sb->s_root, &root_fsid);
-	if (err)
-		return err;
-
-	if (root_fsid.val[0] != fsid->val[0] ||
-	    root_fsid.val[1] != fsid->val[1])
-		return -EXDEV;
-
 	return 0;
 }