LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: mm snapshot broken-out-2007-03-18-02-44.tar.gz uploaded
Date: Tue, 20 Mar 2007 16:18:57 +1100 [thread overview]
Message-ID: <45FF6EC1.10705@yahoo.com.au> (raw)
In-Reply-To: <45FF6E55.4060101@yahoo.com.au>
[-- Attachment #1: Type: text/plain, Size: 771 bytes --]
Nick Piggin wrote:
> Andrew Morton wrote:
>
>> On Tue, 20 Mar 2007 13:47:53 +1100 Nick Piggin
>> <nickpiggin@yahoo.com.au> wrote:
>>
>>
>>> Andrew Morton wrote:
>>>
>
>>> Hang on a sec... I'll try fixing the thing before you next make a
>>> release.
>>>
>>
>>
>> Too late. hot-fixes/ awaits thee.
>
>
> Awww... well thanks very much Michal for reporting the bug, I reproduced
> it easily and it turns out to be a typo.
>
> In my testing I never had a lot of writeout going on, so most of the pages
> will have been truncated in the first loop...
Also, noticed another problem in the same general area. Andrew you were
indeed right to question the removal of that unmap_mapping_range call,
but I think even it alone it wasn't enough...
--
SUSE Labs, Novell Inc.
[-- Attachment #2: mm-dnp-invp-race-fix2.patch --]
[-- Type: text/plain, Size: 1551 bytes --]
The nopage vs invalidate race fix patch did not take care of truncating
private COW pages. Mind you, I'm pretty sure this was previously racy
even for regular truncate, not to mention vmtruncate_range.
Anyway, fix that omission.
Index: linux-2.6/mm/memory.c
===================================================================
--- linux-2.6.orig/mm/memory.c
+++ linux-2.6/mm/memory.c
@@ -1905,7 +1905,18 @@ int vmtruncate(struct inode * inode, lof
if (IS_SWAPFILE(inode))
goto out_busy;
i_size_write(inode, offset);
+
+ /*
+ * unmap_mapping_range is called twice, first simply for efficiency
+ * so that truncate_inode_pages does fewer single-page unmaps. However
+ * after this first call, and before truncate_inode_pages finishes,
+ * it is possible for private pages to be COWed, which remain after
+ * truncate_inode_pages finishes, hence the second unmap_mapping_range
+ * call must be made for correctness.
+ */
+ unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
truncate_inode_pages(mapping, offset);
+ unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
goto out_truncate;
do_expand:
@@ -1943,7 +1954,9 @@ int vmtruncate_range(struct inode *inode
mutex_lock(&inode->i_mutex);
down_write(&inode->i_alloc_sem);
+ unmap_mapping_range(mapping, offset, (end - offset), 1);
truncate_inode_pages_range(mapping, offset, end);
+ unmap_mapping_range(mapping, offset, (end - offset), 1);
inode->i_op->truncate_range(inode, offset, end);
up_write(&inode->i_alloc_sem);
mutex_unlock(&inode->i_mutex);
next prev parent reply other threads:[~2007-03-20 5:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200703180946.l2I9kTVc020636@shell0.pdx.osdl.net>
2007-03-18 18:35 ` mm snapshot broken-out-2007-03-18-02-44.tar.gz uploaded Michal Piotrowski
[not found] ` <6bffcb0e0703190845s6bdc1a65p71937d1dffbf6d9e@mail.gmail.com>
2007-03-19 15:54 ` Pekka J Enberg
2007-03-19 16:29 ` Michal Piotrowski
2007-03-19 16:34 ` Michal Piotrowski
2007-03-19 16:39 ` Pekka J Enberg
2007-03-19 16:38 ` Pekka J Enberg
2007-03-19 16:45 ` Michal Piotrowski
[not found] ` <6bffcb0e0703191024w527638f8yacc3a8fea9fd451d@mail.gmail.com>
2007-03-19 18:02 ` Michal Piotrowski
2007-03-19 18:10 ` Pekka J Enberg
2007-03-19 19:27 ` Michal Piotrowski
2007-03-19 23:25 ` Andrew Morton
2007-03-20 11:43 ` Sam Ravnborg
2007-03-19 19:23 ` Michal Piotrowski
2007-03-19 21:08 ` Andrew Morton
[not found] ` <6bffcb0e0703191437i2ee706d4xaec3bc11ca7c3234@mail.gmail.com>
2007-03-20 1:58 ` Andrew Morton
2007-03-20 2:02 ` Andrew Morton
2007-03-20 2:47 ` Nick Piggin
2007-03-20 4:56 ` Andrew Morton
2007-03-20 5:17 ` Nick Piggin
2007-03-20 5:18 ` Nick Piggin [this message]
2007-03-20 9:07 ` Michal Piotrowski
2007-03-19 19:56 ` Michal Piotrowski
2007-03-20 7:17 ` Michal Piotrowski
2007-03-20 16:36 ` Andrew Morton
2007-03-20 18:22 ` Andi Kleen
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=45FF6EC1.10705@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.k.k.piotrowski@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).