* placeholder because it doesn't otherwise make sense), the on-disk block type
  * is verified to be @blktype.
  *
+ * When @no_formal_ino is non-zero, this function will return ERR_PTR(-ESTALE)
+ * if it detects that @no_formal_ino doesn't match the actual inode generation
+ * number.  However, it doesn't always know unless @type is DT_UNKNOWN.
+ *
  * Returns: A VFS inode, or an error
  */
 
                        if (error)
                                goto fail;
 
+                       error = -ESTALE;
+                       if (no_formal_ino &&
+                           gfs2_inode_already_deleted(ip->i_gl, no_formal_ino))
+                               goto fail;
+
                        if (blktype != GFS2_BLKST_FREE) {
                                error = gfs2_check_blk_type(sdp, no_addr,
                                                            blktype);
                        inode->i_mode = DT2IF(type);
                }
 
+               if (gfs2_holder_initialized(&i_gh))
+                       gfs2_glock_dq_uninit(&i_gh);
+
                gfs2_set_iop(inode);
+       }
 
-               unlock_new_inode(inode);
+       if (no_formal_ino && ip->i_no_formal_ino &&
+           no_formal_ino != ip->i_no_formal_ino) {
+               if (inode->i_state & I_NEW)
+                       goto fail;
+               iput(inode);
+               return ERR_PTR(-ESTALE);
        }
 
-       if (gfs2_holder_initialized(&i_gh))
-               gfs2_glock_dq_uninit(&i_gh);
+       if (inode->i_state & I_NEW)
+               unlock_new_inode(inode);
+
        return inode;
 
 fail:
        struct inode *inode;
        int error;
 
-       inode = gfs2_inode_lookup(sb, DT_UNKNOWN, no_addr, 0, blktype);
+       inode = gfs2_inode_lookup(sb, DT_UNKNOWN, no_addr, no_formal_ino,
+                                 blktype);
        if (IS_ERR(inode))
                return inode;
 
-       /* Two extra checks for NFS only */
        if (no_formal_ino) {
-               error = -ESTALE;
-               if (GFS2_I(inode)->i_no_formal_ino != no_formal_ino)
-                       goto fail_iput;
-
                error = -EIO;
                if (GFS2_I(inode)->i_diskflags & GFS2_DIF_SYSTEM)
                        goto fail_iput;