public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: David Howells <dhowells@redhat.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/2] AFS: Implement shared-writable mmap
Date: Wed, 16 May 2007 10:32:19 +1000	[thread overview]
Message-ID: <464A5113.5080907@yahoo.com.au> (raw)
In-Reply-To: <20070515155231.29345.6212.stgit@warthog.cambridge.redhat.com>

David Howells wrote:
> Implement shared-writable mmap for AFS.
> 
> The key with which to access the file is obtained from the VMA at the point
> where the PTE is made writable by the page_mkwrite() VMA op and cached in the
> affected page.
> 
> If there's an outstanding write on the page made with a different key, then
> page_mkwrite() will flush it before attaching a record of the new key.

Good, will be nice to get a page_mkwrite() user in the tree.



> +/*
> + * notification that a previously read-only page is about to become writable
> + * - if it returns an error, the caller will deliver a bus error signal
> + *
> + * we use this to make a record of the key with which the writeback should be
> + * performed and to flush any outstanding writes made with a different key
> + *
> + * the key to be used is attached to the file pinned by the VMA
> + */
> +int afs_page_mkwrite(struct vm_area_struct *vma, struct page *page)
> +{
> +	struct afs_vnode *vnode = AFS_FS_I(vma->vm_file->f_mapping->host);
> +	struct key *key = vma->vm_file->private_data;
> +	int ret;
> +
> +	_enter("{{%x:%u},%x},{%lx}",
> +	       vnode->fid.vid, vnode->fid.vnode, key_serial(key), page->index);
> +
> +	lock_page(page);
> +	ret = afs_prepare_write(vma->vm_file, page, 0, 0);
> +	unlock_page(page);
> +
> +	_leave(" = %d", ret);
> +	return ret;
> +}

By the looks of afs_prepare_write, it is going to go bang when the page
gets truncated before lock_page.

Checking page->mapping after lock_page should do the trick.

-- 
SUSE Labs, Novell Inc.

  parent reply	other threads:[~2007-05-16  0:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-15 15:52 [PATCH 1/2] AFS: Fix afs_prepare_write() David Howells
2007-05-15 15:52 ` [PATCH 2/2] AFS: Implement shared-writable mmap David Howells
2007-05-15 21:40   ` Andrew Morton
2007-05-16  0:41     ` Nick Piggin
2007-05-16 16:36       ` Hugh Dickins
2007-05-16 17:14         ` Nick Piggin
2007-05-16 17:26           ` Hugh Dickins
2007-05-16 17:30             ` Nick Piggin
2007-05-16 17:34             ` Chuck Ebbert
2007-05-16 17:48             ` David Howells
2007-05-16  0:32   ` Nick Piggin [this message]
2007-05-16  7:10   ` Christoph Hellwig
2007-05-16  7:17     ` Nick Piggin
2007-05-16  0:24 ` [PATCH 1/2] AFS: Fix afs_prepare_write() 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=464A5113.5080907@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --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