mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel@redhat.com, linux-kernel@vger.kernel.org
Cc: Abhijith Das <adas@redhat.com>, Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 07/15] GFS2: quota allows exceeding hard limit
Date: Tue, 15 Mar 2011 09:11:37 +0000	[thread overview]
Message-ID: <1300180305-5993-8-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1300180305-5993-1-git-send-email-swhiteho@redhat.com>

From: Abhijith Das <adas@redhat.com>

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>

diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 720c1e6..59aaaa0 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -317,6 +317,7 @@ enum {
 	QDF_USER		= 0,
 	QDF_CHANGE		= 1,
 	QDF_LOCKED		= 2,
+	QDF_REFRESH		= 3,
 };
 
 struct gfs2_quota_data {
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 6ec964c..e23d986 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)
 			goto out_end_trans;
 
 		do_qc(qd, -qd->qd_change_sync);
+		set_bit(QDF_REFRESH, &qd->qd_flags);
 	}
 
 	error = 0;
@@ -929,6 +930,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid)
 {
 	struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
 	struct gfs2_alloc *al = ip->i_alloc;
+	struct gfs2_quota_data *qd;
 	unsigned int x;
 	int error = 0;
 
@@ -942,7 +944,11 @@ int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid)
 	     sort_qd, NULL);
 
 	for (x = 0; x < al->al_qd_num; x++) {
-		error = do_glock(al->al_qd[x], NO_FORCE, &al->al_qd_ghs[x]);
+		int force = NO_FORCE;
+		qd = al->al_qd[x];
+		if (test_and_clear_bit(QDF_REFRESH, &qd->qd_flags))
+			force = FORCE;
+		error = do_glock(qd, force, &al->al_qd_ghs[x]);
 		if (error)
 			break;
 	}
-- 
1.7.4


  parent reply	other threads:[~2011-03-15  9:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-15  9:11 GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2011-03-15  9:11 ` [PATCH 01/15] GFS2: Use RCU for glock hash table Steven Whitehouse
2011-03-15  9:11 ` [PATCH 02/15] GFS2: Post-VFS scale update for RCU path walk Steven Whitehouse
2011-03-15  9:11 ` [PATCH 03/15] GFS2: Fix glock queue trace point Steven Whitehouse
2011-03-15  9:11 ` [PATCH 04/15] GFS2: Improve cluster mmap scalability Steven Whitehouse
2011-03-15  9:11 ` [PATCH 05/15] GFS2: panics on quotacheck update Steven Whitehouse
2011-03-15  9:11 ` [PATCH 06/15] GFS2: deallocation performance patch Steven Whitehouse
2011-03-15  9:11 ` Steven Whitehouse [this message]
2011-03-15  9:11 ` [PATCH 08/15] GFS2: Fix glock deallocation race Steven Whitehouse
2011-03-15  9:11 ` [PATCH 09/15] GFS2: Remove potential race in flock code Steven Whitehouse
2011-03-15  9:11 ` [PATCH 10/15] GFS2: Optimize glock multiple-dequeue code Steven Whitehouse
2011-03-15  9:11 ` [PATCH 11/15] GFS2: fix block allocation check for fallocate Steven Whitehouse
2011-03-15  9:11 ` [PATCH 12/15] GFS2: introduce AIL lock Steven Whitehouse
2011-03-15  9:11 ` [PATCH 13/15] GFS2: Update to AIL list locking Steven Whitehouse
2011-03-15  9:11 ` [PATCH 14/15] GFS2: Adding missing unlock_page() Steven Whitehouse
2011-03-15  9:11 ` [PATCH 15/15] GFS2: Don't use _raw version of RCU dereference Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300180305-5993-8-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    --cc=adas@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®