aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-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,
145{ 145{
146 unsigned int rsize = NFS_SERVER(inode)->rsize; 146 unsigned int rsize = NFS_SERVER(inode)->rsize;
147 unsigned int count = PAGE_CACHE_SIZE; 147 unsigned int count = PAGE_CACHE_SIZE;
148 int result; 148 int result = -ENOMEM;
149 struct nfs_read_data *rdata; 149 struct nfs_read_data *rdata;
150 150
151 rdata = nfs_readdata_alloc(count); 151 rdata = nfs_readdata_alloc(count);
152 if (!rdata) 152 if (!rdata)
153 return -ENOMEM; 153 goto out_unlock;
154 154
155 memset(rdata, 0, sizeof(*rdata)); 155 memset(rdata, 0, sizeof(*rdata));
156 rdata->flags = (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); 156 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,
218 result = 0; 218 result = 0;
219 219
220io_error: 220io_error:
221 unlock_page(page);
222 nfs_readdata_free(rdata); 221 nfs_readdata_free(rdata);
222out_unlock:
223 unlock_page(page);
223 return result; 224 return result;
224} 225}
225 226
@@ -630,9 +631,10 @@ int nfs_readpage(struct file *file, struct page *page)
630 goto out_error; 631 goto out_error;
631 632
632 if (file == NULL) { 633 if (file == NULL) {
634 error = -EBADF;
633 ctx = nfs_find_open_context(inode, NULL, FMODE_READ); 635 ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
634 if (ctx == NULL) 636 if (ctx == NULL)
635 return -EBADF; 637 goto out_error;
636 } else 638 } else
637 ctx = get_nfs_open_context((struct nfs_open_context *) 639 ctx = get_nfs_open_context((struct nfs_open_context *)
638 file->private_data); 640 file->private_data);