linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org, hch@infradead.org, jack@suse.cz,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [rfc][patch 1/3] fs: new truncate sequence
Date: Mon, 6 Jul 2009 20:10:26 +0200	[thread overview]
Message-ID: <20090706181026.GW2714@wotan.suse.de> (raw)
In-Reply-To: <E1MNsU3-0002Lx-8T@pomaz-ex.szeredi.hu>

On Mon, Jul 06, 2009 at 08:00:07PM +0200, Miklos Szeredi wrote:
> > Index: linux-2.6/mm/truncate.c
> > ===================================================================
> > --- linux-2.6.orig/mm/truncate.c
> > +++ linux-2.6/mm/truncate.c
> > @@ -465,3 +465,79 @@ int invalidate_inode_pages2(struct addre
> >  	return invalidate_inode_pages2_range(mapping, 0, -1);
> >  }
> >  EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
> > +
> > +/**
> > + * truncate_pagecache - unmap mappings "freed" by truncate() syscall
> > + * @inode: inode
> > + * @old: old file offset
> > + * @new: new file offset
> > + *
> > + * inode's new i_size must already be written before truncate_pagecache
> > + * is called.
> > + */
> > +void truncate_pagecache(struct inode * inode, loff_t old, loff_t new)
> > +{
> > +	VM_BUG_ON(inode->i_size != new);
> 
> This is not true for fuse (and NFS?) as i_size isn't protected by
> i_mutex during attribute revalidation, and so it can change during the
> truncate.

Hmm, that's probably OK now. filemap_fault has some tricky code
to avoid faulting in pages past i_size, but since that has been
changed to use page lock a while back, the i_size checks can
probably go away.

So long as your filesystems obviously have to ensure the truncate
will not truncate the wrong pages, I can remove the VM_BUG_ON
just fine.

Thanks,
Nick

  reply	other threads:[~2009-07-06 18:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-06 16:54 [rfc][patch 1/3] fs: new truncate sequence Nick Piggin
2009-07-06 16:55 ` [rfc][patch 2/3] fs: make use of new helper functions Nick Piggin
2009-07-06 17:23   ` Christoph Hellwig
2009-07-06 17:47     ` Nick Piggin
2009-07-06 18:05   ` Miklos Szeredi
2009-07-06 16:56 ` [rfc][patch 3/3] fs: convert ext2,tmpfs to new truncate Nick Piggin
2009-07-06 17:28   ` Christoph Hellwig
2009-07-06 17:59     ` Nick Piggin
2009-07-07  9:17     ` Nick Piggin
2009-07-07 11:45   ` Boaz Harrosh
2009-07-07 13:30     ` Nick Piggin
2009-07-06 17:22 ` [rfc][patch 1/3] fs: new truncate sequence Christoph Hellwig
2009-07-06 17:47   ` Nick Piggin
2009-07-07  7:29     ` Peter Zijlstra
2009-07-07  8:48       ` Nick Piggin
2009-07-06 18:00 ` Miklos Szeredi
2009-07-06 18:10   ` Nick Piggin [this message]
2009-07-07 11:45 ` Boaz Harrosh
2009-08-15 14:51 ` Christoph Hellwig
2009-08-15 15:14   ` Nick Piggin
2009-08-15 15:18     ` Christoph Hellwig
2009-08-15 15:36       ` 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=20090706181026.GW2714@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=miklos@szeredi.hu \
    /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).