From aaa38aa26430b3012c0ea85f9cc3b88a0758478a Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Thu, 28 Oct 2010 10:10:37 -0400 Subject: [PATCH] --- yaml --- r: 220532 b: refs/heads/master c: 015f0212d51d85bd281a831639a769b4a1a3307a h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/nfs/pagelist.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 19082e301af8..28f5680fb8e2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 568a810d7edd58bd505222dd1c7e48895532290b +refs/heads/master: 015f0212d51d85bd281a831639a769b4a1a3307a diff --git a/trunk/fs/nfs/pagelist.c b/trunk/fs/nfs/pagelist.c index 919490232e17..137b549e63db 100644 --- a/trunk/fs/nfs/pagelist.c +++ b/trunk/fs/nfs/pagelist.c @@ -65,6 +65,13 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, if (req == NULL) return ERR_PTR(-ENOMEM); + /* get lock context early so we can deal with alloc failures */ + req->wb_lock_context = nfs_get_lock_context(ctx); + if (req->wb_lock_context == NULL) { + nfs_page_free(req); + return ERR_PTR(-ENOMEM); + } + /* Initialize the request struct. Initially, we assume a * long write-back delay. This will be adjusted in * update_nfs_request below if the region is not locked. */ @@ -79,7 +86,6 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, req->wb_pgbase = offset; req->wb_bytes = count; req->wb_context = get_nfs_open_context(ctx); - req->wb_lock_context = nfs_get_lock_context(ctx); kref_init(&req->wb_kref); return req; }