From: Theodore Ts'o <tytso@mit.edu>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] ext4/jbd2: Fix jbd2_journal_destory() for umount path
Date: Wed, 9 Mar 2016 23:59:47 -0500 [thread overview]
Message-ID: <20160310045947.GD4937@thunk.org> (raw)
In-Reply-To: <87fuwh58ro.fsf@mail.parknet.co.jp>
On Thu, Feb 25, 2016 at 08:28:27PM +0900, OGAWA Hirofumi wrote:
> On umount path, jbd2_journal_destroy() writes latest transaction ID
> (->j_tail_sequence) to be used at next mount.
>
> The bug is that ->j_tail_sequence is not holding latest transaction ID
> in some cases. So, at next mount, there is chance to conflict with
> remaining (not overwritten yet) transactions.
>
> mount (id=10)
> write transaction (id=11)
> write transaction (id=12)
> umount (id=10) <= the bug doesn't write latest ID
>
> mount (id=10)
> write transaction (id=11)
> crash
>
> recovery
> transaction (id=11)
> transaction (id=12) <= valid transaction ID, but old commit
> must not replay
>
> Like above, this bug become the cause of recovery failure, or FS
> corruption.
>
> So why ->j_tail_sequence doesn't point latest ID?
>
> Because if checkpoint transactions was reclaimed by memory pressure
> (i.e. bdev_try_to_free_page()), then ->j_tail_sequence is not updated.
> (And another case is, __jbd2_journal_clean_checkpoint_list() is called
> with empty transaction.)
>
> So in above cases, ->j_tail_sequence is not pointing latest
> transaction ID at umount path. Plus, REQ_FLUSH for checkpoint is not
> done too.
>
> So, to fix this problem with minimum changes, this patch updates
> ->j_tail_sequence, and issue REQ_FLUSH. (With more complex changes,
> some optimizations would be possible to avoid unnecessary REQ_FLUSH
> for example though.)
>
> BTW,
>
> journal->j_tail_sequence =
> ++journal->j_transaction_sequence;
>
> Increment of ->j_transaction_sequence seems to be unnecessary, but
> ext3 does this.
>
> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Thanks, applied.
- Ted
prev parent reply other threads:[~2016-03-10 4:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 11:28 [PATCH] ext4/jbd2: Fix jbd2_journal_destory() for umount path OGAWA Hirofumi
2016-02-25 13:11 ` kbuild test robot
2016-03-10 4:59 ` Theodore Ts'o [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=20160310045947.GD4937@thunk.org \
--to=tytso@mit.edu \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@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).