]> err.no Git - linux-2.6/blobdiff - fs/gfs2/ops_inode.c
[GFS2] Remove gfs2_repermission
[linux-2.6] / fs / gfs2 / ops_inode.c
index f678f6b62afd7673709b981a1bd7b15e5ed77064..5d5ebbcba534bae903ac5f4890a577cb23cef586 100644 (file)
@@ -56,7 +56,6 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
        struct gfs2_sbd *sdp = GFS2_SB(dir);
        struct gfs2_holder ghs[2];
        struct inode *inode;
-       int new = 1;
 
        gfs2_holder_init(dip->i_gl, 0, 0, ghs);
 
@@ -69,6 +68,7 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
                        gfs2_quota_unlock(dip);
                        gfs2_alloc_put(dip);
                        gfs2_glock_dq_uninit_m(2, ghs);
+                       mark_inode_dirty(inode);
                        break;
                } else if (PTR_ERR(inode) != -EEXIST ||
                           (nd->intent.open.flags & O_EXCL)) {
@@ -79,7 +79,6 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
                inode = gfs2_lookupi(dir, &dentry->d_name, 0, nd);
                if (inode) {
                        if (!IS_ERR(inode)) {
-                               new = 0;
                                gfs2_holder_uninit(ghs);
                                break;
                        } else {
@@ -90,8 +89,6 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
        }
 
        d_instantiate(dentry, inode);
-       if (new)
-               mark_inode_dirty(inode);
 
        return 0;
 }
@@ -158,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;
 
@@ -618,13 +615,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)
@@ -656,7 +659,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;
 
@@ -691,7 +694,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;
        }
@@ -885,9 +888,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);