mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@redhat.com>
To: Alex Tomas <bzzz@tmi.comex.ru>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	"ext2-devel@lists.sourceforge.net"
	<ext2-devel@lists.sourceforge.net>,
	Stephen Tweedie <sct@redhat.com>
Subject: Re: [Ext2-devel] [RFC] probably bug in current ext3/jbd
Date: 19 May 2003 21:34:42 +0100	[thread overview]
Message-ID: <1053376482.11943.15.camel@sisko.scot.redhat.com> (raw)
In-Reply-To: <87d6igmarf.fsf@gw.home.net>

Hi,

On Sun, 2003-05-18 at 18:21, Alex Tomas wrote:

> ext3/jbd use b_committed_data buffer in order to prevent
> allocation of blocks which were freed in non-committed
> transaction. I think there is bug in this code. look,

You just found a rather subtle bug which was fixed around 2 or 3 years
ago. :-)

> some thread                               commit thread
> ----------------------------------------------------------

> start_journal()
> get_undo_access(#1):
>    1) wait for #1 to be
>       in t_forget_list

get_undo_access is a declaration of intention to modify the buffer. 
When that happens, it calls do_get_write_access() with the force_copy
flag set.  That means that it _always_ creates a new frozen_data copy of
the buffer the first time we get undo access to a bitmap buffer within
any given transaction.  That basically means that for bitmaps,
frozen_data always holds the version of the buffer as of the end of the
previously completed transaction.

>                                            for_each_bh_in_forget_list() {
>                                               if (jh->b_committed_data) {
>                                                   kfree(jh->b_committed_data);
>                                                   jh->b_committed_data = NULL;
>                                               }

Ah, but the *immediately* following lines are:

			if (jh->b_frozen_data) {
				jh->b_committed_data = jh->b_frozen_data;
				jh->b_frozen_data = NULL;
			}

so the frozen data that was preserved at get_undo_access() time has now
committed to disk and gets rotated into the b_committed_data version. 
This is exactly how we get the new version of the committed data when
the old transaction commits.

Cheers,
 Stephen


  reply	other threads:[~2003-05-19 20:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-18 17:21 Alex Tomas
2003-05-19 20:34 ` Stephen C. Tweedie [this message]
2003-05-20  0:46   ` [Ext2-devel] " Alex Tomas
2003-05-19 20:51     ` Stephen C. Tweedie
2003-05-20  0:58       ` Alex Tomas
2003-05-20 16:06       ` Alex Tomas
2003-05-21 16:38         ` Andrew Morton
2003-05-21 20:45           ` Alex Tomas
2003-05-21 16:59             ` Andrew Morton
     [not found]               ` <m3brxwe2lr.fsf@lexa.home.net>
     [not found]                 ` <20030521103737.52eddeb3.akpm@digeo.com>
     [not found]                   ` <87n0hgc6s6.fsf@gw.home.net>
     [not found]                     ` <20030521105011.2d316baf.akpm@digeo.com>
     [not found]                       ` <87k7ckc5z2.fsf@gw.home.net>
     [not found]                         ` <20030521143140.3aaa86ba.akpm@digeo.com>
2003-05-23 11:08                           ` Alex Tomas
2003-05-23  8:49                             ` Andrew Morton
2003-05-23 12:49                               ` Alex Tomas
2003-05-23 11:20           ` [RFC] probably invalid accounting in jbd Alex Tomas
2003-05-23  8:26             ` Andrew Morton
2003-05-23 16:02               ` [Ext2-devel] " Andreas Dilger

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=1053376482.11943.15.camel@sisko.scot.redhat.com \
    --to=sct@redhat.com \
    --cc=bzzz@tmi.comex.ru \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®