Re: [PATCH v3 5/6] btrfs: implement shutdown ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux