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 2/7] jbd2: don't leak modified metadata buffers on an aborted journal
Date: Sun, 5 Feb 2017 02:34:25 -0500 [thread overview]
Message-ID: <20170205073430.9109-2-tytso@mit.edu> (raw)
In-Reply-To: <20170205073430.9109-1-tytso@mit.edu>
If the journal has been aborted, we shouldn't mark the underlying
buffer head as dirty, since that will cause the metadata block to get
modified. And if the journal has been aborted, we shouldn't allow
this since it will almost certainly lead to a corrupted file system.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
---
fs/jbd2/transaction.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index e1652665bd93..5e659ee08d6a 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -1863,7 +1863,9 @@ static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh)
__blist_del_buffer(list, jh);
jh->b_jlist = BJ_None;
- if (test_clear_buffer_jbddirty(bh))
+ if (transaction && is_journal_aborted(transaction->t_journal))
+ clear_buffer_jbddirty(bh);
+ else if (test_clear_buffer_jbddirty(bh))
mark_buffer_dirty(bh); /* Expose it to the VM */
}
--
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 ` Theodore Ts'o [this message]
2017-02-05 7:34 ` [PATCH 3/7] ext4: preserve the needs_recovery flag when the journal is aborted Theodore Ts'o
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-2-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).