All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] btrfs: fix early abort in 'remount'
@ 2012-04-18 22:27 Sergei Trofimovich
  2012-04-18 22:28 ` Jeff Mahoney
  2012-04-20 21:27 ` Josef Bacik
  0 siblings, 2 replies; 4+ messages in thread
From: Sergei Trofimovich @ 2012-04-18 22:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Sergei Trofimovich, Jeff Mahoney, Chris Mason

From: Sergei Trofimovich <slyfox@gentoo.org>

Cc: Jeff Mahoney <jeffm@suse.com>
Cc: Chris Mason <chris.mason@oracle.com>
Reviewed-by: Josef Bacik <josef@redhat.com>
Reviewed-by: Sergey V. <sftp.mtuci@gmail.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
v1->v2: fixed indentation of 'if (cond) {' suggested by Liu Bo
v2->v3: added 'Reviewed-by'
 fs/btrfs/super.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 8d5d380..2f28fc0 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -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)
-- 
1.7.8.5


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

* Re: [PATCH v3] btrfs: fix early abort in 'remount'
  2012-04-18 22:27 [PATCH v3] btrfs: fix early abort in 'remount' Sergei Trofimovich
@ 2012-04-18 22:28 ` Jeff Mahoney
  2012-04-20 21:27 ` Josef Bacik
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Mahoney @ 2012-04-18 22:28 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: linux-btrfs, Sergei Trofimovich, Chris Mason

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/18/2012 06:27 PM, Sergei Trofimovich wrote:
> From: Sergei Trofimovich <slyfox@gentoo.org>
> 
> Cc: Jeff Mahoney <jeffm@suse.com> Cc: Chris Mason
> <chris.mason@oracle.com> Reviewed-by: Josef Bacik
> <josef@redhat.com> Reviewed-by: Sergey V. <sftp.mtuci@gmail.com>

Acked-by: Jeff Mahoney <jeffm@suse.com>

> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> --- v1->v2:
> fixed indentation of 'if (cond) {' suggested by Liu Bo v2->v3:
> added 'Reviewed-by' fs/btrfs/super.c |    6 ++++-- 1 files changed,
> 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index
> 8d5d380..2f28fc0 100644 --- a/fs/btrfs/super.c +++
> b/fs/btrfs/super.c @@ -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)


- -- 
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPj0ALAAoJEB57S2MheeWyaAIP/itnoIX+TMcaNDakuduzN1V3
HQWG6z8fwN9Vj+U2KR0u3/zFWe/MJLY20Ec0FQznATYrBcg1as5Y/21kX0uopWVa
RDCmuAVna0rCBuMigG/Kum7cwM4tl3QllFczJF2ZkgrKkildPbfM4s6oscCNiAeo
Pg4yCMIB0z3ZJxYoVJSDxyuxapmhVMFqLgVZ/Idznh+YbLMa8XwQ0gnEkG92ZHeh
28JJKNOU+/UbUkv5OoRvHH596UZbF4WpFX76+1idEU9fSPCMPKlH5ABGSqcywG9K
rWDswD68Gw3JWX/XJCvHcN5h70zdYbZ16mUzUfKG4a4y5WuHIEe0PVC4z3fMIsyw
1hsJJro/x7lvgOYxZ+RBLXF1ghnzmYlYZRARh67jZwGffWeXgW2ubJrApy1/+qm8
Ohe/MOq4qFDBt8JXHaAU8rgffBNABvsqqg/riNsxwx7bVEBY6Mre40zUiKWL78vF
zsY8lsIFF+TCo3rKdlA7gpxWH4eubd/NmNIOYQUlWhEVmCAlITih/8IJ+gDDDjCb
oWygf25ARKqhfOYu5Fa37jaWL4Uov7FProXGNXSZmfebNmteJFtg1GstWnfpa/Z4
65ucrMAyDHxEmdqHtKocYYamA9wmm9vVk7L86gsq0RSNtrK3RX9kH8F9FYsBHrLF
G1xlB7mdweo4eG8c+DYN
=CjpG
-----END PGP SIGNATURE-----

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

* Re: [PATCH v3] btrfs: fix early abort in 'remount'
  2012-04-18 22:27 [PATCH v3] btrfs: fix early abort in 'remount' Sergei Trofimovich
  2012-04-18 22:28 ` Jeff Mahoney
@ 2012-04-20 21:27 ` Josef Bacik
  2012-04-21  8:27   ` [PATCH v4] " Sergei Trofimovich
  1 sibling, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2012-04-20 21:27 UTC (permalink / raw)
  To: Sergei Trofimovich
  Cc: linux-btrfs, Sergei Trofimovich, Jeff Mahoney, Chris Mason

On Thu, Apr 19, 2012 at 01:27:38AM +0300, Sergei Trofimovich wrote:
> From: Sergei Trofimovich <slyfox@gentoo.org>
> 
> Cc: Jeff Mahoney <jeffm@suse.com>
> Cc: Chris Mason <chris.mason@oracle.com>
> Reviewed-by: Josef Bacik <josef@redhat.com>
> Reviewed-by: Sergey V. <sftp.mtuci@gmail.com>
> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> ---
> v1->v2: fixed indentation of 'if (cond) {' suggested by Liu Bo
> v2->v3: added 'Reviewed-by'
>  fs/btrfs/super.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 8d5d380..2f28fc0 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -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)
> -- 
> 1.7.8.5
> 

I just noticed this doesn't have a changelog when I was putting it into
btrfs-next, can you resend with a proper changelog so I can update the one in
btrfs-next?  Thanks,

Josef

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

* [PATCH v4] btrfs: fix early abort in 'remount'
  2012-04-20 21:27 ` Josef Bacik
@ 2012-04-21  8:27   ` Sergei Trofimovich
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Trofimovich @ 2012-04-21  8:27 UTC (permalink / raw)
  To: linux-btrfs, Josef Bacik; +Cc: Sergei Trofimovich, Chris Mason

From: Sergei Trofimovich <slyfox@gentoo.org>

[ Typical case of btrfs rootfs without initramfs: ]

When trying to remount 'ro' -> 'rw' filesystem
we get early abort from 'btrfs_remount()' due to
first unconditional 'goto':

> if (fs_info->fs_devices->rw_devices == 0)
>     ret = -EACCES;
>     goto restore; /* misindented */

Thus nothing like 'btrfs_super_log_root()' or
'btrfs_cleanup_fs_roots()' gets called and all
new options passed to remount are reverted and
'mount -o remount' does not return an error.

The regression is introduced by commit 49b25e05409.

Remounting 'rw' -> 'rw' is fine.

Cc: Chris Mason <chris.mason@oracle.com>
Acked-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: Josef Bacik <josef@redhat.com>
Reviewed-by: Sergey V. <sftp.mtuci@gmail.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
v1->v2: fixed indentation of 'if (cond) {' suggested by Liu Bo
v2->v3: added 'Reviewed-by'
v3->v4: added Jeff's 'Acked-by'; enhanced changelog
 fs/btrfs/super.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 8d5d380..2f28fc0 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -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)
-- 
1.7.8.5


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

end of thread, other threads:[~2012-04-21  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-18 22:27 [PATCH v3] btrfs: fix early abort in 'remount' Sergei Trofimovich
2012-04-18 22:28 ` Jeff Mahoney
2012-04-20 21:27 ` Josef Bacik
2012-04-21  8:27   ` [PATCH v4] " Sergei Trofimovich

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.