From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Subject: Re: quota locking question
Date: Mon, 14 Dec 2009 20:02:19 +0100 [thread overview]
Message-ID: <20091214190219.GI4731@quack.suse.cz> (raw)
In-Reply-To: <87d42h1vc6.fsf@openvz.org>
Hi,
On Mon 14-12-09 17:30:49, Dmitry Monakhov wrote:
> According to dquot.c locking rules: dq_data_lock guards consistency
> of dquot->dq_dqb with inode->i_blocks, i_bytes.
Yes.
> It is no clear to me what is the reason. Why do we need it ?
> What use-case causes this requirement?
The clearliest reason is for example so that we are sure that dquot does
not change between we check limits and we update usage (generally that
dquot isn't updated concurrently by two processes).
The consistency between amount of space consumed by inode (as accounted
in i_blocks + i_bytes) and space consumed by user accounted in dquot is
another aspect. Currently, dqptr_sem assures that dquot_transfer() cannot
run in parallel to dquot_alloc_space() (and similar functions) and AFAICS
dquot_transfer() is the only function that relies on this consistency.
But this is mostly a side-effect of the way we do reference counting on
dquots and thus I feel it's better to have this consistency defined to
be guarded by dq_data_lock.
Honza
PS: Other locks (especially i_mutex) make some of the above races
impossible but quota code is written so that it's independent of
filesystem's locking...
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
prev parent reply other threads:[~2009-12-14 19:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-14 14:30 quota locking question Dmitry Monakhov
2009-12-14 19:02 ` 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=20091214190219.GI4731@quack.suse.cz \
--to=jack@suse.cz \
--cc=dmonakhov@openvz.org \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).