Re: quota locking question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  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@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux