aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pagelist.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-08-13 17:15:50 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-28 16:03:03 -0400
commitb3c54de6f82d01637796bcc1f667a45f3b32e814 (patch)
tree9b0e87f60b2815ca20ef47eceed6da0f16b799ef /fs/nfs/pagelist.c
parenta11a2bf4de5679fa0b63474c7d39bea2dac7d061 (diff)
NFS: Convert nfs_get_lock_context to return an ERR_PTR on failure
We want to be able to distinguish between allocation failures, and the case where the lock context is not needed (because there are no locks). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r--fs/nfs/pagelist.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 311a79681e2b..dfd764bd943d 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -102,6 +102,7 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
102 unsigned int offset, unsigned int count) 102 unsigned int offset, unsigned int count)
103{ 103{
104 struct nfs_page *req; 104 struct nfs_page *req;
105 struct nfs_lock_context *l_ctx;
105 106
106 /* try to allocate the request struct */ 107 /* try to allocate the request struct */
107 req = nfs_page_alloc(); 108 req = nfs_page_alloc();
@@ -109,11 +110,12 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
109 return ERR_PTR(-ENOMEM); 110 return ERR_PTR(-ENOMEM);
110 111
111 /* get lock context early so we can deal with alloc failures */ 112 /* get lock context early so we can deal with alloc failures */
112 req->wb_lock_context = nfs_get_lock_context(ctx); 113 l_ctx = nfs_get_lock_context(ctx);
113 if (req->wb_lock_context == NULL) { 114 if (IS_ERR(l_ctx)) {
114 nfs_page_free(req); 115 nfs_page_free(req);
115 return ERR_PTR(-ENOMEM); 116 return ERR_CAST(l_ctx);
116 } 117 }
118 req->wb_lock_context = l_ctx;
117 119
118 /* Initialize the request struct. Initially, we assume a 120 /* Initialize the request struct. Initially, we assume a
119 * long write-back delay. This will be adjusted in 121 * long write-back delay. This will be adjusted in