]> git.neil.brown.name Git - LaFS.git/commitdiff
lafs_get_block: be consistent in interpreting return value.
authorNeilBrown <neilb@suse.de>
Sun, 17 Oct 2010 22:52:40 +0000 (09:52 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 18 Oct 2010 01:26:45 +0000 (12:26 +1100)
This returns NULL on failure, not an ERR_PTR, so check for that
as, not for IS_ERR

Signed-off-by: NeilBrown <neilb@suse.de>
dir.c
inode.c

diff --git a/dir.c b/dir.c
index bb8b3d1c58b67b7233ce186d1eeaa86087ee8231..713ccb21932bc0254f7bdf61da0bf5a0dbb803e3 100644 (file)
--- 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 05c7350eb24e110a3a682195a65276f4028d24bd..a12fa0c26aebc0445bd5cd7bb90ddcda972c18bd 100644 (file)
--- 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);