On Thu, Apr 05, 2018 at 05:41:57PM +0800, Anand Jain wrote:
> 
> > @@ -2716,6 +2718,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, 
> > void __user *arg)
> >             ret = BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS;
> >             goto out_drop_write;
> >     }
> > +   mutex_lock(&fs_info->volume_mutex);
> >   
> >     vol_args = memdup_user(arg, sizeof(*vol_args));
> >     if (IS_ERR(vol_args)) { > @@ -2730,6 +2733,7 @@ static long 
> > btrfs_ioctl_rm_dev(struct file 
> *file, void __user *arg)
> >             btrfs_info(fs_info, "disk deleted %s", vol_args->name);
> >     kfree(vol_args);
> >   out:
> > +   mutex_unlock(&fs_info->volume_mutex);
> >     clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags);
> >   out_drop_write:
> >     mnt_drop_write_file(file);
> 
>   Why not memdup_user() be outside of volume_mutex?

The point of the patch is to put the mutex_lock right next to the
exclusive operation bit setting. It's not optimal regarding the size of
critical section and normally the memdup should be outside.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to