All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 002 of 4] Honour AOP_TRUNCATE_PAGE returns in page_symlink
Date: Mon, 13 Mar 2006 10:53:22 +1100	[thread overview]
Message-ID: <1060312235322.15954@suse.de> (raw)
In-Reply-To: 20060313104910.15881.patches@notabene


As prepare_write, commit_write and readpage are allowed to return
AOP_TRUNCATE_PAGE, page_symlink should respond to them.

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/namei.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff ./fs/namei.c~current~ ./fs/namei.c
--- ./fs/namei.c~current~	2006-03-09 17:29:35.000000000 +1100
+++ ./fs/namei.c	2006-03-13 10:43:40.000000000 +1100
@@ -2628,19 +2628,31 @@ void page_put_link(struct dentry *dentry
 int page_symlink(struct inode *inode, const char *symname, int len)
 {
 	struct address_space *mapping = inode->i_mapping;
-	struct page *page = grab_cache_page(mapping, 0);
+	struct page *page;
 	int err = -ENOMEM;
 	char *kaddr;
 
+ retry:
+	page = grab_cache_page(mapping, 0);
 	if (!page)
 		goto fail;
 	err = mapping->a_ops->prepare_write(NULL, page, 0, len-1);
+	if (err == AOP_TRUNCATED_PAGE) {
+		page_cache_release(page);
+		goto retry;
+	}
 	if (err)
 		goto fail_map;
 	kaddr = kmap_atomic(page, KM_USER0);
 	memcpy(kaddr, symname, len-1);
 	kunmap_atomic(kaddr, KM_USER0);
-	mapping->a_ops->commit_write(NULL, page, 0, len-1);
+	err = mapping->a_ops->commit_write(NULL, page, 0, len-1);
+	if (err == AOP_TRUNCATED_PAGE) {
+		page_cache_release(page);
+		goto retry;
+	}
+	if (err)
+		goto fail_map;
 	/*
 	 * Notice that we are _not_ going to block here - end of page is
 	 * unmapped, so this will only try to map the rest of page, see
@@ -2650,7 +2662,8 @@ int page_symlink(struct inode *inode, co
 	 */
 	if (!PageUptodate(page)) {
 		err = mapping->a_ops->readpage(NULL, page);
-		wait_on_page_locked(page);
+		if (err != AOP_TRUNCATED_PAGE)
+			wait_on_page_locked(page);
 	} else {
 		unlock_page(page);
 	}

  parent reply	other threads:[~2006-03-12 23:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-12 23:53 [PATCH 000 of 4] Introduction: VFS documentation and tidy up NeilBrown
2006-03-12 23:53 ` [PATCH 001 of 4] Update some VFS documentation NeilBrown
2006-03-13  0:22   ` Avishay Traeger
2006-03-13  4:14     ` [PATCH 001 of 4] Update some VFS documentation fix Neil Brown
2006-03-13  4:58   ` [PATCH 001 of 4] Update some VFS documentation Randy.Dunlap
2006-03-12 23:53 ` NeilBrown [this message]
2006-03-12 23:53 ` [PATCH 003 of 4] Make address_space_operations->sync_page return void NeilBrown
2006-03-12 23:53 ` [PATCH 004 of 4] Make address_space_operations->invalidatepage " NeilBrown
2006-03-13 16:32   ` Dave Kleikamp
2006-03-13 19:13     ` Dave Kleikamp
2006-03-13 21:36       ` Andrew Morton
2006-03-13 23:05         ` Neil Brown
2006-03-13 23:10     ` Neil Brown
2006-03-13 23:22       ` Dave Kleikamp

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=1060312235322.15954@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@osdl.org \
    --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 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.