* quota locking question
@ 2009-12-14 14:30 Dmitry Monakhov
2009-12-14 19:02 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Monakhov @ 2009-12-14 14:30 UTC (permalink / raw)
To: Jan Kara; +Cc: linux-fsdevel
According to dquot.c locking rules: dq_data_lock guards consistency
of dquot->dq_dqb with inode->i_blocks, i_bytes.
It is no clear to me what is the reason. Why do we need it ?
What use-case causes this requirement?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: quota locking question
2009-12-14 14:30 quota locking question Dmitry Monakhov
@ 2009-12-14 19:02 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2009-12-14 19:02 UTC (permalink / raw)
To: Dmitry Monakhov; +Cc: Jan Kara, linux-fsdevel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-14 19:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-14 14:30 quota locking question Dmitry Monakhov
2009-12-14 19:02 ` Jan Kara
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).