diff options
author | Jan Kara <jack@suse.cz> | 2012-04-24 11:08:41 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-05-15 17:34:37 -0400 |
commit | d7e9711760a17aef3a94fc6dff4759fa5961de25 (patch) | |
tree | 260d71f39f9d876347e53d44467e536e4c09ea90 /fs/quota | |
parent | fd2cbd4dfa3db477dd6226d387d3f1911d36a6a9 (diff) |
quota: Fix double lock in add_dquot_ref() with CONFIG_QUOTA_DEBUG
When CONFIG_QUOTA_DEBUG is enabled we call inode_get_rsv_space() from
add_dquot_ref() while holding i_lock. But inode_get_rsv_space() is trying
to get i_lock as well resulting in double lock.
Fix the problem by moving inode_get_rsv_space() call out of i_lock.
Reported-and-analyzed-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota')
-rw-r--r-- | fs/quota/dquot.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index d69a1d1d7e15..0dcdda305c99 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -907,14 +907,14 @@ static void add_dquot_ref(struct super_block *sb, int type) | |||
907 | spin_unlock(&inode->i_lock); | 907 | spin_unlock(&inode->i_lock); |
908 | continue; | 908 | continue; |
909 | } | 909 | } |
910 | #ifdef CONFIG_QUOTA_DEBUG | ||
911 | if (unlikely(inode_get_rsv_space(inode) > 0)) | ||
912 | reserved = 1; | ||
913 | #endif | ||
914 | __iget(inode); | 910 | __iget(inode); |
915 | spin_unlock(&inode->i_lock); | 911 | spin_unlock(&inode->i_lock); |
916 | spin_unlock(&inode_sb_list_lock); | 912 | spin_unlock(&inode_sb_list_lock); |
917 | 913 | ||
914 | #ifdef CONFIG_QUOTA_DEBUG | ||
915 | if (unlikely(inode_get_rsv_space(inode) > 0)) | ||
916 | reserved = 1; | ||
917 | #endif | ||
918 | iput(old_inode); | 918 | iput(old_inode); |
919 | __dquot_initialize(inode, type); | 919 | __dquot_initialize(inode, type); |
920 | 920 | ||