]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gfs2: fs: derive f_fsid from s_uuid
authorAmir Goldstein <amir73il@gmail.com>
Tue, 24 Oct 2023 07:55:35 +0000 (10:55 +0300)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 6 Nov 2023 00:51:26 +0000 (01:51 +0100)
gfs2 already has optional persistent uuid.

Use that uuid to report f_fsid in statfs(2), same as ext2/ext4/zonefs.

This allows gfs2 to be monitored by fanotify filesystem watch.
for example, with inotify-tools 4.23.8.0, the following command can be
used to watch changes over entire filesystem:

  fsnotifywatch --filesystem /mnt/gfs2

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/super.c

index 4dad30dd72fce423ecced81fc2942f3d471b33f5..726f062bc490aefc4a31f9c4ba08fa709734b856 100644 (file)
@@ -1006,6 +1006,7 @@ static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_files = sc.sc_dinodes + sc.sc_free;
        buf->f_ffree = sc.sc_free;
        buf->f_namelen = GFS2_FNAMESIZE;
+       buf->f_fsid = uuid_to_fsid(sb->s_uuid.b);
 
        return 0;
 }