mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: linux-kernel <linux-kernel@vger.kernel.org>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] nfs: fix nfs_writepage()
Date: Wed, 17 Oct 2007 15:40:58 +0200	[thread overview]
Message-ID: <1192628458.27435.119.camel@twins> (raw)

I noticed that ->writepage() didn't actually do anything since it
doesn't generate a write request for the given page.

The below is an attempt at fixing it, and it works for me. Although I'm
not quite sure its the proper fix.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 fs/nfs/write.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Index: linux-2.6/fs/nfs/write.c
===================================================================
--- linux-2.6.orig/fs/nfs/write.c
+++ linux-2.6/fs/nfs/write.c
@@ -332,10 +332,30 @@ static int nfs_page_async_flush(struct n
 static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, struct nfs_pageio_descriptor *pgio)
 {
 	struct inode *inode = page_file_mapping(page)->host;
+	struct rpc_cred *cred;
+	struct nfs_open_context *ctx;
+	int status;
 
 	nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
 	nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
 
+	cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0);
+	if (IS_ERR(cred))
+		return PTR_ERR(cred);
+
+	ctx = nfs_find_open_context(inode, cred, FMODE_WRITE);
+	if (!ctx)
+		return -EBADF;
+
+	status = nfs_writepage_setup(ctx, page, 0, nfs_page_length(page));
+
+	put_nfs_open_context(ctx);
+
+	if (status < 0) {
+		nfs_set_pageerror(page);
+		return status;
+	}
+
 	nfs_pageio_cond_complete(pgio, page_file_index(page));
 	return nfs_page_async_flush(pgio, page);
 }



             reply	other threads:[~2007-10-17 13:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17 13:40 Peter Zijlstra [this message]
2007-10-17 15:25 ` Trond Myklebust
2007-10-17 15:30   ` Peter Zijlstra
2007-10-17 15:45     ` Trond Myklebust
2007-10-17 15:47       ` Trond Myklebust
2007-10-17 15:55         ` Christoph Hellwig
2007-10-17 16:02           ` Peter Zijlstra
2007-10-17 16:05             ` Christoph Hellwig
2007-10-17 15:57         ` Peter Zijlstra
2007-10-17 16:24           ` Trond Myklebust
2007-10-17 16:26             ` Peter Zijlstra
2007-10-17 17:36               ` Peter Zijlstra
2007-10-17 18:49                 ` Trond Myklebust

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=1192628458.27435.119.camel@twins \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    /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

Powered by JetHome