diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-05-29 20:17:17 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-05-29 20:17:17 -0400 |
commit | 0aa61e78a0f262a2f94bd138831c97749cfca5bf (patch) | |
tree | 37d825bd901dc578816e71841e9f649948bcdede /fs/nfs/objlayout | |
parent | 6df200f5d5191bdde4d2e408215383890f956781 (diff) | |
download | blackbird-op-linux-0aa61e78a0f262a2f94bd138831c97749cfca5bf.tar.gz blackbird-op-linux-0aa61e78a0f262a2f94bd138831c97749cfca5bf.zip |
pNFS: Handle allocation errors correctly in objlayout_alloc_layout_hdr()
Return the NULL pointer when the allocation fails.
Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/objlayout')
-rw-r--r-- | fs/nfs/objlayout/objlayout.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c index 2f955f671003..765d3f54e986 100644 --- a/fs/nfs/objlayout/objlayout.c +++ b/fs/nfs/objlayout/objlayout.c @@ -53,10 +53,10 @@ objlayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags) struct objlayout *objlay; objlay = kzalloc(sizeof(struct objlayout), gfp_flags); - if (objlay) { - spin_lock_init(&objlay->lock); - INIT_LIST_HEAD(&objlay->err_list); - } + if (!objlay) + return NULL; + spin_lock_init(&objlay->lock); + INIT_LIST_HEAD(&objlay->err_list); dprintk("%s: Return %p\n", __func__, objlay); return &objlay->pnfs_layout; } |