From: Tavian Barnes <tavianator@tavianator.com>
To: lihongbo22@huawei.com
Cc: brauner@kernel.org, gnoack@google.com, jack@suse.cz,
linux-fsdevel@vger.kernel.org,
linux-security-module@vger.kernel.org, mic@digikod.net,
viro@zeniv.linux.org.uk
Subject: Re: [RFC PATCH] fs: obtain the inode generation number from vfs directly
Date: Wed, 28 Aug 2024 12:36:37 -0400 [thread overview]
Message-ID: <20240828163637.637445-1-tavianator@tavianator.com> (raw)
In-Reply-To: <20240827014108.222719-1-lihongbo22@huawei.com>
On Tue, 27 Aug 2024 01:41:08 +0000, Hongbo Li wrote:
> Many mainstream file systems already support the GETVERSION ioctl,
> and their implementations are completely the same, essentially
> just obtain the value of i_generation. We think this ioctl can be
> implemented at the VFS layer, so the file systems do not need to
> implement it individually.
>
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> ---
> fs/ioctl.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/ioctl.c b/fs/ioctl.c
> index 64776891120c..dff887ec52c4 100644
> --- a/fs/ioctl.c
> +++ b/fs/ioctl.c
> @@ -878,6 +878,9 @@ static int do_vfs_ioctl(struct file *filp, unsigned int fd,
> case FS_IOC_GETFSUUID:
> return ioctl_getfsuuid(filp, argp);
>
> + case FS_IOC_GETVERSION:
> + return put_user(inode->i_generation, (int __user *)argp);
> +
> case FS_IOC_GETFSSYSFSPATH:
> return ioctl_get_fs_sysfs_path(filp, argp);
>
> @@ -992,6 +995,9 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd,
> cmd = (cmd == FS_IOC32_GETFLAGS) ?
> FS_IOC_GETFLAGS : FS_IOC_SETFLAGS;
> fallthrough;
The above case falls through...
> + case FS_IOC32_GETVERSION:
> + cmd = FS_IOC_GETVERSION;
... to this new case, which clobbers cmd, breaking FS_IOC32_[GS]ETFLAGS.
> + fallthrough;
> /*
> * everything else in do_vfs_ioctl() takes either a compatible
> * pointer argument or no argument -- call it with a modified
prev parent reply other threads:[~2024-08-28 16:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 1:41 [RFC PATCH] fs: obtain the inode generation number from vfs directly Hongbo Li
2024-08-27 2:13 ` Darrick J. Wong
2024-08-27 2:32 ` Hongbo Li
2024-08-27 5:37 ` Darrick J. Wong
2024-08-27 9:22 ` Christian Brauner
2024-08-27 17:11 ` Darrick J. Wong
2024-08-28 2:16 ` Hongbo Li
2024-08-28 3:44 ` Theodore Ts'o
2024-08-28 5:38 ` Dave Chinner
2024-08-28 15:55 ` Jan Kara
2024-08-29 1:46 ` Darrick J. Wong
2024-08-29 13:34 ` Dave Chinner
2024-08-27 2:53 ` Matthew Wilcox
2024-08-27 3:07 ` Hongbo Li
2024-08-28 4:27 ` Dave Chinner
2024-08-28 16:36 ` Tavian Barnes [this message]
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=20240828163637.637445-1-tavianator@tavianator.com \
--to=tavianator@tavianator.com \
--cc=brauner@kernel.org \
--cc=gnoack@google.com \
--cc=jack@suse.cz \
--cc=lihongbo22@huawei.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=viro@zeniv.linux.org.uk \
/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