Skip to content

Commit 0826167

Browse files
Andrew Perepechkojankara
authored andcommitted
quota: Fix possible dq_flags corruption
dq_flags are modified non-atomically in do_set_dqblk via __set_bit calls and atomically for example in mark_dquot_dirty or clear_dquot_dirty. Hence a change done by an atomic operation can be overwritten by a change done by a non-atomic one. Fix the problem by using atomic bitops even in do_set_dqblk. Signed-off-by: Andrew Perepechko <andrew.perepechko@sun.com> Signed-off-by: Jan Kara <jack@suse.cz>
1 parent 4c5e6c0 commit 0826167

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fs/quota/dquot.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,34 +2328,34 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di)
23282328
if (di->dqb_valid & QIF_SPACE) {
23292329
dm->dqb_curspace = di->dqb_curspace - dm->dqb_rsvspace;
23302330
check_blim = 1;
2331-
__set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags);
2331+
set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags);
23322332
}
23332333
if (di->dqb_valid & QIF_BLIMITS) {
23342334
dm->dqb_bsoftlimit = qbtos(di->dqb_bsoftlimit);
23352335
dm->dqb_bhardlimit = qbtos(di->dqb_bhardlimit);
23362336
check_blim = 1;
2337-
__set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags);
2337+
set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags);
23382338
}
23392339
if (di->dqb_valid & QIF_INODES) {
23402340
dm->dqb_curinodes = di->dqb_curinodes;
23412341
check_ilim = 1;
2342-
__set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags);
2342+
set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags);
23432343
}
23442344
if (di->dqb_valid & QIF_ILIMITS) {
23452345
dm->dqb_isoftlimit = di->dqb_isoftlimit;
23462346
dm->dqb_ihardlimit = di->dqb_ihardlimit;
23472347
check_ilim = 1;
2348-
__set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags);
2348+
set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags);
23492349
}
23502350
if (di->dqb_valid & QIF_BTIME) {
23512351
dm->dqb_btime = di->dqb_btime;
23522352
check_blim = 1;
2353-
__set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags);
2353+
set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags);
23542354
}
23552355
if (di->dqb_valid & QIF_ITIME) {
23562356
dm->dqb_itime = di->dqb_itime;
23572357
check_ilim = 1;
2358-
__set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags);
2358+
set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags);
23592359
}
23602360

23612361
if (check_blim) {

0 commit comments

Comments
 (0)