diff options
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index a9ba2444e077..2a1b4b5a648c 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -667,6 +667,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
667 | if (!name->len || name->len > GFS2_FNAMESIZE) | 667 | if (!name->len || name->len > GFS2_FNAMESIZE) |
668 | return -ENAMETOOLONG; | 668 | return -ENAMETOOLONG; |
669 | 669 | ||
670 | error = gfs2_rs_alloc(dip); | ||
671 | if (error) | ||
672 | return error; | ||
673 | |||
670 | error = gfs2_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); | 674 | error = gfs2_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); |
671 | if (error) | 675 | if (error) |
672 | goto fail; | 676 | goto fail; |
@@ -704,6 +708,11 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
704 | if (error) | 708 | if (error) |
705 | goto fail_gunlock2; | 709 | goto fail_gunlock2; |
706 | 710 | ||
711 | /* the new inode needs a reservation so it can allocate xattrs. */ | ||
712 | error = gfs2_rs_alloc(GFS2_I(inode)); | ||
713 | if (error) | ||
714 | goto fail_gunlock2; | ||
715 | |||
707 | error = gfs2_acl_create(dip, inode); | 716 | error = gfs2_acl_create(dip, inode); |
708 | if (error) | 717 | if (error) |
709 | goto fail_gunlock2; | 718 | goto fail_gunlock2; |
@@ -722,7 +731,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
722 | gfs2_trans_end(sdp); | 731 | gfs2_trans_end(sdp); |
723 | /* Check if we reserved space in the rgrp. Function link_dinode may | 732 | /* Check if we reserved space in the rgrp. Function link_dinode may |
724 | not, depending on whether alloc is required. */ | 733 | not, depending on whether alloc is required. */ |
725 | if (dip->i_res) | 734 | if (gfs2_mb_reserved(dip)) |
726 | gfs2_inplace_release(dip); | 735 | gfs2_inplace_release(dip); |
727 | gfs2_quota_unlock(dip); | 736 | gfs2_quota_unlock(dip); |
728 | gfs2_qadata_put(dip); | 737 | gfs2_qadata_put(dip); |
@@ -819,6 +828,10 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, | |||
819 | if (S_ISDIR(inode->i_mode)) | 828 | if (S_ISDIR(inode->i_mode)) |
820 | return -EPERM; | 829 | return -EPERM; |
821 | 830 | ||
831 | error = gfs2_rs_alloc(dip); | ||
832 | if (error) | ||
833 | return error; | ||
834 | |||
822 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); | 835 | gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); |
823 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); | 836 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); |
824 | 837 | ||
@@ -1234,6 +1247,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
1234 | if (error) | 1247 | if (error) |
1235 | return error; | 1248 | return error; |
1236 | 1249 | ||
1250 | error = gfs2_rs_alloc(ndip); | ||
1251 | if (error) | ||
1252 | return error; | ||
1253 | |||
1237 | if (odip != ndip) { | 1254 | if (odip != ndip) { |
1238 | error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE, | 1255 | error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE, |
1239 | 0, &r_gh); | 1256 | 0, &r_gh); |
@@ -1644,6 +1661,10 @@ static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1644 | struct gfs2_holder i_gh; | 1661 | struct gfs2_holder i_gh; |
1645 | int error; | 1662 | int error; |
1646 | 1663 | ||
1664 | error = gfs2_rs_alloc(ip); | ||
1665 | if (error) | ||
1666 | return error; | ||
1667 | |||
1647 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); | 1668 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh); |
1648 | if (error) | 1669 | if (error) |
1649 | return error; | 1670 | return error; |