linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dave Kleikamp <shaggy@austin.ibm.com>
Cc: fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: missing inode_add_bytes in dquot_alloc_space
Date: Fri, 16 Jan 2004 12:20:28 +0100	[thread overview]
Message-ID: <20040116112028.GA28501@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <1074097629.17479.66.camel@shaggy.austin.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 396 bytes --]

  Hi,

> I don't think it was intentional, but in dquot_alloc_space, if
> IS_NOQUOTA(inode) is true, then i_blocks doesn't get updated.  This
> patch would fix it to do what I believe it should.  Is this right, or am
> I missing something?
  Here's the patch which should fix all the functions which had
problems. Patch applies against 2.6.1 well too. I'll also send it so
Linus..

								Honza

[-- Attachment #2: quota-2.6.0-1-noqfix.diff --]
[-- Type: text/plain, Size: 1739 bytes --]

diff -ruX ../kerndiffexclude linux-2.6.0-test11-um/fs/dquot.c linux-2.6.0-test11-um-1-noqfix/fs/dquot.c
--- linux-2.6.0/fs/dquot.c	Mon Dec  1 12:31:28 2003
+++ linux-2.6.0-1-noqfix/fs/dquot.c	Fri Jan 16 10:10:25 2004
@@ -884,11 +884,9 @@
 		warntype[cnt] = NOWARN;
 
 	down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
-	if (IS_NOQUOTA(inode)) {
-		up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
-		return QUOTA_OK;
-	}
 	spin_lock(&dq_data_lock);
+	if (IS_NOQUOTA(inode))
+		goto add_bytes;
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
 		if (inode->i_dquot[cnt] == NODQUOT)
 			continue;
@@ -900,6 +898,7 @@
 			continue;
 		dquot_incr_space(inode->i_dquot[cnt], number);
 	}
+add_bytes:
 	inode_add_bytes(inode, number);
 	ret = QUOTA_OK;
 warn_put_all:
@@ -953,16 +952,15 @@
 	unsigned int cnt;
 
 	down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
-	if (IS_NOQUOTA(inode)) {
-		up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
-		return;
-	}
 	spin_lock(&dq_data_lock);
+	if (IS_NOQUOTA(inode))
+		goto sub_bytes;
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
 		if (inode->i_dquot[cnt] == NODQUOT)
 			continue;
 		dquot_decr_space(inode->i_dquot[cnt], number);
 	}
+sub_bytes:
 	inode_sub_bytes(inode, number);
 	spin_unlock(&dq_data_lock);
 	up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
@@ -1010,8 +1008,10 @@
 		warntype[cnt] = NOWARN;
 	}
 	down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
-	if (IS_NOQUOTA(inode))	/* File without quota accounting? */
-		goto warn_put_all;
+	if (IS_NOQUOTA(inode)) {	/* File without quota accounting? */
+		up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
+		return QUOTA_OK;
+	}
 	/* First build the transfer_to list - here we can block on reading of dquots... */
 	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
 		switch (cnt) {

  parent reply	other threads:[~2004-01-16 11:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-14 16:27 missing inode_add_bytes in dquot_alloc_space Dave Kleikamp
2004-01-15  8:43 ` Jan Kara
2004-01-16 11:20 ` Jan Kara [this message]
2004-01-16 12:19   ` Christoph Hellwig
2004-01-16 13:33     ` Jan Kara
2004-01-16 13:57       ` Christoph Hellwig
2004-01-16 13:37     ` Dave Kleikamp

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=20040116112028.GA28501@atrey.karlin.mff.cuni.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=shaggy@austin.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).