linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gfs2: fs: derive f_fsid from s_uuid
@ 2023-10-24  7:55 Amir Goldstein
  2023-10-24  9:42 ` Jan Kara
  2023-10-24 11:15 ` Andreas Gruenbacher
  0 siblings, 2 replies; 3+ messages in thread
From: Amir Goldstein @ 2023-10-24  7:55 UTC (permalink / raw)
  To: Andreas Gruenbacher
  Cc: Jan Kara, Christian Brauner, linux-fsdevel, Bob Peterson, gfs2

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>
---

Andreas,

I do not have a test setup for gfs2, but this change it quite trivial,
so I am posting it only compile tested.

There is no need to test fanotify. It enough to test statfs returns
a non-zero f_fsid, e.g.:

  strace -e fstatfs du /mnt/gfs2

Thanks,
Amir.

 fs/gfs2/super.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 02d93da21b2b..ea769af6bb23 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -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;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gfs2: fs: derive f_fsid from s_uuid
  2023-10-24  7:55 [PATCH] gfs2: fs: derive f_fsid from s_uuid Amir Goldstein
@ 2023-10-24  9:42 ` Jan Kara
  2023-10-24 11:15 ` Andreas Gruenbacher
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2023-10-24  9:42 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Andreas Gruenbacher, Jan Kara, Christian Brauner, linux-fsdevel,
	Bob Peterson, gfs2

On Tue 24-10-23 10:55:35, Amir Goldstein wrote:
> 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>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
> 
> Andreas,
> 
> I do not have a test setup for gfs2, but this change it quite trivial,
> so I am posting it only compile tested.
> 
> There is no need to test fanotify. It enough to test statfs returns
> a non-zero f_fsid, e.g.:
> 
>   strace -e fstatfs du /mnt/gfs2
> 
> Thanks,
> Amir.
> 
>  fs/gfs2/super.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> index 02d93da21b2b..ea769af6bb23 100644
> --- a/fs/gfs2/super.c
> +++ b/fs/gfs2/super.c
> @@ -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;
>  }
> -- 
> 2.34.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gfs2: fs: derive f_fsid from s_uuid
  2023-10-24  7:55 [PATCH] gfs2: fs: derive f_fsid from s_uuid Amir Goldstein
  2023-10-24  9:42 ` Jan Kara
@ 2023-10-24 11:15 ` Andreas Gruenbacher
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2023-10-24 11:15 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Jan Kara, Christian Brauner, linux-fsdevel, Bob Peterson, gfs2

Amir,

On Tue, Oct 24, 2023 at 9:56 AM Amir Goldstein <amir73il@gmail.com> wrote:
> gfs2 already has optional persistent uuid.
>
> Use that uuid to report f_fsid in statfs(2), same as ext2/ext4/zonefs.

I've applied this patch, thank you.

Andreas


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-24 11:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-24  7:55 [PATCH] gfs2: fs: derive f_fsid from s_uuid Amir Goldstein
2023-10-24  9:42 ` Jan Kara
2023-10-24 11:15 ` Andreas Gruenbacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).