linux/fs/quota
Jan Kara dcdbed853d quota: Fix deadlock with suspend and quotas
This script causes a kernel deadlock:
set -e
DEVICE=/dev/vg1/linear
lvchange -ay $DEVICE
mkfs.ext3 $DEVICE
mount -t ext3 -o usrquota,grpquota $DEVICE /mnt/test
quotacheck -gu /mnt/test
umount /mnt/test
mount -t ext3 -o usrquota,grpquota $DEVICE /mnt/test
quotaon /mnt/test
dmsetup suspend $DEVICE
setquota -u root 1 2 3 4 /mnt/test &
sleep 1
dmsetup resume $DEVICE

setquota acquired semaphore s_umount for read and then tried to perform a
transaction (and waits because the device is suspended).  dmsetup resume tries
to acquire s_umount for write before resuming the device (and waits for
setquota).

Fix the deadlock by grabbing a thawed superblock for quota commands which need
it.

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-02-13 20:45:39 -05:00
..
compat.c quota: split out compat_sys_quotactl support from quota.c 2010-03-05 00:20:25 +01:00
dquot.c quota: Pass information that quota is stored in system file to userspace 2012-01-12 13:09:09 +01:00
Kconfig quota: Make QUOTACTL config be selected by its users 2010-10-05 12:16:37 +02:00
Makefile quota: split out compat_sys_quotactl support from quota.c 2010-03-05 00:20:25 +01:00
netlink.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
quota.c quota: Fix deadlock with suspend and quotas 2012-02-13 20:45:39 -05:00
quota_tree.c quota: Use %pV and __attribute__((format (printf in __quota_error and fix fallout 2011-01-10 19:04:05 +01: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: Change quota error message to print out disk and function name 2010-07-21 16:05:58 +02:00
quota_v2.c quota: return -ENOMEM when memory allocation fails 2011-02-24 11:42:44 +01:00
quotaio_v1.h
quotaio_v2.h quota: Implement quota format with 64-bit space and inode limits 2009-12-10 15:02:54 +01:00