]> err.no Git - linux-2.6/blobdiff - fs/gfs2/ops_inode.c
[GFS2] Fixes to scanning of glocks (again)
[linux-2.6] / fs / gfs2 / ops_inode.c
index 2fe37aeac7b02ec125e6352dfac513989afee592..caecafe0469ba1926c3c796b579c53ffdeca30d9 100644 (file)
@@ -155,7 +155,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
        if (error)
                goto out;
 
-       error = gfs2_repermission(dir, MAY_WRITE | MAY_EXEC, NULL);
+       error = permission(dir, MAY_WRITE | MAY_EXEC, NULL);
        if (error)
                goto out_gunlock;
 
@@ -250,6 +250,7 @@ out:
        gfs2_holder_uninit(ghs + 1);
 
        if (!error) {
+               atomic_inc(&inode->i_count);
                d_instantiate(dentry, inode);
                mark_inode_dirty(inode);
        }
@@ -615,13 +616,19 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
                        goto out_gunlock_r;
        }
 
+       num_gh = 1;
        gfs2_holder_init(odip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
-       gfs2_holder_init(ndip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1);
-       gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 2);
-       num_gh = 3;
+       if (odip != ndip) {
+               gfs2_holder_init(ndip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh);
+               num_gh++;
+       }
+       gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh);
+       num_gh++;
 
-       if (nip)
-               gfs2_holder_init(nip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh++);
+       if (nip) {
+               gfs2_holder_init(nip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + num_gh);
+               num_gh++;
+       }
 
        error = gfs2_glock_nq_m(num_gh, ghs);
        if (error)
@@ -653,7 +660,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
                        }
                }
        } else {
-               error = gfs2_repermission(ndir, MAY_WRITE | MAY_EXEC, NULL);
+               error = permission(ndir, MAY_WRITE | MAY_EXEC, NULL);
                if (error)
                        goto out_gunlock;
 
@@ -688,7 +695,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
        /* Check out the dir to be renamed */
 
        if (dir_rename) {
-               error = gfs2_repermission(odentry->d_inode, MAY_WRITE, NULL);
+               error = permission(odentry->d_inode, MAY_WRITE, NULL);
                if (error)
                        goto out_gunlock;
        }
@@ -882,9 +889,7 @@ static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
        if (ip->i_vn == ip->i_gl->gl_vn)
                return generic_permission(inode, mask, gfs2_check_acl);
 
-       error = gfs2_glock_nq_init(ip->i_gl,
-                                  LM_ST_SHARED, LM_FLAG_ANY,
-                                  &i_gh);
+       error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
        if (!error) {
                error = generic_permission(inode, mask, gfs2_check_acl_locked);
                gfs2_glock_dq_uninit(&i_gh);
@@ -958,10 +963,8 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
        brelse(dibh);
 
        if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) {
-               gfs2_quota_change(ip, -ip->i_di.di_blocks,
-                                ouid, ogid);
-               gfs2_quota_change(ip, ip->i_di.di_blocks,
-                                nuid, ngid);
+               gfs2_quota_change(ip, -ip->i_di.di_blocks, ouid, ogid);
+               gfs2_quota_change(ip, ip->i_di.di_blocks, nuid, ngid);
        }
 
  out_end_trans: