public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@novell.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: Andrew Morton <akpm@osdl.org>, Andi Kleen <ak@suse.de>,
	Christoph Rohland <cr@sap.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tmpfs symlink corrupts mempolicy
Date: Mon, 15 Nov 2004 23:34:30 +0100	[thread overview]
Message-ID: <20041115223430.GF4758@dualathlon.random> (raw)
In-Reply-To: <Pine.LNX.4.44.0411152037340.4131-100000@localhost.localdomain>

On Mon, Nov 15, 2004 at 08:41:12PM +0000, Hugh Dickins wrote:
> Andrea discovered that short symlinks on tmpfs, stored within the inode
> itself, overwrote the NUMA mempolicy field which shmem_destroy_inode
> expected to find there.  His fix was good, but Hugh changed it around a
> little, to match existing shmem.c practice (now mpol_init in cases which
> might allocate a page, mpol_free in shmem_truncate_inode), and allow for
> possibility that mpol_init for a long symlink might one day do something
> which really needs mpol_free.
> 
> Signed-off-by: Hugh Dickins <hugh@veritas.com>
> ---
> 
> Thanks a lot for working that out, Andrea: is this version okay with you?
> I've not studied the mempolicy.c part of the patch you posted, which
> seemed to be an entirely separate (and less urgent) patch,
> better reviewed by Andi.
> 
> --- 2.6.10-rc2/mm/shmem.c	2004-11-15 16:21:24.000000000 +0000
> +++ linux/mm/shmem.c	2004-11-15 19:08:58.366829456 +0000
> @@ -672,6 +672,7 @@ static void shmem_delete_inode(struct in
>  		shmem_unacct_size(info->flags, inode->i_size);
>  		inode->i_size = 0;
>  		shmem_truncate(inode);
> +		mpol_free_shared_policy(&info->policy);
>  		if (!list_empty(&info->swaplist)) {
>  			spin_lock(&shmem_swaplist_lock);
>  			list_del_init(&info->swaplist);

this patch is completely broken, delete_inode isn't going to be called
when the inode is being shrunk. delete_inode is only good for truncate,
mpol_free_shared_policy has nothing to do with the nlink value.

this patch will tend to work until the vm shrink the dcache, then it'll
crash, sorry.

  reply	other threads:[~2004-11-15 22:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-15 20:41 [PATCH] tmpfs symlink corrupts mempolicy Hugh Dickins
2004-11-15 22:34 ` Andrea Arcangeli [this message]
2004-11-16  0:26   ` Hugh Dickins
2004-11-16  2:14     ` Andrea Arcangeli
2004-11-16  5:50       ` Hugh Dickins

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=20041115223430.GF4758@dualathlon.random \
    --to=andrea@novell.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=cr@sap.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    /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