Re: [PATCH 9/9] btrfs: Use sb_want_write() to protect sysfs feature change.

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

 



On Thu, Feb 12, 2015 at 09:44:33AM +0800, Qu Wenruo wrote:
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -118,13 +118,19 @@ static ssize_t btrfs_feature_attr_store(struct kobject *kobj,
>  	int ret;
>  
>  	fs_info = to_fs_info(kobj);
> -	if (!fs_info)
> -		return -EPERM;
> +	if (!fs_info) {
> +		ret = -EPERM;
> +		goto out;

This would do a call to sb_drop_write() without a pairing
sb_want_write(), immediate 'return' was correct.

[...]
> +	}
>  
> -	ret = kstrtoul(skip_spaces(buf), 0, &val);
> +	ret = sb_want_write(fs_info->sb);
>  	if (ret)
>  		return ret;
[...]
>  
> +out:
> +	sb_drop_write(fs_info->sb);
> +	if (!ret)
> +		return count;
> +	return ret;
--
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




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux