mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
nfs: handle lock context allocation failures in nfs_create_request
nfs_get_lock_context can return NULL on an allocation failure.
Regression introduced by commit f11ac8db.
Reported-by: Steve Dickson <[email protected]>
Signed-off-by: Jeff Layton <[email protected]>
Cc: [email protected]
Signed-off-by: Trond Myklebust <[email protected]>
This commit is contained in:
parent
568a810d7e
commit
015f0212d5
1 changed files with 7 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue