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@xxxxxxx> > 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-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html