* [PATCH] nfs: handle lock context allocation failures in nfs_create_request
@ 2010-10-28 14:10 Jeff Layton
2010-10-28 18:17 ` Trond Myklebust
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2010-10-28 14:10 UTC (permalink / raw)
To: Trond.Myklebust; +Cc: linux-nfs, steved
nfs_get_lock_context can return NULL on an allocation failure.
Reported-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/nfs/pagelist.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 9194902..137b549 100644
--- a/fs/nfs/pagelist.c
+++ b/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;
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nfs: handle lock context allocation failures in nfs_create_request
2010-10-28 14:10 [PATCH] nfs: handle lock context allocation failures in nfs_create_request Jeff Layton
@ 2010-10-28 18:17 ` Trond Myklebust
0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2010-10-28 18:17 UTC (permalink / raw)
To: Jeff Layton; +Cc: linux-nfs, steved
On Thu, 2010-10-28 at 10:10 -0400, Jeff Layton wrote:
> nfs_get_lock_context can return NULL on an allocation failure.
>
> Reported-by: Steve Dickson <steved@redhat.com>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
> fs/nfs/pagelist.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
> index 9194902..137b549 100644
> --- a/fs/nfs/pagelist.c
> +++ b/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;
> }
Thanks! Applied!
Trond
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-28 18:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 14:10 [PATCH] nfs: handle lock context allocation failures in nfs_create_request Jeff Layton
2010-10-28 18:17 ` Trond Myklebust
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.