[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1212020108.3791.51.camel@localhost.localdomain>
Date: Wed, 28 May 2008 17:15:08 -0700
From: Mingming Cao <cmm@...ibm.com>
To: Jan Kara <jack@...e.cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>, pbadari@...ibm.com,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org,
Jens Axboe <jens.axboe@...cle.com>
Subject: Re: [PATCH-v2] JBD: Fix race between free buffer and commit
trasanction
On Wed, 2008-05-28 at 20:55 +0200, Jan Kara wrote:
> On Wed 28-05-08 11:18:59, Mingming Cao wrote:
> > @@ -1682,9 +1712,11 @@ out:
> > * journal_try_to_free_buffer() is changing its state. But that
> > * cannot happen because we never reallocate freed data as metadata
> > * while the data is part of a transaction. Yes?
> > + *
> > + * Return 0 on failure, 1 on success
> > */
> > int journal_try_to_free_buffers(journal_t *journal,
> > - struct page *page, gfp_t unused_gfp_mask)
> > + struct page *page, gfp_t gfp_mask)
> > {
> > struct buffer_head *head;
> > struct buffer_head *bh;
> > @@ -1713,7 +1745,28 @@ int journal_try_to_free_buffers(journal_
> > if (buffer_jbd(bh))
> > goto busy;
> > } while ((bh = bh->b_this_page) != head);
> > +
> > ret = try_to_free_buffers(page);
> > +
> > + /*
> > + * There are a number of places where journal_try_to_free_buffers()
> > + * could race with journal_commit_transaction(), the later still
> > + * holds the reference to the buffers to free while processing them.
> > + * try_to_free_buffers() failed to free those buffers. Some of the
> > + * caller of releasepage() request page buffers to be dropped, otherwise
> > + * treat the fail-to-free as errors (such as generic_file_direct_IO())
> > + *
> > + * So, if the caller of try_to_release_page() wants the synchronous
> > + * behaviour(i.e make sure buffers are dropped upon return),
> > + * let's wait for the current transaction to finish flush of
> > + * dirty data buffers, then try to free those buffers again,
> > + * with the journal locked.
> > + */
> > + if (ret == 0 && (gfp_mask & GFP_KERNEL == GFP_KERNEL)) {
> I think Andrew prefered this test to be expanded but otherwise the patch
> is fine now. You can add:
> Acked-by: Jan Kara <jack@...e.cz>
>
Okay, I will update the patch and cleanup the history, sent it to
Andrew. Thanks.
Mingming
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists