gfs2: Merge branch 'for-next.nopid' into for-next
[sfrench/cifs-2.6.git] / fs / gfs2 / inode.c
index e211ed8636b5b1e525a7b7f2741130ee494aca20..04a201584fa7c70d6403257f2ef17e282d86827d 100644 (file)
@@ -130,6 +130,7 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
        if (inode->i_state & I_NEW) {
                struct gfs2_sbd *sdp = GFS2_SB(inode);
                struct gfs2_glock *io_gl;
+               int extra_flags = 0;
 
                error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE,
                                       &ip->i_gl);
@@ -141,10 +142,12 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
                if (unlikely(error))
                        goto fail;
 
-               if (blktype != GFS2_BLKST_UNLINKED)
+               if (blktype == GFS2_BLKST_UNLINKED)
+                       extra_flags |= LM_FLAG_TRY;
+               else
                        gfs2_cancel_delete_work(io_gl);
                error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED,
-                                          GL_EXACT | GL_NOPID,
+                                          GL_EXACT | GL_NOPID | extra_flags,
                                           &ip->i_iopen_gh);
                gfs2_glock_put(io_gl);
                if (unlikely(error))
@@ -211,6 +214,8 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
        return inode;
 
 fail:
+       if (error == GLR_TRYFAILED)
+               error = -EAGAIN;
        if (gfs2_holder_initialized(&ip->i_iopen_gh))
                gfs2_glock_dq_uninit(&ip->i_iopen_gh);
        if (gfs2_holder_initialized(&i_gh))