From: Jan Kara <jack@suse.cz>
To: linux-kernel@vger.kernel.org, Alex Lyashkov <shadow@itt.net.ru>
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>,
Herbert Poetzl <herbert@13thfloor.at>
Subject: Re: Linux 2.4 quota (accounting?) bug ...
Date: Wed, 5 Nov 2003 21:36:33 +0100 [thread overview]
Message-ID: <20031105203633.GD9697@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <20031025174225.GB24020@DUK2.13thfloor.at>
Hi,
> On Sat, Oct 25, 2003 at 06:31:28PM +0200, Jan Kara wrote:
> > Hi,
> >
> > > a friend of mine, made me aware of the following
> > > imbalance, which looks like a minor accounting bug
> > > to me, but might be a quota bug ...
> > Sorry but the code seems correct to me - we get reference to dquot by
> > get_dquot_ref() and than we put the reference by dqput(). dqput() is
> > correct because something nasty might happen in the mean time and so we
> > might be the last holders of the dquot. What do you think is wrong?
>
> dqput() does dqstats.drops++;
> which isn't correct if this should be the same as
> put_dquot_ref(), but maybe I'm just irritated by
> strange statistics on some kernels showing more
> drops than lookups+allocated after sync/quotaoff
So I finally got to fixing the bug. The patch (also with a deletition
of unnecessary variable) is attached. Marcello please apply.
Honza
---------------------cut here-------------------------------------------
diff -ruX ../kerndiffexclude linux-2.4.22-um/fs/dquot.c linux-2.4.22-fixstat/fs/dquot.c
--- linux-2.4.22-um/fs/dquot.c Mon Aug 25 13:44:43 2003
+++ linux-2.4.22-fixstat/fs/dquot.c Wed Nov 5 21:21:58 2003
@@ -392,6 +392,7 @@
* is enough since if dquot is locked/modified it can't be
* on the free list */
get_dquot_ref(dquot);
+ dqstats.lookups++;
if (dquot->dq_flags & DQ_LOCKED)
wait_on_dquot(dquot);
if (dquot_dirty(dquot))
@@ -622,7 +623,6 @@
dqput(dquot);
return NODQUOT;
}
- ++dquot->dq_referenced;
dqstats.lookups++;
return dquot;
@@ -642,7 +642,6 @@
if (dquot->dq_flags & DQ_LOCKED)
printk(KERN_ERR "VFS: dqduplicate(): Locked quota to be duplicated!\n");
get_dquot_dup_ref(dquot);
- dquot->dq_referenced++;
dqstats.lookups++;
return dquot;
Only in linux-2.4.22-fixstat/include/linux: modules
diff -ruX ../kerndiffexclude linux-2.4.22-um/include/linux/quota.h linux-2.4.22-fixstat/include/linux/quota.h
--- linux-2.4.22-um/include/linux/quota.h Mon Aug 25 13:44:44 2003
+++ linux-2.4.22-fixstat/include/linux/quota.h Wed Nov 5 21:27:44 2003
@@ -222,8 +222,6 @@
loff_t dq_off; /* Offset of dquot on disk */
short dq_type; /* Type of quota */
short dq_flags; /* See DQ_* */
- unsigned long dq_referenced; /* Number of times this dquot was
- referenced during its lifetime */
struct mem_dqblk dq_dqb; /* Diskquota usage */
};
prev parent reply other threads:[~2003-11-05 20:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-25 16:26 Linux 2.4 quota (accounting?) bug Herbert Poetzl
2003-10-25 16:31 ` Jan Kara
2003-10-25 17:42 ` Herbert Poetzl
2003-10-28 23:40 ` Jan Kara
2003-11-05 20:36 ` Jan Kara [this message]
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=20031105203633.GD9697@atrey.karlin.mff.cuni.cz \
--to=jack@suse.cz \
--cc=herbert@13thfloor.at \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=shadow@itt.net.ru \
/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).