From: NeilBrown <neilb-IBi9RG/b67k@public.gmane.org>
To: tytso-3s7WtUTddSA@public.gmane.org
Cc: linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
lustre <lustre-devel-aLEFhgZF4x6X6Mz3xDxJMA@public.gmane.org>
Subject: [e2fsprogs PATCH] tune2fs: don't recover journal if device is busy.
Date: Mon, 12 Feb 2018 12:20:43 +1100 [thread overview]
Message-ID: <871shrrok4.fsf@notabene.neil.brown.name> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1754 bytes --]
tune2fs currently replays the journal if it needs
recovery and the filesystem isn't mounted.
The test for "is the filesystem mounted" isn't completely robust.
Lustre makes use of ext4 filesystems in a way that they are mounted
without being visible in /proc/mounts or similar.
This usage can easily be detected by attempting to open the device
with O_EXCL. tune2fs already does this and the EXT2_MF_BUSY flag
is set if open(O_EXCL) fails.
Several uses other than lustre mounts could cause O_EXCL to fail,
but in any case it seems unwise to recover the journal when something
else is keeping the device busy.
So add an extra test to avoid journal recovery when the device
is busy. This fixes some problems with lustre usage.
Signed-off-by: NeilBrown <neilb-IBi9RG/b67k@public.gmane.org>
--
Note: it seems wrong to recover the journal *after* making
changes to the superblock - there is a good chance that
recovering the journal will over-write those changes.
This is what was happening that lead me to this problem.
Shouldn't journal recovery happen *first*??
Thanks,
NeilBrown
---
misc/tune2fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index c33fb9d80b10..703e55b6b972 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3337,7 +3337,7 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
}
#else
/* Recover the journal if possible. */
- if ((open_flag & EXT2_FLAG_RW) && !(mount_flags & EXT2_MF_MOUNTED) &&
+ if ((open_flag & EXT2_FLAG_RW) && !(mount_flags & (EXT2_MF_BUSY | EXT2_MF_MOUNTED)) &&
ext2fs_has_feature_journal_needs_recovery(fs->super)) {
errcode_t err;
--
2.14.0.rc0.dirty
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 188 bytes --]
_______________________________________________
lustre-devel mailing list
lustre-devel-aLEFhgZF4x6X6Mz3xDxJMA@public.gmane.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
next reply other threads:[~2018-02-12 1:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 1:20 NeilBrown [this message]
2018-02-12 2:16 ` [e2fsprogs PATCH] tune2fs: don't recover journal if device is busy Darrick J. Wong
[not found] ` <20180224222352.GC14111@thunk.org>
[not found] ` <20180224222352.GC14111-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2018-02-26 18:08 ` Darrick J. Wong
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=871shrrok4.fsf@notabene.neil.brown.name \
--to=neilb-ibi9rg/b67k@public.gmane.org \
--cc=linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lustre-devel-aLEFhgZF4x6X6Mz3xDxJMA@public.gmane.org \
--cc=tytso-3s7WtUTddSA@public.gmane.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).