Skip to content

Commit 3206e7d

Browse files
committed
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull quota fix from Jan Kara: "A fix for a regression in handling of quota grace times and warnings" * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: quota: Generate warnings for DQUOT_SPACE_NOFAIL allocations
2 parents cbaff87 + ac3d793 commit 3206e7d

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

‎fs/quota/dquot.c‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,21 +1297,18 @@ static int dquot_add_space(struct dquot *dquot, qsize_t space,
12971297
spin_lock(&dquot->dq_dqb_lock);
12981298
if (!sb_has_quota_limits_enabled(sb, dquot->dq_id.type) ||
12991299
test_bit(DQ_FAKE_B, &dquot->dq_flags))
1300-
goto add;
1300+
goto finish;
13011301

13021302
tspace = dquot->dq_dqb.dqb_curspace + dquot->dq_dqb.dqb_rsvspace
13031303
+ space + rsv_space;
13041304

1305-
if (flags & DQUOT_SPACE_NOFAIL)
1306-
goto add;
1307-
13081305
if (dquot->dq_dqb.dqb_bhardlimit &&
13091306
tspace > dquot->dq_dqb.dqb_bhardlimit &&
13101307
!ignore_hardlimit(dquot)) {
13111308
if (flags & DQUOT_SPACE_WARN)
13121309
prepare_warning(warn, dquot, QUOTA_NL_BHARDWARN);
13131310
ret = -EDQUOT;
1314-
goto out;
1311+
goto finish;
13151312
}
13161313

13171314
if (dquot->dq_dqb.dqb_bsoftlimit &&
@@ -1322,7 +1319,7 @@ static int dquot_add_space(struct dquot *dquot, qsize_t space,
13221319
if (flags & DQUOT_SPACE_WARN)
13231320
prepare_warning(warn, dquot, QUOTA_NL_BSOFTLONGWARN);
13241321
ret = -EDQUOT;
1325-
goto out;
1322+
goto finish;
13261323
}
13271324

13281325
if (dquot->dq_dqb.dqb_bsoftlimit &&
@@ -1338,13 +1335,21 @@ static int dquot_add_space(struct dquot *dquot, qsize_t space,
13381335
* be always printed
13391336
*/
13401337
ret = -EDQUOT;
1341-
goto out;
1338+
goto finish;
13421339
}
13431340
}
1344-
add:
1345-
dquot->dq_dqb.dqb_rsvspace += rsv_space;
1346-
dquot->dq_dqb.dqb_curspace += space;
1347-
out:
1341+
finish:
1342+
/*
1343+
* We have to be careful and go through warning generation & grace time
1344+
* setting even if DQUOT_SPACE_NOFAIL is set. That's why we check it
1345+
* only here...
1346+
*/
1347+
if (flags & DQUOT_SPACE_NOFAIL)
1348+
ret = 0;
1349+
if (!ret) {
1350+
dquot->dq_dqb.dqb_rsvspace += rsv_space;
1351+
dquot->dq_dqb.dqb_curspace += space;
1352+
}
13481353
spin_unlock(&dquot->dq_dqb_lock);
13491354
return ret;
13501355
}

0 commit comments

Comments
 (0)