From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
WenRuo Qu <wqu@suse.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Cc: "viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
"brauner@kernel.org" <brauner@kernel.org>,
"jack@suse.cz" <jack@suse.cz>
Subject: Re: [PATCH v3 5/6] btrfs: implement shutdown ioctl
Date: Fri, 4 Jul 2025 16:31:03 +0930 [thread overview]
Message-ID: <12d8534d-1c91-4f48-97f9-468117ca9524@gmx.com> (raw)
In-Reply-To: <eba400eb-645e-4aee-9074-5f561b1baead@wdc.com>
在 2025/7/4 15:55, Johannes Thumshirn 写道:
> On 04.07.25 01:43, Qu Wenruo wrote:
>> long btrfs_ioctl(struct file *file, unsigned int
>> cmd, unsigned long arg)
>> {
>> @@ -5201,6 +5231,8 @@ long btrfs_ioctl(struct file *file, unsigned int
>> struct btrfs_fs_info *fs_info = inode_to_fs_info(inode);
>> struct btrfs_root *root = BTRFS_I(inode)->root;
>> void __user *argp = (void __user *)arg;
>> + /* If @arg is just an unsigned long value. */
>> + unsigned long flags;
>>
>> switch (cmd) {
>> case FS_IOC_GETVERSION:
>> @@ -5349,6 +5381,14 @@ long btrfs_ioctl(struct file *file, unsigned int
>> #endif
>> case BTRFS_IOC_SUBVOL_SYNC_WAIT:
>> return btrfs_ioctl_subvol_sync(fs_info, argp);
>> +#ifdef CONFIG_BTRFS_EXPERIMENTAL
>> + case BTRFS_IOC_SHUTDOWN:
>> + if (!capable(CAP_SYS_ADMIN))
>> + return -EPERM;
>> + if (get_user(flags, (__u32 __user *)arg))
>> + return -EFAULT;
>> + return btrfs_emergency_shutdown(fs_info, flags);
>> +#endif
>
> With that you'll get buildbot complaints if CONFIG_BTRFS_EXPERIMENTAL=n
> because flags is unused.
>
> I'd probably put the get_user(flags, ...) into
> btrfs_emergency_shutdown() to silence the compiler.
That sounds a lot better than all my alternatives (a dedicated {} block
to put @flags into, get_user() at the beginning of btrfs_ioctl())
Will go your path when merging the patches.
Thanks,
Qu
next prev parent reply other threads:[~2025-07-04 7:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 23:42 [PATCH v3 0/6] btrfs: add remove_bdev() callback Qu Wenruo
2025-07-03 23:42 ` [PATCH v3 1/6] fs: enhance and rename shutdown() callback to remove_bdev() Qu Wenruo
2025-07-04 9:01 ` Jan Kara
2025-07-03 23:42 ` [PATCH v3 2/6] btrfs: introduce a new fs state, EMERGENCY_SHUTDOWN Qu Wenruo
2025-07-03 23:42 ` [PATCH v3 3/6] btrfs: reject file operations if in shutdown state Qu Wenruo
2025-07-03 23:42 ` [PATCH v3 4/6] btrfs: reject delalloc ranges " Qu Wenruo
2025-07-03 23:42 ` [PATCH v3 5/6] btrfs: implement shutdown ioctl Qu Wenruo
2025-07-04 6:25 ` Johannes Thumshirn
2025-07-04 7:01 ` Qu Wenruo [this message]
2025-07-03 23:42 ` [PATCH v3 6/6] btrfs: implement remove_bdev super operation callback Qu Wenruo
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=12d8534d-1c91-4f48-97f9-468117ca9524@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wqu@suse.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