Re: [PATCH] Btrfs: fix return value of setflags ioctl
From: David Sterba <hidden>
Date: 2011-02-24 10:33:35
On Thu, Feb 24, 2011 at 05:38:16PM +0800, liubo wrote:
quoted hunk ↗ jump to hunk
setflags ioctl should return error when any checks fail. Signed-off-by: Liu Bo <redacted> --- 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 <redacted>
} static int btrfs_ioctl_getversion(struct file *file, int __user *arg) --