]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.suse/quota-Allow-negative-usage-of-space-and-inodes.patch
Add a patch to fix Intel E100 wake-on-lan problems.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.suse / quota-Allow-negative-usage-of-space-and-inodes.patch
1 From: Jan Kara <jack@suse.cz>
2 References: fate#302681
3 Subject: [PATCH 14/28] quota: Allow negative usage of space and inodes
4 Patch-mainline: 2.6.29?
5
6 For clustered filesystems, it can happen that space / inode usage goes
7 negative temporarily (because some node is allocating another node
8 is freeing and they are not completely in sync). So let quota code
9 allow this and change qsize_t so a signed type so that we don't
10 underflow the variables.
11
12 Signed-off-by: Jan Kara <jack@suse.cz>
13 ---
14 fs/dquot.c | 6 ++++--
15 include/linux/quota.h | 3 ++-
16 2 files changed, 6 insertions(+), 3 deletions(-)
17
18 diff --git a/fs/dquot.c b/fs/dquot.c
19 index 904bd67..f4258fe 100644
20 --- a/fs/dquot.c
21 +++ b/fs/dquot.c
22 @@ -845,7 +845,8 @@ static inline void dquot_incr_space(struct dquot *dquot, qsize_t number)
23
24 static inline void dquot_decr_inodes(struct dquot *dquot, qsize_t number)
25 {
26 - if (dquot->dq_dqb.dqb_curinodes > number)
27 + if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||
28 + dquot->dq_dqb.dqb_curinodes >= number)
29 dquot->dq_dqb.dqb_curinodes -= number;
30 else
31 dquot->dq_dqb.dqb_curinodes = 0;
32 @@ -856,7 +857,8 @@ static inline void dquot_decr_inodes(struct dquot *dquot, qsize_t number)
33
34 static inline void dquot_decr_space(struct dquot *dquot, qsize_t number)
35 {
36 - if (dquot->dq_dqb.dqb_curspace > number)
37 + if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||
38 + dquot->dq_dqb.dqb_curspace >= number)
39 dquot->dq_dqb.dqb_curspace -= number;
40 else
41 dquot->dq_dqb.dqb_curspace = 0;
42 diff --git a/include/linux/quota.h b/include/linux/quota.h
43 index e05c30d..0ee2a55 100644
44 --- a/include/linux/quota.h
45 +++ b/include/linux/quota.h
46 @@ -170,7 +170,7 @@ enum {
47 #include <asm/atomic.h>
48
49 typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
50 -typedef __u64 qsize_t; /* Type in which we store sizes */
51 +typedef __s64 qsize_t; /* Type in which we store sizes */
52
53 extern spinlock_t dq_data_lock;
54
55 @@ -338,6 +338,7 @@ enum {
56 * responsible for setting
57 * S_NOQUOTA, S_NOATIME flags
58 */
59 +#define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */
60
61 static inline unsigned int dquot_state_flag(unsigned int flags, int type)
62 {
63 --
64 1.5.2.4
65