Commit 964edf66 authored by Jan Kara's avatar Jan Kara Committed by Theodore Ts'o

ext4: clear lockdep subtype for quota files on quota off

Quota files have special ranking of i_data_sem lock. We inform lockdep
about it when turning on quotas however when turning quotas off, we
don't clear the lockdep subclass from i_data_sem lock and thus when the
inode gets later reused for a normal file or directory, lockdep gets
confused and complains about possible deadlocks. Fix the problem by
resetting lockdep subclass of i_data_sem on quota off.

Cc: stable@vger.kernel.org
Fixes: daf647d2Reported-and-tested-by: default avatarRoss Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 08332893
...@@ -848,14 +848,9 @@ static inline void ext4_quota_off_umount(struct super_block *sb) ...@@ -848,14 +848,9 @@ static inline void ext4_quota_off_umount(struct super_block *sb)
{ {
int type; int type;
if (ext4_has_feature_quota(sb)) { /* Use our quota_off function to clear inode flags etc. */
dquot_disable(sb, -1, for (type = 0; type < EXT4_MAXQUOTAS; type++)
DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); ext4_quota_off(sb, type);
} else {
/* Use our quota_off function to clear inode flags etc. */
for (type = 0; type < EXT4_MAXQUOTAS; type++)
ext4_quota_off(sb, type);
}
} }
#else #else
static inline void ext4_quota_off_umount(struct super_block *sb) static inline void ext4_quota_off_umount(struct super_block *sb)
...@@ -5485,7 +5480,7 @@ static int ext4_quota_off(struct super_block *sb, int type) ...@@ -5485,7 +5480,7 @@ static int ext4_quota_off(struct super_block *sb, int type)
goto out; goto out;
err = dquot_quota_off(sb, type); err = dquot_quota_off(sb, type);
if (err) if (err || ext4_has_feature_quota(sb))
goto out_put; goto out_put;
inode_lock(inode); inode_lock(inode);
...@@ -5505,6 +5500,7 @@ static int ext4_quota_off(struct super_block *sb, int type) ...@@ -5505,6 +5500,7 @@ static int ext4_quota_off(struct super_block *sb, int type)
out_unlock: out_unlock:
inode_unlock(inode); inode_unlock(inode);
out_put: out_put:
lockdep_set_quota_inode(inode, I_DATA_SEM_NORMAL);
iput(inode); iput(inode);
return err; return err;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment