From: Sergei Trofimovich <slyich@gmail.com>
To: linux-btrfs@vger.kernel.org, Josef Bacik <josef@redhat.com>
Cc: Sergei Trofimovich <slyfox@gentoo.org>,
Chris Mason <chris.mason@oracle.com>
Subject: [PATCH v4] btrfs: fix early abort in 'remount'
Date: Sat, 21 Apr 2012 11:27:38 +0300 [thread overview]
Message-ID: <1334996858-11188-1-git-send-email-slyich@gmail.com> (raw)
In-Reply-To: <20120420212750.GF1957@localhost.localdomain>
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
prev parent reply other threads:[~2012-04-21 8:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Sergei Trofimovich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334996858-11188-1-git-send-email-slyich@gmail.com \
--to=slyich@gmail.com \
--cc=chris.mason@oracle.com \
--cc=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=slyfox@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).