Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1139

kernel-2.6.18-238.el5.src.rpm

From: Jeff Layton <jlayton@redhat.com>
Date: Thu, 9 Dec 2010 12:16:22 -0500
Subject: [fs] nfs: set lock_context field in nfs_writepage_sync
Message-id: <1291896982-29906-1-git-send-email-jlayton@redhat.com>
Patchwork-id: 30022
O-Subject: [RHEL5.6 PATCH] BZ#660580: nfs: set lock_context field in
	nfs_writepage_sync
Bugzilla: 660580
RH-Acked-by: Steve Dickson <SteveD@redhat.com>
RH-Acked-by: J. Bruce Fields <bfields@redhat.com>

A late-breaking patch to fix a regression in RHEL5.6...

Patch e992fe54 in Jarod's tree added the lock_context field to
nfs_writedata, but didn't add the code to fill out that field in the
nfs_writepage_sync codepath. That function no longer exists in upstream
code, which is probably why it was omitted here.

The problem was easily reproducible and the patch fixes it.

Signed-off-by: Jeff Layton <jlayton@redhat.com>

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b6b3b61..e516cf9 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -224,6 +224,12 @@ static int nfs_writepage_sync(struct nfs_open_context *ctx, struct inode *inode,
 	if (!wdata)
 		return -ENOMEM;
 
+	wdata->args.lock_context = nfs_get_lock_context(ctx);
+	if (wdata->args.lock_context == NULL) {
+		nfs_writedata_free(wdata);
+		return -ENOMEM;
+	}
+
 	wdata->flags = how;
 	wdata->cred = ctx->cred;
 	wdata->inode = inode;
@@ -274,6 +280,7 @@ static int nfs_writepage_sync(struct nfs_open_context *ctx, struct inode *inode,
 
 io_error:
 	end_page_writeback(page);
+	nfs_put_lock_context(wdata->args.lock_context);
 	nfs_writedata_release(wdata);
 	return written ? written : result;
 }