aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/bmap.c5
-rw-r--r--fs/gfs2/dir.c10
-rw-r--r--fs/gfs2/eattr.c6
-rw-r--r--fs/gfs2/inode.c7
-rw-r--r--fs/gfs2/ops_address.c4
-rw-r--r--fs/gfs2/ops_inode.c11
-rw-r--r--fs/gfs2/quota.c9
7 files changed, 44 insertions, 8 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index c1ee6355ced1..f7093aa69aae 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -900,6 +900,8 @@ static int do_grow(struct gfs2_inode *ip, u64 size)
900 int error; 900 int error;
901 901
902 al = gfs2_alloc_get(ip); 902 al = gfs2_alloc_get(ip);
903 if (!al)
904 return -ENOMEM;
903 905
904 error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 906 error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
905 if (error) 907 if (error)
@@ -1081,7 +1083,8 @@ static int trunc_dealloc(struct gfs2_inode *ip, u64 size)
1081 lblock = (size - 1) >> sdp->sd_sb.sb_bsize_shift; 1083 lblock = (size - 1) >> sdp->sd_sb.sb_bsize_shift;
1082 1084
1083 find_metapath(sdp, lblock, &mp, ip->i_height); 1085 find_metapath(sdp, lblock, &mp, ip->i_height);
1084 gfs2_alloc_get(ip); 1086 if (!gfs2_alloc_get(ip))
1087 return -ENOMEM;
1085 1088
1086 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 1089 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
1087 if (error) 1090 if (error)
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index a3753c7989f7..94070ad8826b 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1868,11 +1868,14 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
1868 if (!ht) 1868 if (!ht)
1869 return -ENOMEM; 1869 return -ENOMEM;
1870 1870
1871 gfs2_alloc_get(dip); 1871 if (!gfs2_alloc_get(dip)) {
1872 error = -ENOMEM;
1873 goto out;
1874 }
1872 1875
1873 error = gfs2_quota_hold(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 1876 error = gfs2_quota_hold(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
1874 if (error) 1877 if (error)
1875 goto out; 1878 goto out_put;
1876 1879
1877 error = gfs2_rindex_hold(sdp, &dip->i_alloc->al_ri_gh); 1880 error = gfs2_rindex_hold(sdp, &dip->i_alloc->al_ri_gh);
1878 if (error) 1881 if (error)
@@ -1946,8 +1949,9 @@ out_rlist:
1946 gfs2_glock_dq_uninit(&dip->i_alloc->al_ri_gh); 1949 gfs2_glock_dq_uninit(&dip->i_alloc->al_ri_gh);
1947out_qs: 1950out_qs:
1948 gfs2_quota_unhold(dip); 1951 gfs2_quota_unhold(dip);
1949out: 1952out_put:
1950 gfs2_alloc_put(dip); 1953 gfs2_alloc_put(dip);
1954out:
1951 kfree(ht); 1955 kfree(ht);
1952 return error; 1956 return error;
1953} 1957}
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index 76ead1acfcc7..288d5e6ad93a 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -318,6 +318,8 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
318 int error; 318 int error;
319 319
320 al = gfs2_alloc_get(ip); 320 al = gfs2_alloc_get(ip);
321 if (!al)
322 return -ENOMEM;
321 323
322 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 324 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
323 if (error) 325 if (error)
@@ -681,6 +683,8 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
681 int error; 683 int error;
682 684
683 al = gfs2_alloc_get(ip); 685 al = gfs2_alloc_get(ip);
686 if (!al)
687 return -ENOMEM;
684 688
685 error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 689 error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
686 if (error) 690 if (error)
@@ -1464,6 +1468,8 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip)
1464 int error; 1468 int error;
1465 1469
1466 al = gfs2_alloc_get(ip); 1470 al = gfs2_alloc_get(ip);
1471 if (!al)
1472 return -ENOMEM;
1467 1473
1468 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 1474 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
1469 if (error) 1475 if (error)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 92ea9afacb17..dcae2aa83f13 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -351,6 +351,8 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip)
351 } 351 }
352 352
353 al = gfs2_alloc_get(ip); 353 al = gfs2_alloc_get(ip);
354 if (!al)
355 return -ENOMEM;
354 356
355 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 357 error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
356 if (error) 358 if (error)
@@ -825,7 +827,8 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
825 int error; 827 int error;
826 828
827 munge_mode_uid_gid(dip, &mode, &uid, &gid); 829 munge_mode_uid_gid(dip, &mode, &uid, &gid);
828 gfs2_alloc_get(dip); 830 if (!gfs2_alloc_get(dip))
831 return -ENOMEM;
829 832
830 error = gfs2_quota_lock(dip, uid, gid); 833 error = gfs2_quota_lock(dip, uid, gid);
831 if (error) 834 if (error)
@@ -860,6 +863,8 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
860 int error; 863 int error;
861 864
862 al = gfs2_alloc_get(dip); 865 al = gfs2_alloc_get(dip);
866 if (!al)
867 return -ENOMEM;
863 868
864 error = gfs2_quota_lock(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 869 error = gfs2_quota_lock(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
865 if (error) 870 if (error)
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index fbb4a6aa1583..2483d8741060 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -649,6 +649,10 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
649 649
650 if (alloc_required) { 650 if (alloc_required) {
651 al = gfs2_alloc_get(ip); 651 al = gfs2_alloc_get(ip);
652 if (!al) {
653 error = -ENOMEM;
654 goto out_unlock;
655 }
652 656
653 error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 657 error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
654 if (error) 658 if (error)
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 6cbbb5b46ce4..34fe571e15ee 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -200,6 +200,10 @@ 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(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
205 if (error) 209 if (error)
@@ -716,6 +720,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
716 720
717 if (alloc_required) { 721 if (alloc_required) {
718 struct gfs2_alloc *al = gfs2_alloc_get(ndip); 722 struct gfs2_alloc *al = gfs2_alloc_get(ndip);
723 if (!al) {
724 error = -ENOMEM;
725 goto out_gunlock;
726 }
719 727
720 error = gfs2_quota_lock(ndip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); 728 error = gfs2_quota_lock(ndip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE);
721 if (error) 729 if (error)
@@ -953,7 +961,8 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
953 if (!(attr->ia_valid & ATTR_GID) || ogid == ngid) 961 if (!(attr->ia_valid & ATTR_GID) || ogid == ngid)
954 ogid = ngid = NO_QUOTA_CHANGE; 962 ogid = ngid = NO_QUOTA_CHANGE;
955 963
956 gfs2_alloc_get(ip); 964 if (!gfs2_alloc_get(ip))
965 return -ENOMEM;
957 966
958 error = gfs2_quota_lock(ip, nuid, ngid); 967 error = gfs2_quota_lock(ip, nuid, ngid);
959 if (error) 968 if (error)
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index a08dabd6ce90..636bccfd2bcf 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -617,8 +617,9 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
617 int err = -EIO; 617 int err = -EIO;
618 618
619 if (gfs2_is_stuffed(ip)) { 619 if (gfs2_is_stuffed(ip)) {
620 struct gfs2_alloc *al = NULL; 620 struct gfs2_alloc *al = gfs2_alloc_get(ip);
621 al = gfs2_alloc_get(ip); 621 if (!al)
622 return -ENOMEM;
622 /* just request 1 blk */ 623 /* just request 1 blk */
623 al->al_requested = 1; 624 al->al_requested = 1;
624 gfs2_inplace_reserve(ip); 625 gfs2_inplace_reserve(ip);
@@ -729,6 +730,10 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
729 730
730 if (nalloc) { 731 if (nalloc) {
731 al = gfs2_alloc_get(ip); 732 al = gfs2_alloc_get(ip);
733 if (!al) {
734 error = -ENOMEM;
735 goto out_gunlock;
736 }
732 737
733 al->al_requested = nalloc * (data_blocks + ind_blocks); 738 al->al_requested = nalloc * (data_blocks + ind_blocks);
734 739