]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/gfs2/inode.c
docs: driver-api: pti_intel_mid: Enable syntax highlighting for C code block
[linux.git] / fs / gfs2 / inode.c
index 50eeb15c6f4fdab22a3e40cc2f405c431cb5fa50..e1e18fb587eba4541909953e58bcd64f528168ae 100644 (file)
@@ -1388,16 +1388,18 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
        }
 
        num_gh = 1;
-       gfs2_holder_init(odip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
+       gfs2_holder_init(odip->i_gl, LM_ST_EXCLUSIVE, GL_ASYNC, ghs);
        if (odip != ndip) {
-               gfs2_holder_init(ndip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh);
+               gfs2_holder_init(ndip->i_gl, LM_ST_EXCLUSIVE,GL_ASYNC,
+                                ghs + num_gh);
                num_gh++;
        }
-       gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh);
+       gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ASYNC, ghs + num_gh);
        num_gh++;
 
        if (nip) {
-               gfs2_holder_init(nip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh);
+               gfs2_holder_init(nip->i_gl, LM_ST_EXCLUSIVE, GL_ASYNC,
+                                ghs + num_gh);
                num_gh++;
        }
 
@@ -1406,6 +1408,9 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
                if (error)
                        goto out_gunlock;
        }
+       error = gfs2_glock_async_wait(num_gh, ghs);
+       if (error)
+               goto out_gunlock;
 
        if (nip) {
                /* Grab the resource group glock for unlink flag twiddling.
@@ -1555,7 +1560,8 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
                gfs2_glock_dq_uninit(&rd_gh);
 
        while (x--) {
-               gfs2_glock_dq(ghs + x);
+               if (gfs2_holder_queued(ghs + x))
+                       gfs2_glock_dq(ghs + x);
                gfs2_holder_uninit(ghs + x);
        }
 out_gunlock_r:
@@ -1585,7 +1591,7 @@ static int gfs2_exchange(struct inode *odir, struct dentry *odentry,
        struct gfs2_inode *oip = GFS2_I(odentry->d_inode);
        struct gfs2_inode *nip = GFS2_I(ndentry->d_inode);
        struct gfs2_sbd *sdp = GFS2_SB(odir);
-       struct gfs2_holder ghs[5], r_gh;
+       struct gfs2_holder ghs[4], r_gh;
        unsigned int num_gh;
        unsigned int x;
        umode_t old_mode = oip->i_inode.i_mode;
@@ -1619,15 +1625,16 @@ static int gfs2_exchange(struct inode *odir, struct dentry *odentry,
        }
 
        num_gh = 1;
-       gfs2_holder_init(odip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
+       gfs2_holder_init(odip->i_gl, LM_ST_EXCLUSIVE, GL_ASYNC, ghs);
        if (odip != ndip) {
-               gfs2_holder_init(ndip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh);
+               gfs2_holder_init(ndip->i_gl, LM_ST_EXCLUSIVE, GL_ASYNC,
+                                ghs + num_gh);
                num_gh++;
        }
-       gfs2_holder_init(oip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh);
+       gfs2_holder_init(oip->i_gl, LM_ST_EXCLUSIVE, GL_ASYNC, ghs + num_gh);
        num_gh++;
 
-       gfs2_holder_init(nip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh);
+       gfs2_holder_init(nip->i_gl, LM_ST_EXCLUSIVE, GL_ASYNC, ghs + num_gh);
        num_gh++;
 
        for (x = 0; x < num_gh; x++) {
@@ -1636,6 +1643,10 @@ static int gfs2_exchange(struct inode *odir, struct dentry *odentry,
                        goto out_gunlock;
        }
 
+       error = gfs2_glock_async_wait(num_gh, ghs);
+       if (error)
+               goto out_gunlock;
+
        error = -ENOENT;
        if (oip->i_inode.i_nlink == 0 || nip->i_inode.i_nlink == 0)
                goto out_gunlock;
@@ -1696,7 +1707,8 @@ static int gfs2_exchange(struct inode *odir, struct dentry *odentry,
        gfs2_trans_end(sdp);
 out_gunlock:
        while (x--) {
-               gfs2_glock_dq(ghs + x);
+               if (gfs2_holder_queued(ghs + x))
+                       gfs2_glock_dq(ghs + x);
                gfs2_holder_uninit(ghs + x);
        }
 out_gunlock_r: