From 15b8a4a7c34119e54799975d798688aad08b95a4 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 18 Oct 2010 09:52:40 +1100 Subject: [PATCH] lafs_get_block: be consistent in interpreting return value. This returns NULL on failure, not an ERR_PTR, so check for that as, not for IS_ERR Signed-off-by: NeilBrown --- dir.c | 10 ++++++---- inode.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dir.c b/dir.c index bb8b3d1..713ccb2 100644 --- a/dir.c +++ b/dir.c @@ -281,14 +281,16 @@ static int dir_create_prepare(struct fs *fs, struct inode *dir, kfree(n1); kfree(n2); return -ENOMEM; } + doh->new = lafs_get_block(dir, newhash+1, NULL, GFP_KERNEL, + MKREF(dir_new)); + if (doh->new == NULL) { + kfree(n1); kfree(n2); + return -ENOMEM; + } buf = map_dblock(dirblk); lafs_dir_split(buf, bits, n1, n2, name, inum, type, &newhash, seed, hash, chainoffset); unmap_dblock(dirblk, buf); - doh->new = lafs_get_block(dir, newhash+1, NULL, GFP_KERNEL, - MKREF(dir_new)); - if (IS_ERR(doh->new)) - return PTR_ERR(doh->new); buf = map_dblock(doh->new); memcpy(buf, n1, blocksize); unmap_dblock(doh->new, buf); diff --git a/inode.c b/inode.c index 05c7350..a12fa0c 100644 --- a/inode.c +++ b/inode.c @@ -531,8 +531,8 @@ struct datablock *lafs_inode_dblock(struct inode *ino, int async, REFARG) if (!db) db = lafs_get_block(ino_from_sb(ino->i_sb), ino->i_ino, NULL, GFP_KERNEL, REF); - if (IS_ERR(db)) - return db; + if (!db) + return ERR_PTR(-ENOMEM); LAFSI(ino)->dblock = db; rcu_assign_pointer(db->my_inode, ino); -- 2.39.5