From: Amir Goldstein <amir73il@gmail.com>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Jan Kara <jack@suse.cz>, Christian Brauner <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org, Bob Peterson <rpeterso@redhat.com>,
gfs2@lists.linux.dev
Subject: [PATCH] gfs2: fs: derive f_fsid from s_uuid
Date: Tue, 24 Oct 2023 10:55:35 +0300 [thread overview]
Message-ID: <20231024075535.2994553-1-amir73il@gmail.com> (raw)
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
next reply other threads:[~2023-10-24 7:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 7:55 Amir Goldstein [this message]
2023-10-24 9:42 ` [PATCH] gfs2: fs: derive f_fsid from s_uuid Jan Kara
2023-10-24 11:15 ` Andreas Gruenbacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231024075535.2994553-1-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=agruenba@redhat.com \
--cc=brauner@kernel.org \
--cc=gfs2@lists.linux.dev \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).