summaryrefslogtreecommitdiff
path: root/fs/ocfs2/quota_local.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-06-02 16:24:01 +0400
committerJoel Becker <joel.becker@oracle.com>2009-06-04 06:14:29 +0400
commit65bac575e35915801ea518b9d8d8824367d125c8 (patch)
treebce57755cf8b9f783cdab046ea519c0e41f595e1 /fs/ocfs2/quota_local.c
parentb4c30de39a2596503e888a7b47d19792f25913d6 (diff)
downloadlinux-65bac575e35915801ea518b9d8d8824367d125c8.tar.xz
ocfs2: Fix possible deadlock with quotas in ocfs2_setattr()
We called vfs_dq_transfer() with global quota file lock held. This can lead to deadlocks as if vfs_dq_transfer() has to allocate new quota structure, it calls ocfs2_dquot_acquire() which tries to get quota file lock again and this can block if another node requested the lock in the mean time. Since we have to call vfs_dq_transfer() with transaction already started and quota file lock ranks above the transaction start, we cannot just rely on ocfs2_dquot_acquire() or ocfs2_dquot_release() on getting the lock if they need it. We fix the problem by acquiring pointers to all quota structures needed by vfs_dq_transfer() already before calling the function. By this we are sure that all quota structures are properly allocated and they can be freed only after we drop references to them. Thus we don't need quota file lock anywhere inside vfs_dq_transfer(). Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/quota_local.c')
0 files changed, 0 insertions, 0 deletions