linux-stable/fs/quota
Jan Kara 4c6bb69663 quota: Fix quota corruption with generic/232 test
Eric has reported that since commit d2faa41516 "quota: Do not acquire
dqio_sem for dquot overwrites in v2 format" test generic/232
occasionally fails due to quota information being incorrect. Indeed that
commit was too eager to remove dqio_sem completely from the path that
just overwrites quota structure with updated information. Although that
is innocent on its own, another process that inserts new quota structure
to the same block can perform read-modify-write cycle of that block thus
effectively discarding quota information update if they race in a wrong
way.

Fix the problem by acquiring dqio_sem for reading for overwrites of
quota structure. Note that it *is* possible to completely avoid taking
dqio_sem in the overwrite path however that will require modifying path
inserting / deleting quota structures to avoid RMW cycles of the full
block and for now it is not clear whether it is worth the hassle.

Fixes: d2faa41516
Reported-and-tested-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
2017-09-27 11:33:47 +02:00
..
compat.c quota: split out compat_sys_quotactl support from quota.c 2010-03-05 00:20:25 +01:00
dquot.c quota: add missing lock into __dquot_transfer() 2017-09-18 12:23:58 +02:00
Kconfig rcu: Make SRCU optional by using CONFIG_SRCU 2015-01-06 11:04:29 -08:00
kqid.c fs/quota: kernel-doc warning fixes 2014-07-15 22:40:23 +02:00
Makefile userns: Implement struct kqid 2012-09-18 01:01:38 -07:00
netlink.c genetlink: mark families as __ro_after_init 2016-10-27 16:16:09 -04:00
quota.c VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb) 2017-07-17 08:45:34 +01:00
quota_tree.c quota: Reduce contention on dq_data_lock 2017-08-17 22:07:59 +02:00
quota_tree.h quota: Change quota error message to print out disk and function name 2010-07-21 16:05:58 +02:00
quota_v1.c quota: Fix possible corruption of dqi_flags 2017-08-17 22:00:04 +02:00
quota_v2.c quota: Fix quota corruption with generic/232 test 2017-09-27 11:33:47 +02:00
quotaio_v1.h
quotaio_v2.h vfs: Add general support to enforce project quota limits 2015-03-18 21:55:08 +01:00