From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: missing inode_add_bytes in dquot_alloc_space Date: Fri, 16 Jan 2004 12:20:28 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20040116112028.GA28501@atrey.karlin.mff.cuni.cz> References: <1074097629.17479.66.camel@shaggy.austin.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="UlVJffcvxoiEqYs2" Cc: fsdevel Return-path: Received: from atrey.karlin.mff.cuni.cz ([195.113.31.123]:3255 "EHLO atrey.karlin.mff.cuni.cz") by vger.kernel.org with ESMTP id S265309AbUAPLUa (ORCPT ); Fri, 16 Jan 2004 06:20:30 -0500 To: Dave Kleikamp Content-Disposition: inline In-Reply-To: <1074097629.17479.66.camel@shaggy.austin.ibm.com> List-Id: linux-fsdevel.vger.kernel.org --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="quota-2.6.0-1-noqfix.diff" 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) { --UlVJffcvxoiEqYs2--