From: Jan Kara <jack@suse.cz>
To: Martin_Zielinski@McAfee.com
Cc: jack@suse.cz, tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/2] jbd: fix fsync() tid wraparound bug
Date: Thu, 5 May 2011 17:53:29 +0200 [thread overview]
Message-ID: <20110505155329.GL5323@quack.suse.cz> (raw)
In-Reply-To: <BCB84D936723884B91E4CC5CA0A7C54AA4F95AA264@EMEADALEXMB1.corp.nai.org>
On Thu 05-05-11 09:11:22, Martin_Zielinski@McAfee.com wrote:
> It is not a hardware bug and very unlikely a race condition or random
> memory corruption. We have 7 machines that failed with an uptime of
> 12-13 days. 12 days earlier about 5 different machines failed after the
> same uptime. All machines were rebooted after this issue.
>
> In 5 out of 7 cores the commit request number come from the same sqlite
> database. In 2 cores I could not find an inode or file structure
> pointing to this database and hence it could not be verified that the
> request number comes from this database inode.
>
> I'm not so sure about the bit error. Some have the hi-bit set, some not.
> Due to the implementation of tid_gt() I would expect that the numbers
> differ in the high bit. The condition produces a wrong result, if the
> difference between the numbers is greater than INT_MAX.
Yes, sorry. I was confused yesterday. The numbers are exactly such as
they should be when an application constantly calls fdatasync() without
modifying file metadata.
> The sequence / request numbers / difference INT_MAX + x:
> 886052f3 / 086052f1 / 3
> 61d305fe / e1ce83f4 / 295434
> 887d10c8 / 087acf05 / 147908
> 8e3d0b25 / 0e374365 / 378817
> 702d4061 / f02a5e0b / 189014
> 73d6775a / f3d67756 / 4
> 824846ad / 024846ab / 2
>
V On some of the machines we traced the commit_sequence for a short time.
> However no indication could be found the logs, that a datasync was
> triggered with always the same tid.
>
> Result example:
>
> Uptime 5 days, 33 min : commit_sequence: 1135688364
> Uptime 12 days, 2:40 : commit_sequence: 1960701710
>
> 825013346 commits in 170 hours
>
> 4853019 commits per hour => 442 hours or 18 days to have INT_MAX commits.
Yes. In your case it seems we really wrap-around tid. I'll push the fix
to Linus in the next merge window and then it will go also to -stable
kernels. Thanks for your testing!
Honza
> -----Original Message-----
> From: Jan Kara [mailto:jack@suse.cz]
> Sent: Mittwoch, 4. Mai 2011 23:55
> To: Zielinski, Martin
> Cc: tytso@mit.edu; jack@suse.cz; linux-ext4@vger.kernel.org
> Subject: Re: [PATCH 2/2] jbd: fix fsync() tid wraparound bug
>
> On Wed 04-05-11 09:21:04, Martin_Zielinski@McAfee.com wrote:
> > Here's an update.
> > In my first post I was not aware of the implementation of tid_gt.
> > I agree that 2 and a half billion commits on an SD card are - hmph -
> > unlikely
> <snip>
>
> > gdb) p *journal
> > $4 = {j_flags = 16, j_errno = 0, j_sb_buffer = 0xffff88031f156dc8,
> > j_superblock = 0xffff88031f876000, j_format_version = 2, j_state_lock = {raw_lock = {
> > slock = 2874125135}}, j_barrier_count = 0, j_barrier = {count = {counter = 1}, wait_lock = {
> > raw_lock = {slock = 0}}, wait_list = {next = 0xffff88031e6c4638,
> > prev = 0xffff88031e6c4638}, owner = 0x0}, j_running_transaction = 0x0,
> > j_committing_transaction = 0x0, j_checkpoint_transactions = 0xffff88031bd16b40,
> > ...
> > j_tail_sequence = 2288011385, j_transaction_sequence = 2288014068,
> > j_commit_sequence = 2288014067, j_commit_request = 140530417,
> > ...
> > j_wbuf = 0xffff88031de98000, j_wbufsize = 512, j_last_sync_writer = 4568,
> > j_average_commit_time = 69247, j_private = 0xffff88031fd49400}
> <snip>
>
> > (gdb) p ((struct ext3_inode_info*)(0xffff88031f0c0758-0xd0))->i_sync_tid
> > $5 = {counter = -2006954411}
> > (gdb) p ((struct ext3_inode_info*)(0xffff88031f0c0758-0xd0))->i_datasync_tid
> > $3 = {counter = 140530417}
> >
> > > j_commit_request = 140530417
> >
> > So it *is* a datasync from sqlite. And your fix will catch it.
> > I still don't understand, where this number comes from.
> Ok, so i_datasync_tid got corrupted. But look at the numbers in hex:
> i_datasync_tid==140530417==0x86052F1
> and
> i_commit_sequence==2288014067==0x886052F3
>
> So it's a single bit error - we lost the highest bit of the number. Are you
> getting the cores from different machines? Otherwise I'd suspect the HW.
> If it's not HW I'm at loss what can cause it... You can try moving
> i_datasync_tid to a different place in struct ext3_inode_info so that we
> can rule out / confirm whether some code external to i_datasync_tid
> handling is just causing random memory corruption...
>
> Honza
> --
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2011-05-05 15:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <BCB84D936723884B91E4CC5CA0A7C54AA4F6D082BE@EMEADALEXMB1.corp.nai.org>
2011-04-25 23:14 ` 2.6.32 ext3 assertion j_running_transaction != NULL fails in commit.c Ted Ts'o
2011-04-26 0:23 ` [PATCH 1/2] jbd2: fix fsync() tid wraparound bug Theodore Ts'o
2011-04-26 0:23 ` [PATCH 2/2] jbd: " Theodore Ts'o
2011-04-30 17:17 ` Ted Ts'o
2011-05-02 15:07 ` Jan Kara
2011-05-02 18:29 ` Ted Ts'o
2011-05-02 19:04 ` Jan Kara
2011-05-02 21:31 ` Ted Ts'o
2011-05-04 14:21 ` Martin_Zielinski
2011-05-04 21:55 ` Jan Kara
2011-05-05 14:11 ` Martin_Zielinski
2011-05-05 15:53 ` Jan Kara [this message]
2011-05-05 14:55 ` Martin_Zielinski
2011-05-05 15:43 ` Jan Kara
2011-04-26 9:07 ` 2.6.32 ext3 assertion j_running_transaction != NULL fails in commit.c Martin_Zielinski
2011-04-26 12:23 ` Ted Ts'o
2011-04-26 12:45 ` Martin_Zielinski
2011-04-26 17:20 ` Ted 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=20110505155329.GL5323@quack.suse.cz \
--to=jack@suse.cz \
--cc=Martin_Zielinski@McAfee.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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).