1 From: Jan Kara <jack@suse.cz>
2 References: fate#302681
3 Subject: ocfs2: Fix grace time syncing
4 Patch-mainline: 2.6.29?
6 Fix syncing of grace times with other nodes. Previously, grace time could never
7 be reset to 0 even after user got below his softlimit.
9 Signed-off-by: Jan Kara <jack@suse.cz>
11 Index: linux-2.6.27/fs/ocfs2/quota_global.c
12 ===================================================================
13 --- linux-2.6.27.orig/fs/ocfs2/quota_global.c 2008-10-31 07:59:08.000000000 +0100
14 +++ linux-2.6.27/fs/ocfs2/quota_global.c 2008-10-31 08:03:32.000000000 +0100
16 dquot->dq_dqb.dqb_curspace += spacechange;
17 if (!test_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags))
18 dquot->dq_dqb.dqb_curinodes += inodechange;
19 - /* Now merge grace time changes... */
20 - if (!test_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags) &&
22 - if (dquot->dq_dqb.dqb_btime > 0)
23 - dquot->dq_dqb.dqb_btime =
24 + /* Set properly space grace time... */
25 + if (dquot->dq_dqb.dqb_bsoftlimit &&
26 + dquot->dq_dqb.dqb_curspace > dquot->dq_dqb.dqb_bsoftlimit) {
27 + if (!test_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags) &&
29 + if (dquot->dq_dqb.dqb_btime > 0)
30 + dquot->dq_dqb.dqb_btime =
31 min(dquot->dq_dqb.dqb_btime, oldbtime);
33 - dquot->dq_dqb.dqb_btime = oldbtime;
35 - if (!test_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags) &&
37 - if (dquot->dq_dqb.dqb_itime > 0)
38 - dquot->dq_dqb.dqb_itime =
40 + dquot->dq_dqb.dqb_btime = oldbtime;
43 + dquot->dq_dqb.dqb_btime = 0;
44 + clear_bit(DQ_BLKS_B, &dquot->dq_flags);
46 + /* Set properly inode grace time... */
47 + if (dquot->dq_dqb.dqb_isoftlimit &&
48 + dquot->dq_dqb.dqb_curinodes > dquot->dq_dqb.dqb_isoftlimit) {
49 + if (!test_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags) &&
51 + if (dquot->dq_dqb.dqb_itime > 0)
52 + dquot->dq_dqb.dqb_itime =
53 min(dquot->dq_dqb.dqb_itime, olditime);
55 - dquot->dq_dqb.dqb_itime = olditime;
57 + dquot->dq_dqb.dqb_itime = olditime;
60 + dquot->dq_dqb.dqb_itime = 0;
61 + clear_bit(DQ_INODES_B, &dquot->dq_flags);
63 /* All information is properly updated, clear the flags */
64 __clear_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags);