From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@osdl.org>
Cc: torvalds@osdl.org, hugh@veritas.com,
viro@parcelfarce.linux.theplanet.co.uk,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][RFC] truncate vs add_to_page_cache race
Date: Sat, 15 May 2004 10:09:29 +1000 [thread overview]
Message-ID: <40A55FB9.2090908@yahoo.com.au> (raw)
In-Reply-To: <20040514165038.17eb142b.akpm@osdl.org>
Andrew Morton wrote:
> Nick Piggin <nickpiggin@yahoo.com.au> wrote:
>
>>I think the entire problem can be fixed by ensuring ->readpage and
>>do_generic_mapping read see the same i_size. This would either mean
>>passing i_size to or from ->readpage, *or* having ->readpage return
>>the number of bytes read, for example.
>
>
> Or not check i_size in ->readpage at all?
>
It needn't check readpage if it gets the number of bytes to read
passed to it, or gets i_size passed to it.
With do_generic_mapping_read and ->readpage each having a different
idea of how much of the page to process(*), bad things can happen.
They have different ideas about how much they need to process due to
the each one checking i_size on its own.
* That is "copy to userspace" and "read" for do_generic_mapping_read
and ->readpages respectively.
> If fixing this is going to cost extra fastpath cycles I'd be inclined to
> not bother, frankly.
>
What I'm thinking of shouldn't cost any cycles, it would require a
change to ->readpage API though. Preferably one where we can tell it
how many bytes to read. I can't see how else to fix it.
If this is not acceptable for 2.6, we could use a nicer variation of
my second patch which at least fixes the truncate problem, and its
remaining race is *much* more improbable.
prev parent reply other threads:[~2004-05-15 0:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-14 2:01 [PATCH][RFC] truncate vs add_to_page_cache race Nick Piggin
2004-05-14 2:20 ` Nick Piggin
2004-05-14 2:33 ` Andrew Morton
2004-05-14 2:39 ` Nick Piggin
2004-05-14 3:10 ` Nick Piggin
2004-05-14 3:15 ` Nick Piggin
2004-05-14 23:29 ` Nick Piggin
2004-05-14 23:50 ` Andrew Morton
2004-05-15 0:09 ` Nick Piggin [this message]
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=40A55FB9.2090908@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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.