]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Jan Kara <jack@suse.cz> |
2 | References: fate#302681 | |
3 | Subject: [PATCH 15/28] quota: Keep which entries were set by SETQUOTA quotactl | |
4 | Patch-mainline: 2.6.29? | |
5 | ||
6 | Quota in a clustered environment needs to synchronize quota information | |
7 | among cluster nodes. This means we have to occasionally update some | |
8 | information in dquot from disk / network. On the other hand we have to | |
9 | be careful not to overwrite changes administrator did via SETQUOTA. | |
10 | So indicate in dquot->dq_flags which entries have been set by SETQUOTA | |
11 | and quota format can clear these flags when it properly propagated | |
12 | the changes. | |
13 | ||
14 | Signed-off-by: Jan Kara <jack@suse.cz> | |
15 | --- | |
16 | fs/dquot.c | 12 ++++++++++-- | |
17 | include/linux/quota.h | 26 ++++++++++++++++++++------ | |
18 | 2 files changed, 30 insertions(+), 8 deletions(-) | |
19 | ||
20 | diff --git a/fs/dquot.c b/fs/dquot.c | |
21 | index f4258fe..3fde18b 100644 | |
22 | --- a/fs/dquot.c | |
23 | +++ b/fs/dquot.c | |
24 | @@ -2008,25 +2008,33 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | |
25 | if (di->dqb_valid & QIF_SPACE) { | |
26 | dm->dqb_curspace = di->dqb_curspace; | |
27 | check_blim = 1; | |
28 | + __set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags); | |
29 | } | |
30 | if (di->dqb_valid & QIF_BLIMITS) { | |
31 | dm->dqb_bsoftlimit = qbtos(di->dqb_bsoftlimit); | |
32 | dm->dqb_bhardlimit = qbtos(di->dqb_bhardlimit); | |
33 | check_blim = 1; | |
34 | + __set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags); | |
35 | } | |
36 | if (di->dqb_valid & QIF_INODES) { | |
37 | dm->dqb_curinodes = di->dqb_curinodes; | |
38 | check_ilim = 1; | |
39 | + __set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags); | |
40 | } | |
41 | if (di->dqb_valid & QIF_ILIMITS) { | |
42 | dm->dqb_isoftlimit = di->dqb_isoftlimit; | |
43 | dm->dqb_ihardlimit = di->dqb_ihardlimit; | |
44 | check_ilim = 1; | |
45 | + __set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags); | |
46 | } | |
47 | - if (di->dqb_valid & QIF_BTIME) | |
48 | + if (di->dqb_valid & QIF_BTIME) { | |
49 | dm->dqb_btime = di->dqb_btime; | |
50 | - if (di->dqb_valid & QIF_ITIME) | |
51 | + __set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); | |
52 | + } | |
53 | + if (di->dqb_valid & QIF_ITIME) { | |
54 | dm->dqb_itime = di->dqb_itime; | |
55 | + __set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); | |
56 | + } | |
57 | ||
58 | if (check_blim) { | |
59 | if (!dm->dqb_bsoftlimit || dm->dqb_curspace < dm->dqb_bsoftlimit) { | |
60 | diff --git a/include/linux/quota.h b/include/linux/quota.h | |
61 | index 0ee2a55..f81e80c 100644 | |
62 | --- a/include/linux/quota.h | |
63 | +++ b/include/linux/quota.h | |
64 | @@ -82,12 +82,21 @@ | |
65 | * Quota structure used for communication with userspace via quotactl | |
66 | * Following flags are used to specify which fields are valid | |
67 | */ | |
68 | -#define QIF_BLIMITS 1 | |
69 | -#define QIF_SPACE 2 | |
70 | -#define QIF_ILIMITS 4 | |
71 | -#define QIF_INODES 8 | |
72 | -#define QIF_BTIME 16 | |
73 | -#define QIF_ITIME 32 | |
74 | +enum { | |
75 | + QIF_BLIMITS_B = 0, | |
76 | + QIF_SPACE_B, | |
77 | + QIF_ILIMITS_B, | |
78 | + QIF_INODES_B, | |
79 | + QIF_BTIME_B, | |
80 | + QIF_ITIME_B, | |
81 | +}; | |
82 | + | |
83 | +#define QIF_BLIMITS (1 << QIF_BLIMITS_B) | |
84 | +#define QIF_SPACE (1 << QIF_SPACE_B) | |
85 | +#define QIF_ILIMITS (1 << QIF_ILIMITS_B) | |
86 | +#define QIF_INODES (1 << QIF_INODES_B) | |
87 | +#define QIF_BTIME (1 << QIF_BTIME_B) | |
88 | +#define QIF_ITIME (1 << QIF_ITIME_B) | |
89 | #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) | |
90 | #define QIF_USAGE (QIF_SPACE | QIF_INODES) | |
91 | #define QIF_TIMES (QIF_BTIME | QIF_ITIME) | |
92 | @@ -244,6 +253,11 @@ extern struct dqstats dqstats; | |
93 | #define DQ_FAKE_B 3 /* no limits only usage */ | |
94 | #define DQ_READ_B 4 /* dquot was read into memory */ | |
95 | #define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ | |
96 | +#define DQ_LASTSET_B 6 /* Following 6 bits (see QIF_) are reserved\ | |
97 | + * for the mask of entries set via SETQUOTA\ | |
98 | + * quotactl. They are set under dq_data_lock\ | |
99 | + * and the quota format handling dquot can\ | |
100 | + * clear them when it sees fit. */ | |
101 | ||
102 | struct dquot { | |
103 | struct hlist_node dq_hash; /* Hash list in memory */ | |
104 | -- | |
105 | 1.5.2.4 | |
106 |