Skip to contentSkip to conversation

Btrfs: fix return value of setflags ioctl

PATCH In review liubo 2 participants 2 messages Feb 24, 2011 Btrfs file system

lore
Share & tools
lore

liubo

author
#0 lore raw

PATCH 1/1 Btrfs: fix return value of setflags ioctl

setflags ioctl should return error when any checks fail.

---
 fs/btrfs/ioctl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/btrfs/ioctl.c +3 -1
index 02d224e..e397da4 100644
@@ -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)
Signature · 1 line
1.6.5.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · liubo

setflags ioctl should return error when any checks fail.

---
 fs/btrfs/ioctl.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/btrfs/ioctl.c +0 -0
index 02d224e..e397da4 100644

fs/btrfs/ioctl.c static int btrfs_ioctl_setflags(struct file *file, void __user *arg) · line 217

Quoted 5 lines
fs/btrfs/ioctl.c +2 -0
@@ -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.

fs/btrfs/ioctl.c static int btrfs_ioctl_setflags(struct file *file, void __user *arg) · line 220

Quoted 4 lines
fs/btrfs/ioctl.c +1 -1
  out_unlock:
 	mutex_unlock(&inode->i_mutex);
-	return 0;
+	return ret;

Good cacth.

Quoted 4 lines
fs/btrfs/ioctl.c +0 -0
 }
 
 static int btrfs_ioctl_getversion(struct file *file, int __user *arg)