All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix return value of setflags ioctl
@ 2011-02-24  9:38 liubo
  2011-02-24 10:33 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: liubo @ 2011-02-24  9:38 UTC (permalink / raw)
  To: Linux Btrfs


setflags ioctl should return error when any checks fail.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
---
 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;
  out_unlock:
 	mutex_unlock(&inode->i_mutex);
-	return 0;
+	return ret;
 }
 
 static int btrfs_ioctl_getversion(struct file *file, int __user *arg)
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Btrfs: fix return value of setflags ioctl
  2011-02-24  9:38 [PATCH] Btrfs: fix return value of setflags ioctl liubo
@ 2011-02-24 10:33 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2011-02-24 10:33 UTC (permalink / raw)
  To: Linux Btrfs

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@cn.fujitsu.com>
> ---
>  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@suse.cz>

>  }
>  
>  static int btrfs_ioctl_getversion(struct file *file, int __user *arg)
> -- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-24 10:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-24  9:38 [PATCH] Btrfs: fix return value of setflags ioctl liubo
2011-02-24 10:33 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.