aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-05-29 20:17:17 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-29 20:17:17 -0400
commit0aa61e78a0f262a2f94bd138831c97749cfca5bf (patch)
tree37d825bd901dc578816e71841e9f649948bcdede /fs/nfs
parent6df200f5d5191bdde4d2e408215383890f956781 (diff)
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')
-rw-r--r--fs/nfs/objlayout/objlayout.c8
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)
53 struct objlayout *objlay; 53 struct objlayout *objlay;
54 54
55 objlay = kzalloc(sizeof(struct objlayout), gfp_flags); 55 objlay = kzalloc(sizeof(struct objlayout), gfp_flags);
56 if (objlay) { 56 if (!objlay)
57 spin_lock_init(&objlay->lock); 57 return NULL;
58 INIT_LIST_HEAD(&objlay->err_list); 58 spin_lock_init(&objlay->lock);
59 } 59 INIT_LIST_HEAD(&objlay->err_list);
60 dprintk("%s: Return %p\n", __func__, objlay); 60 dprintk("%s: Return %p\n", __func__, objlay);
61 return &objlay->pnfs_layout; 61 return &objlay->pnfs_layout;
62} 62}