From: Andrew Morton <akpm@osdl.org>
To: Badari Pulavarty <pbadari@us.ibm.com>
Cc: linux-fsdevel@vger.kernel.org, sct@redhat.com
Subject: Re: kjournald() with DIO
Date: Tue, 13 Sep 2005 16:07:01 -0700 [thread overview]
Message-ID: <20050913160701.355cd46a.akpm@osdl.org> (raw)
In-Reply-To: <1126630370.14837.60.camel@dyn9047017102.beaverton.ibm.com>
Badari Pulavarty <pbadari@us.ibm.com> wrote:
>
> The buffers were attached to the journal (earlier). kjournald()
> submitted them for IO and waiting for IO to finish. (So it has a ref.
> count on it).
>
>
> journal_commit_transaction()
> ...
> submited buffers for IO
> /* Waiting for IO to complete */
> while (commit_transaction->t_locked_list) {
> ...
> get_bh(bh);
> if (buffer_locked(bh)) {
> spin_unlock(&journal->j_list_lock);
> wait_on_buffer(bh); <<<<<<
>
>
> In the mean while, DIO process through releasepage invalidated the page,
> released the journal head attached to the buffer and trying to drop the
> buffer. But the drop buffer fails due to the kjournald ref. count.
>
> invalidate_complete_page():
> ..
> ext3_releasepage()
> journal_try_to_free_buffers()
> journal_put_journal_head()
> __journal_try_to_free_buffer()
> <--- freed jh
>
> try_to_free_buffers()
> drop_buffers()
> if (buffer_busy(bh))
> goto failed;
> <<--
OK.
<checks email>
The problem is that
__generic_file_aio_write_nolock
->invalidate_inode_pages2_range
->invalidate_complete_page
was unable to invalidate the page and so -EIO was propagated back.
Well, that was wrong of us. invalidate_*_pages() is best-effort. It does
not guarantee to remove the pages from pagecache or anything else. The
truncate_*_pages() functions do have such guarantees. They will block on
that locked buffer, for example.
* invalidate_mapping_pages - Invalidate all the unlocked pages of one inode
* @mapping: the address_space which holds the pages to invalidate
* @start: the offset 'from' which to invalidate
* @end: the offset 'to' which to invalidate (inclusive)
*
* This function only removes the unlocked pages, if you want to
* remove all the pages of one inode, you must call truncate_inode_pages.
*
* invalidate_mapping_pages() will not block on IO activity. It will not
* invalidate pages which are dirty, locked, under writeback or mapped into
* pagetables.
So if we really want to take down that pagecache we'll need to call
->invalidatepage() against each page, not ->releasepage(). Yes, the naming
is whacky. truncate_inode_pages uses ->invalidatepage and
invalidate_inode_pages uses ->releasepage().
Or simply ignore the invalidate_inode_pages2_range() return value in
generic_file_direct_IO().
next prev parent reply other threads:[~2005-09-13 23:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-12 23:23 kjournald() with DIO Badari Pulavarty
2005-09-12 23:37 ` Andrew Morton
2005-09-13 0:06 ` Badari Pulavarty
2005-09-13 0:29 ` Andrew Morton
2005-09-13 16:52 ` Badari Pulavarty
2005-09-13 23:07 ` Andrew Morton [this message]
2005-09-14 17:23 ` Mingming Cao
2005-09-14 18:18 ` Andrew Morton
2005-09-14 21:40 ` Mingming Cao
2005-09-14 22:02 ` Andrew Morton
2005-09-15 11:11 ` Suparna Bhattacharya
2005-09-15 18:52 ` Andrew Morton
2005-09-15 15:03 ` Badari Pulavarty
2005-09-15 19:22 ` Andrea Arcangeli
2005-09-15 20:00 ` Andrew Morton
2005-09-15 20:20 ` Andrea Arcangeli
2005-09-15 20:35 ` Andrew Morton
2005-09-15 20:49 ` Badari Pulavarty
2005-09-15 21:06 ` Andrea Arcangeli
2005-09-15 21:20 ` Andrew Morton
2005-09-15 22:22 ` Badari Pulavarty
2005-09-15 21:03 ` Andrea Arcangeli
2005-09-15 21:26 ` Andrew Morton
2005-09-15 22:04 ` Andrea Arcangeli
2005-09-15 23:28 ` Mingming Cao
2005-09-16 0:18 ` Andrea Arcangeli
2005-09-13 17:53 ` Mingming Cao
2005-09-16 13:42 ` Stephen C. Tweedie
2005-09-21 18:22 ` Mingming Cao
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=20050913160701.355cd46a.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=pbadari@us.ibm.com \
--cc=sct@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.