From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>, stable@vger.kernel.org
Subject: [PATCH 3/7] ext4: preserve the needs_recovery flag when the journal is aborted
Date: Sun, 5 Feb 2017 02:34:26 -0500 [thread overview]
Message-ID: <20170205073430.9109-3-tytso@mit.edu> (raw)
In-Reply-To: <20170205073430.9109-1-tytso@mit.edu>
If the journal is aborted, the needs_recovery feature flag should not
be removed. Otherwise, it's the journal might not get replayed and
this could lead to more data getting lost.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
---
fs/ext4/super.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 829e4a7b59e4..3fef82e79131 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -825,6 +825,7 @@ static void ext4_put_super(struct super_block *sb)
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_super_block *es = sbi->s_es;
+ int aborted = 0;
int i, err;
ext4_unregister_li_request(sb);
@@ -834,9 +835,10 @@ static void ext4_put_super(struct super_block *sb)
destroy_workqueue(sbi->rsv_conversion_wq);
if (sbi->s_journal) {
+ aborted = is_journal_aborted(sbi->s_journal);
err = jbd2_journal_destroy(sbi->s_journal);
sbi->s_journal = NULL;
- if (err < 0)
+ if ((err < 0) && !aborted)
ext4_abort(sb, "Couldn't clean up the journal");
}
@@ -847,7 +849,7 @@ static void ext4_put_super(struct super_block *sb)
ext4_mb_release(sb);
ext4_ext_release(sb);
- if (!(sb->s_flags & MS_RDONLY)) {
+ if (!(sb->s_flags & MS_RDONLY) && !aborted) {
ext4_clear_feature_journal_needs_recovery(sb);
es->s_state = cpu_to_le16(sbi->s_mount_state);
}
--
2.11.0.rc0.7.gbe5a750
next prev parent reply other threads:[~2017-02-05 7:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-05 7:34 [PATCH 1/7] ext4: fix inline data error paths Theodore Ts'o
2017-02-05 7:34 ` [PATCH 2/7] jbd2: don't leak modified metadata buffers on an aborted journal Theodore Ts'o
2017-02-05 7:34 ` Theodore Ts'o [this message]
2017-02-05 7:34 ` [PATCH 4/7] ext4: return EROFS if device is r/o and journal replay is needed Theodore Ts'o
2017-02-05 7:34 ` [PATCH 5/7] ext4: rename s_resize_flags to s_ext4_flags Theodore Ts'o
2017-02-05 7:34 ` [PATCH 6/7] ext4: add shutdown bit and check for it Theodore Ts'o
2017-02-06 19:51 ` Andreas Dilger
2017-02-07 19:52 ` Theodore Ts'o
2017-02-05 7:34 ` [PATCH 7/7] ext4: add EXT4_IOC_GOINGDOWN ioctl Theodore Ts'o
2017-02-05 13:03 ` kbuild test robot
2017-02-06 0:50 ` Theodore Ts'o
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=20170205073430.9109-3-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
--cc=stable@vger.kernel.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).