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);
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)) {
inode = gfs2_lookupi(dir, &dentry->d_name, 0, nd);
if (inode) {
if (!IS_ERR(inode)) {
- new = 0;
gfs2_holder_uninit(ghs);
break;
} else {
}
d_instantiate(dentry, inode);
- if (new)
- mark_inode_dirty(inode);
return 0;
}
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;
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)
}
}
} else {
- error = gfs2_repermission(ndir, MAY_WRITE | MAY_EXEC, NULL);
+ error = permission(ndir, MAY_WRITE | MAY_EXEC, NULL);
if (error)
goto out_gunlock;
/* 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;
}
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);