Skip to contentSkip to conversation

Btrfs: fix missing write access release in btrfs_ioctl_resize()

PATCH Superseded Miao Xie 2 participants 4 messages Dec 21, 2012 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH 1/3 Btrfs: fix missing write access release in btrfs_ioctl_resize()

We forget to give up the write access after we find some device operation is going on. Fix it.

---
 fs/btrfs/ioctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/ioctl.c +3 -1
index 7624212..679b82c 100644
@@ -1338,7 +1338,9 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 
 	if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
 			1)) {
-		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
+		pr_info("btrfs: dev add/delete/balance/replace/resize operation"
+			" in progress\n");
+		mnt_drop_write_file(file);
 		return -EINPROGRESS;
 	}
 
Signature · 1 line
1.7.11.7
#1 lore raw

fs/btrfs/ioctl.c static noinline int btrfs_ioctl_resize(struct file *file, · line 1343

Quoted 4 lines · Miao Xie
fs/btrfs/ioctl.c +3 -1
-		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
+		pr_info("btrfs: dev add/delete/balance/replace/resize operation"
+			" in progress\n");
+		mnt_drop_write_file(file);

grep and vi cannot do searches spanning multiple lines. That's why I created this pr_info() line with more than 80 columns (in accordance with Documentation/CodingStyle BTW ("never break user-visible strings")).

author
#2 lore raw
Quoted 10 lines · Stefan Behrens

fs/btrfs/ioctl.c static noinline int btrfs_ioctl_resize(struct file *file, · line 1343

Quoted 4 lines · Miao Xie
fs/btrfs/ioctl.c +3 -1
-		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
+		pr_info("btrfs: dev add/delete/balance/replace/resize operation"
+			" in progress\n");
+		mnt_drop_write_file(file);

grep and vi cannot do searches spanning multiple lines. That's why I created this pr_info() line with more than 80 columns (in accordance with Documentation/CodingStyle BTW ("never break user-visible strings")).

You are right. I will update the patch soon.

Thanks
Miao

author
#3 lore raw

PATCH v2 1/3 Btrfs: fix missing write access release in btrfs_ioctl_resize()

In reply to Miao Xie

We forget to give up the write access after we find some device operation is going on. Fix it.

---
Changelog v1 -> v2:
- don't break the string

---
 fs/btrfs/ioctl.c | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/ioctl.c +1 -0
index 7624212..d6f43fa 100644
@@ -1339,6 +1339,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
 	if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
 			1)) {
 		pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
+		mnt_drop_write_file(file);
 		return -EINPROGRESS;
 	}
 
Signature · 1 line
1.7.11.7