Skip to contentSkip to conversation

btrfs: fix early abort in 'remount'

PATCH Superseded Sergei Trofimovich 4 participants 5 messages Apr 15, 2012 – Apr 16, 2012 Btrfs file system

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: fix early abort in 'remount'

From: Sergei Trofimovich <[email protected]>

Cc Jeff Mahoney <[email protected]>
Cc Chris Mason <[email protected]>
Cc Josef Bacik <[email protected]>
---
 fs/btrfs/super.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/btrfs/super.c +4 -0
index 8d5d380..0b296f2 100644
@@ -1149,12 +1149,16 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 			goto restore;
 	} else {
 		if (fs_info->fs_devices->rw_devices == 0)
+		{
 			ret = -EACCES;
 			goto restore;
+		}
 
 		if (btrfs_super_log_root(fs_info->super_copy) != 0)
+		{
 			ret = -EINVAL;
 			goto restore;
+		}
 
 		ret = btrfs_cleanup_fs_roots(fs_info);
 		if (ret)
Signature · 1 line
1.7.8.5
#1 lore raw
Quoted 21 lines · Sergei Trofimovich

From: Sergei Trofimovich <[email protected]>

Cc Jeff Mahoney <[email protected]>
Cc Chris Mason <[email protected]>
Cc Josef Bacik <[email protected]>
---
 fs/btrfs/super.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/btrfs/super.c +1 -0
index 8d5d380..0b296f2 100644
@@ -1149,12 +1149,16 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 			goto restore;
 	} else {
 		if (fs_info->fs_devices->rw_devices == 0)
+		{
 			ret = -EACCES;
 			goto restore;

fs/btrfs/super.c static int btrfs_remount(struct super_block *sb, int *flags, char *data) · line 1164

Quoted 10 lines
fs/btrfs/super.c +3 -0
+		}
 
 		if (btrfs_super_log_root(fs_info->super_copy) != 0)
+		{
 			ret = -EINVAL;
 			goto restore;
+		}
 
 		ret = btrfs_cleanup_fs_roots(fs_info);
 		if (ret)

I prefer to

if (xxx) {
	yyy;
}

thanks,
liubo

#2 lore raw

PATCH v2 1/1 btrfs: fix early abort in 'remount'

From: Sergei Trofimovich <[email protected]>

Cc Jeff Mahoney <[email protected]>
Cc Chris Mason <[email protected]>
Cc Josef Bacik <[email protected]>
---
 fs/btrfs/super.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/super.c +4 -2
index 8d5d380..2f28fc0 100644
@@ -1148,13 +1148,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 		if (ret)
 			goto restore;
 	} else {
-		if (fs_info->fs_devices->rw_devices == 0)
+		if (fs_info->fs_devices->rw_devices == 0) {
 			ret = -EACCES;
 			goto restore;
+		}
 
-		if (btrfs_super_log_root(fs_info->super_copy) != 0)
+		if (btrfs_super_log_root(fs_info->super_copy) != 0) {
 			ret = -EINVAL;
 			goto restore;
+		}
 
 		ret = btrfs_cleanup_fs_roots(fs_info);
 		if (ret)
Signature · 1 line
1.7.8.5
Reviewed-by on v2 1/1
#3 lore raw
Quoted 23 lines · On Monday 16 of April 2012 07:44:37 Sergei Trofimovich wrote:

From: Sergei Trofimovich <[email protected]>

Cc Jeff Mahoney <[email protected]>
Cc Chris Mason <[email protected]>
Cc Josef Bacik <[email protected]>
---
 fs/btrfs/super.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/super.c +1 -1
index 8d5d380..2f28fc0 100644
@@ -1148,13 +1148,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 		if (ret)
 			goto restore;
 	} else {
-		if (fs_info->fs_devices->rw_devices == 0)
+		if (fs_info->fs_devices->rw_devices == 0) {
 			ret = -EACCES;
 			goto restore;

fs/btrfs/super.c static int btrfs_remount(struct super_block *sb, int *flags, char *data) · line 1162

Quoted 10 lines
fs/btrfs/super.c +3 -1
+		}
 
-		if (btrfs_super_log_root(fs_info->super_copy) != 0)
+		if (btrfs_super_log_root(fs_info->super_copy) != 0) {
 			ret = -EINVAL;
 			goto restore;
+		}
 
 		ret = btrfs_cleanup_fs_roots(fs_info);
 		if (ret)

Patch is correct

Thanks.

Reviewed-by on v2 1/1
#4 lore raw
In reply to Sergei Trofimovich
Quoted 35 lines · Sergei Trofimovich

From: Sergei Trofimovich <[email protected]>

Cc Jeff Mahoney <[email protected]>
Cc Chris Mason <[email protected]>
Cc Josef Bacik <[email protected]>
---
 fs/btrfs/super.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/super.c +4 -2
index 8d5d380..2f28fc0 100644
@@ -1148,13 +1148,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 		if (ret)
 			goto restore;
 	} else {
-		if (fs_info->fs_devices->rw_devices == 0)
+		if (fs_info->fs_devices->rw_devices == 0) {
 			ret = -EACCES;
 			goto restore;
+		}
 
-		if (btrfs_super_log_root(fs_info->super_copy) != 0)
+		if (btrfs_super_log_root(fs_info->super_copy) != 0) {
 			ret = -EINVAL;
 			goto restore;
+		}
 
 		ret = btrfs_cleanup_fs_roots(fs_info);
 		if (ret)
Signature · 1 line
1.7.8.5

Haha oops,

Thanks,

Josef