diff options
author | Abhijith Das <adas@redhat.com> | 2011-03-08 10:40:42 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-03-09 04:32:44 -0500 |
commit | 662e3a551b468c7338f5291d7a00389fe85885e2 (patch) | |
tree | 4e4939e0c1f1f5ce66541982476e68f24f83221b /fs/gfs2/quota.c | |
parent | 4c16c36ad62fff8485215bd803d778eb2bd0b8bd (diff) |
GFS2: quota allows exceeding hard limit
Immediately after being synced to disk, cached quotas are zeroed out and a
subsequent access of the cached quotas results in incorrect zero values. This
meant that gfs2 assumed the actual usage to be the zero (or near-zero) usage
values it found in the cached quotas and comparison against warn/limits never
triggered a quota violation.
This patch adds a new flag QDF_REFRESH that is set after a sync so that the
cached quotas are forcefully refreshed from disk on a subsequent access on
seeing this flag set.
Resolves: rhbz#675944
Signed-off-by: Abhi Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r-- | fs/gfs2/quota.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 6ec964c31dc6..e23d9864c418 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -834,6 +834,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) | |||
834 | goto out_end_trans; | 834 | goto out_end_trans; |
835 | 835 | ||
836 | do_qc(qd, -qd->qd_change_sync); | 836 | do_qc(qd, -qd->qd_change_sync); |
837 | set_bit(QDF_REFRESH, &qd->qd_flags); | ||
837 | } | 838 | } |
838 | 839 | ||
839 | error = 0; | 840 | error = 0; |
@@ -929,6 +930,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid) | |||
929 | { | 930 | { |
930 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 931 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
931 | struct gfs2_alloc *al = ip->i_alloc; | 932 | struct gfs2_alloc *al = ip->i_alloc; |
933 | struct gfs2_quota_data *qd; | ||
932 | unsigned int x; | 934 | unsigned int x; |
933 | int error = 0; | 935 | int error = 0; |
934 | 936 | ||
@@ -942,7 +944,11 @@ int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid) | |||
942 | sort_qd, NULL); | 944 | sort_qd, NULL); |
943 | 945 | ||
944 | for (x = 0; x < al->al_qd_num; x++) { | 946 | for (x = 0; x < al->al_qd_num; x++) { |
945 | error = do_glock(al->al_qd[x], NO_FORCE, &al->al_qd_ghs[x]); | 947 | int force = NO_FORCE; |
948 | qd = al->al_qd[x]; | ||
949 | if (test_and_clear_bit(QDF_REFRESH, &qd->qd_flags)) | ||
950 | force = FORCE; | ||
951 | error = do_glock(qd, force, &al->al_qd_ghs[x]); | ||
946 | if (error) | 952 | if (error) |
947 | break; | 953 | break; |
948 | } | 954 | } |