1 ext4: clear lockdep subtype for quota files on quota off
3 From: Jan Kara <jack@suse.cz>
5 Quota files have special ranking of i_data_sem lock. We inform lockdep
6 about it when turning on quotas however when turning quotas off, we
7 don't clear the lockdep subclass from i_data_sem lock and thus when the
8 inode gets later reused for a normal file or directory, lockdep gets
9 confused and complains about possible deadlocks. Fix the problem by
10 resetting lockdep subclass of i_data_sem on quota off.
12 Cc: stable@vger.kernel.org
13 Fixes: daf647d2dd58cec59570d7698a45b98e580f2076
14 Reported-and-tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>
15 Reviewed-by: Andreas Dilger <adilger@dilger.ca>
16 Signed-off-by: Jan Kara <jack@suse.cz>
17 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
19 fs/ext4/super.c | 14 +++++---------
20 1 file changed, 5 insertions(+), 9 deletions(-)
22 Changes since v1: Updated tags.
24 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
25 index a9c72e39a4ee..77043dc7f704 100644
28 @@ -846,14 +846,9 @@ static inline void ext4_quota_off_umount(struct super_block *sb)
32 - if (ext4_has_feature_quota(sb)) {
33 - dquot_disable(sb, -1,
34 - DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
36 - /* Use our quota_off function to clear inode flags etc. */
37 - for (type = 0; type < EXT4_MAXQUOTAS; type++)
38 - ext4_quota_off(sb, type);
40 + /* Use our quota_off function to clear inode flags etc. */
41 + for (type = 0; type < EXT4_MAXQUOTAS; type++)
42 + ext4_quota_off(sb, type);
45 static inline void ext4_quota_off_umount(struct super_block *sb)
46 @@ -5476,7 +5471,7 @@ static int ext4_quota_off(struct super_block *sb, int type)
49 err = dquot_quota_off(sb, type);
51 + if (err || ext4_has_feature_quota(sb))
55 @@ -5496,6 +5491,7 @@ static int ext4_quota_off(struct super_block *sb, int type)
59 + lockdep_set_quota_inode(inode, I_DATA_SEM_NORMAL);