linux/fs/quota
Jiaying Zhang d01730d74d quota: Fix possible deadlock during parallel quotaon and quotaoff
The following test script triggers a deadlock on ext2 filesystem:
while true; do quotaon /dev/hda >&/dev/null; usleep $RANDOM; done &
while true; do quotaoff /dev/hda >&/dev/null; usleep $RANDOM; done &

I found there is a potential deadlock between quotaon and quotaoff (or
quotasync). Basically, all of quotactl operations need to be protected by
dqonoff_mutex. vfs_quota_off and vfs_quota_sync also call sb->s_op->quota_write
that needs to grab the i_mutex of the quota file.  But in vfs_quota_on_inode
(called from quotaon operation), the current code tries to grab  the i_mutex of
the quota file first before getting quonoff_mutex.

Reverse the order in which we take locks in vfs_quota_on_inode().

Jan Kara: Changed changelog to be more readable, made lockdep happy with
  I_MUTEX_QUOTA.

Signed-off-by: Jiaying Zhang <jiayingz@google.com>
Signed-off-by: Jan Kara <jack@suse.cz>
2009-07-07 18:15:21 +02:00
..
Kconfig trivial: fix typos/grammar errors in fs/Kconfig 2009-03-26 02:18:38 +01:00
Makefile quota: remove obsolete comments in fs/quota/Makefile 2009-04-27 16:49:52 +02:00
dquot.c quota: Fix possible deadlock during parallel quotaon and quotaoff 2009-07-07 18:15:21 +02:00
quota.c quota: cleanup dquota sync functions (version 4) 2009-06-11 21:36:04 -04:00
quota_tree.c quota: Coding style fixes 2009-03-26 02:18:38 +01:00
quota_tree.h
quota_v1.c quota: Coding style fixes 2009-03-26 02:18:38 +01:00
quota_v2.c quota: Coding style fixes 2009-03-26 02:18:38 +01:00
quotaio_v1.h
quotaio_v2.h