Skip to content

Commit 6a4e336

Browse files
committed
quota: Properly disable quotas when add_dquot_ref() fails
When add_dquot_ref() fails (usually due to IO error or ENOMEM), we want to disable quotas we are trying to enable. However dquot_disable() call was passed just the flags we are enabling so in case flags == DQUOT_USAGE_ENABLED dquot_disable() call will just fail with EINVAL instead of properly disabling quotas. Fix the problem by always passing DQUOT_LIMITS_ENABLED | DQUOT_USAGE_ENABLED to dquot_disable() in this case. Reported-and-tested-by: Ye Bin <[email protected]> Reported-by: [email protected] Signed-off-by: Jan Kara <[email protected]> Message-Id: <[email protected]>
1 parent aac2fa2 commit 6a4e336

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/quota/dquot.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2420,7 +2420,8 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
24202420

24212421
error = add_dquot_ref(sb, type);
24222422
if (error)
2423-
dquot_disable(sb, type, flags);
2423+
dquot_disable(sb, type,
2424+
DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
24242425

24252426
return error;
24262427
out_fmt:

0 commit comments

Comments
 (0)