gfs2: Don't return NULL from gfs2_inode_lookup
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 9 Jun 2020 12:33:11 +0000 (14:33 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 30 Jun 2020 11:04:45 +0000 (13:04 +0200)
Callers expect gfs2_inode_lookup to return an inode pointer or ERR_PTR(error).
Commit b66648ad6dcf caused it to return NULL instead of ERR_PTR(-ESTALE) in
some cases.  Fix that.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: b66648ad6dcf ("gfs2: Move inode generation number check into gfs2_inode_lookup")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/inode.c

index 370c3a4b31acad07128d2e31d13c596a5086df17..6774865f5b5b5c5f8b468d85abc9cd4cb912afa4 100644 (file)
@@ -207,10 +207,11 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
 
        if (no_formal_ino && ip->i_no_formal_ino &&
            no_formal_ino != ip->i_no_formal_ino) {
+               error = -ESTALE;
                if (inode->i_state & I_NEW)
                        goto fail;
                iput(inode);
-               return ERR_PTR(-ESTALE);
+               return ERR_PTR(error);
        }
 
        if (inode->i_state & I_NEW)