summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-11-19 16:44:52 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-06 10:46:27 -0500
commitcf1308ff7829017dab0dbcc817c63dc9c212923e (patch)
tree9ceec966f682c4674ac45d1ef15d52c3a1f9d737 /fs/nfs
parent0b67130149b006628389ff3e8f46be9957af98aa (diff)
downloadlinux-cf1308ff7829017dab0dbcc817c63dc9c212923e.tar.bz2
NFS: Fix missing page_unlock() in nfs_readpage
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/read.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index e879ee6e1385..29094a545088 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -145,12 +145,12 @@ static int nfs_readpage_sync(struct nfs_open_context *ctx, struct inode *inode,
{
unsigned int rsize = NFS_SERVER(inode)->rsize;
unsigned int count = PAGE_CACHE_SIZE;
- int result;
+ int result = -ENOMEM;
struct nfs_read_data *rdata;
rdata = nfs_readdata_alloc(count);
if (!rdata)
- return -ENOMEM;
+ goto out_unlock;
memset(rdata, 0, sizeof(*rdata));
rdata->flags = (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
@@ -218,8 +218,9 @@ static int nfs_readpage_sync(struct nfs_open_context *ctx, struct inode *inode,
result = 0;
io_error:
- unlock_page(page);
nfs_readdata_free(rdata);
+out_unlock:
+ unlock_page(page);
return result;
}
@@ -630,9 +631,10 @@ int nfs_readpage(struct file *file, struct page *page)
goto out_error;
if (file == NULL) {
+ error = -EBADF;
ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
if (ctx == NULL)
- return -EBADF;
+ goto out_error;
} else
ctx = get_nfs_open_context((struct nfs_open_context *)
file->private_data);