aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/ops_inode.c')
-rw-r--r--fs/gfs2/ops_inode.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index e87412902bed..2686ad4c0029 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -200,15 +200,15 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
200 200
201 if (alloc_required) { 201 if (alloc_required) {
202 struct gfs2_alloc *al = gfs2_alloc_get(dip); 202 struct gfs2_alloc *al = gfs2_alloc_get(dip);
203 if (!al) {
204 error = -ENOMEM;
205 goto out_gunlock;
206 }
203 207
204 error = gfs2_quota_lock(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 208 error = gfs2_quota_lock_check(dip);
205 if (error) 209 if (error)
206 goto out_alloc; 210 goto out_alloc;
207 211
208 error = gfs2_quota_check(dip, dip->i_inode.i_uid, dip->i_inode.i_gid);
209 if (error)
210 goto out_gunlock_q;
211
212 al->al_requested = sdp->sd_max_dirres; 212 al->al_requested = sdp->sd_max_dirres;
213 213
214 error = gfs2_inplace_reserve(dip); 214 error = gfs2_inplace_reserve(dip);
@@ -716,15 +716,15 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
716 716
717 if (alloc_required) { 717 if (alloc_required) {
718 struct gfs2_alloc *al = gfs2_alloc_get(ndip); 718 struct gfs2_alloc *al = gfs2_alloc_get(ndip);
719 if (!al) {
720 error = -ENOMEM;
721 goto out_gunlock;
722 }
719 723
720 error = gfs2_quota_lock(ndip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 724 error = gfs2_quota_lock_check(ndip);
721 if (error) 725 if (error)
722 goto out_alloc; 726 goto out_alloc;
723 727
724 error = gfs2_quota_check(ndip, ndip->i_inode.i_uid, ndip->i_inode.i_gid);
725 if (error)
726 goto out_gunlock_q;
727
728 al->al_requested = sdp->sd_max_dirres; 728 al->al_requested = sdp->sd_max_dirres;
729 729
730 error = gfs2_inplace_reserve(ndip); 730 error = gfs2_inplace_reserve(ndip);
@@ -898,7 +898,7 @@ static int gfs2_permission(struct inode *inode, int mask, struct nameidata *nd)
898 int error; 898 int error;
899 int unlock = 0; 899 int unlock = 0;
900 900
901 if (gfs2_glock_is_locked_by_me(ip->i_gl) == 0) { 901 if (gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) {
902 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); 902 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
903 if (error) 903 if (error)
904 return error; 904 return error;
@@ -953,7 +953,8 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
953 if (!(attr->ia_valid & ATTR_GID) || ogid == ngid) 953 if (!(attr->ia_valid & ATTR_GID) || ogid == ngid)
954 ogid = ngid = NO_QUOTA_CHANGE; 954 ogid = ngid = NO_QUOTA_CHANGE;
955 955
956 gfs2_alloc_get(ip); 956 if (!gfs2_alloc_get(ip))
957 return -ENOMEM;
957 958
958 error = gfs2_quota_lock(ip, nuid, ngid); 959 error = gfs2_quota_lock(ip, nuid, ngid);
959 if (error) 960 if (error)
@@ -981,8 +982,9 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
981 brelse(dibh); 982 brelse(dibh);
982 983
983 if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) { 984 if (ouid != NO_QUOTA_CHANGE || ogid != NO_QUOTA_CHANGE) {
984 gfs2_quota_change(ip, -ip->i_di.di_blocks, ouid, ogid); 985 u64 blocks = gfs2_get_inode_blocks(&ip->i_inode);
985 gfs2_quota_change(ip, ip->i_di.di_blocks, nuid, ngid); 986 gfs2_quota_change(ip, -blocks, ouid, ogid);
987 gfs2_quota_change(ip, blocks, nuid, ngid);
986 } 988 }
987 989
988out_end_trans: 990out_end_trans:
@@ -1064,7 +1066,7 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
1064 int error; 1066 int error;
1065 int unlock = 0; 1067 int unlock = 0;
1066 1068
1067 if (gfs2_glock_is_locked_by_me(ip->i_gl) == 0) { 1069 if (gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) {
1068 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh); 1070 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
1069 if (error) 1071 if (error)
1070 return error; 1072 return error;
@@ -1148,16 +1150,6 @@ const struct inode_operations gfs2_file_iops = {
1148 .removexattr = gfs2_removexattr, 1150 .removexattr = gfs2_removexattr,
1149}; 1151};
1150 1152
1151const struct inode_operations gfs2_dev_iops = {
1152 .permission = gfs2_permission,
1153 .setattr = gfs2_setattr,
1154 .getattr = gfs2_getattr,
1155 .setxattr = gfs2_setxattr,
1156 .getxattr = gfs2_getxattr,
1157 .listxattr = gfs2_listxattr,
1158 .removexattr = gfs2_removexattr,
1159};
1160
1161const struct inode_operations gfs2_dir_iops = { 1153const struct inode_operations gfs2_dir_iops = {
1162 .create = gfs2_create, 1154 .create = gfs2_create,
1163 .lookup = gfs2_lookup, 1155 .lookup = gfs2_lookup,