On Tue, Apr 16, 2013 at 10:45:19AM +0200, Jan Schmidt wrote:
> +static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
> +{
> + struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
> + struct btrfs_ioctl_quota_rescan_args *qsa;
> + int ret = 0;
> +
> + if (!capable(CAP_SYS_ADMIN))
> + return -EPERM;
> +
> + qsa = kzalloc(sizeof(*qsa), GFP_NOFS);
The reserved field increased the size of qsa to 64 bytes, thinking about
it again, an early ENOMEM is a good indicator that the system is unable
to get memory so starting a bigger operation does not make much sense
anyway. Keep it as it is.
> + if (!qsa)
> + return -ENOMEM;
> +
> + if (root->fs_info->qgroup_flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN) {
> + qsa->flags = 1;
> + qsa->progress = root->fs_info->qgroup_rescan_progress.objectid;
> + }
> +
> + if (copy_to_user(arg, qsa, sizeof(*qsa)))
> + ret = -EFAULT;
> +
> + kfree(qsa);
> + return ret;
> +}
> +
> --- a/include/uapi/linux/btrfs.h
> +++ b/include/uapi/linux/btrfs.h
> @@ -376,12 +376,18 @@ struct btrfs_ioctl_get_dev_stats {
>
> #define BTRFS_QUOTA_CTL_ENABLE 1
> #define BTRFS_QUOTA_CTL_DISABLE 2
> -#define BTRFS_QUOTA_CTL_RESCAN 3
> +#define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
Looks ok.
david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html