From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@osdl.org>, hugh@veritas.com
Cc: viro@parcelfarce.linux.theplanet.co.uk, torvalds@osdl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][RFC] truncate vs add_to_page_cache race
Date: Fri, 14 May 2004 13:15:39 +1000 [thread overview]
Message-ID: <40A439DB.70902@yahoo.com.au> (raw)
In-Reply-To: <40A438AC.9020506@yahoo.com.au>
Nick Piggin wrote:
> Nick Piggin wrote:
>
>> Andrew Morton wrote:
>>
>>> Nick Piggin <nickpiggin@yahoo.com.au> wrote:
>>
>>
>>
>>>> OK, I made a debug patch to printk and schedule_timeout in this
>>>> race window so I can easily truncate the file. When this happens,
>>>> it turns out that the readpage thinks it is reading a hole and
>>>> fills the page with zeros -> invalid result?
>>>
>>>
>>>
>>>
>>> A zero-filled pagecache page outside i_size is OK.
>>>
>>
>> Yes. But in this case the zero filled page actually gets
>> read by read(2).
>>
>> In any case, I think my patch won't close the race completely.
>>
>
> This following patch should be right.
>
> It causes the zeros to not get copied back unless i_size
> gets extended again.
>
However, it causes the fast path reading off the end of a file
to always go into ->readpage and copy the non-existant page of
zeros. This could be fixed no problem, but I'll shut up and let
others comment in case I'm making a fool of myself :)
next prev parent reply other threads:[~2004-05-14 3:15 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 [this message]
2004-05-14 23:29 ` Nick Piggin
2004-05-14 23:50 ` Andrew Morton
2004-05-15 0:09 ` Nick Piggin
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=40A439DB.70902@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.