Re: [PATCH] Btrfs: fix return value of setflags ioctl

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

 



On Thu, Feb 24, 2011 at 05:38:16PM +0800, liubo wrote:
> 
> setflags ioctl should return error when any checks fail.
> 
> Signed-off-by: Liu Bo <liubo2009@xxxxxxxxxxxxxx>
> ---
>  fs/btrfs/ioctl.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 02d224e..e397da4 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -213,9 +213,11 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
>  	btrfs_end_transaction(trans, root);
>  
>  	mnt_drop_write(file->f_path.mnt);
> +
> +	ret = 0;

Technically speaking, this assignment is not necessary as any non-zero
value is caught above as a BUG_ON, but assigning it to zero definetely
helps readability.

>   out_unlock:
>  	mutex_unlock(&inode->i_mutex);
> -	return 0;
> +	return ret;

Good cacth.

Reviewed-by: David Sterba <dsterba@xxxxxxx>

>  }
>  
>  static int btrfs_ioctl_getversion(struct file *file, int __user *arg)
> -- 
--
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