aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/quota/dquot.c20
-rw-r--r--fs/quota/quotaio_v2.h6
-rw-r--r--include/linux/quota.h2
-rw-r--r--include/uapi/linux/quota.h6
4 files changed, 27 insertions, 7 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 327a58448592..ecc25cf0ee6e 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1163,8 +1163,8 @@ static int need_print_warning(struct dquot_warn *warn)
1163 return uid_eq(current_fsuid(), warn->w_dq_id.uid); 1163 return uid_eq(current_fsuid(), warn->w_dq_id.uid);
1164 case GRPQUOTA: 1164 case GRPQUOTA:
1165 return in_group_p(warn->w_dq_id.gid); 1165 return in_group_p(warn->w_dq_id.gid);
1166 case PRJQUOTA: /* Never taken... Just make gcc happy */ 1166 case PRJQUOTA:
1167 return 0; 1167 return 1;
1168 } 1168 }
1169 return 0; 1169 return 0;
1170} 1170}
@@ -1405,6 +1405,9 @@ static void __dquot_initialize(struct inode *inode, int type)
1405 /* First get references to structures we might need. */ 1405 /* First get references to structures we might need. */
1406 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1406 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1407 struct kqid qid; 1407 struct kqid qid;
1408 kprojid_t projid;
1409 int rc;
1410
1408 got[cnt] = NULL; 1411 got[cnt] = NULL;
1409 if (type != -1 && cnt != type) 1412 if (type != -1 && cnt != type)
1410 continue; 1413 continue;
@@ -1415,6 +1418,10 @@ static void __dquot_initialize(struct inode *inode, int type)
1415 */ 1418 */
1416 if (dquots[cnt]) 1419 if (dquots[cnt])
1417 continue; 1420 continue;
1421
1422 if (!sb_has_quota_active(sb, cnt))
1423 continue;
1424
1418 init_needed = 1; 1425 init_needed = 1;
1419 1426
1420 switch (cnt) { 1427 switch (cnt) {
@@ -1424,6 +1431,12 @@ static void __dquot_initialize(struct inode *inode, int type)
1424 case GRPQUOTA: 1431 case GRPQUOTA:
1425 qid = make_kqid_gid(inode->i_gid); 1432 qid = make_kqid_gid(inode->i_gid);
1426 break; 1433 break;
1434 case PRJQUOTA:
1435 rc = inode->i_sb->dq_op->get_projid(inode, &projid);
1436 if (rc)
1437 continue;
1438 qid = make_kqid_projid(projid);
1439 break;
1427 } 1440 }
1428 got[cnt] = dqget(sb, qid); 1441 got[cnt] = dqget(sb, qid);
1429 } 1442 }
@@ -2176,7 +2189,8 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
2176 error = -EROFS; 2189 error = -EROFS;
2177 goto out_fmt; 2190 goto out_fmt;
2178 } 2191 }
2179 if (!sb->s_op->quota_write || !sb->s_op->quota_read) { 2192 if (!sb->s_op->quota_write || !sb->s_op->quota_read ||
2193 (type == PRJQUOTA && sb->dq_op->get_projid == NULL)) {
2180 error = -EINVAL; 2194 error = -EINVAL;
2181 goto out_fmt; 2195 goto out_fmt;
2182 } 2196 }
diff --git a/fs/quota/quotaio_v2.h b/fs/quota/quotaio_v2.h
index f1966b42c2fd..4e95430093d9 100644
--- a/fs/quota/quotaio_v2.h
+++ b/fs/quota/quotaio_v2.h
@@ -13,12 +13,14 @@
13 */ 13 */
14#define V2_INITQMAGICS {\ 14#define V2_INITQMAGICS {\
15 0xd9c01f11, /* USRQUOTA */\ 15 0xd9c01f11, /* USRQUOTA */\
16 0xd9c01927 /* GRPQUOTA */\ 16 0xd9c01927, /* GRPQUOTA */\
17 0xd9c03f14, /* PRJQUOTA */\
17} 18}
18 19
19#define V2_INITQVERSIONS {\ 20#define V2_INITQVERSIONS {\
20 1, /* USRQUOTA */\ 21 1, /* USRQUOTA */\
21 1 /* GRPQUOTA */\ 22 1, /* GRPQUOTA */\
23 1, /* PRJQUOTA */\
22} 24}
23 25
24/* First generic header */ 26/* First generic header */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index cf910d1f8efa..b2505acfd3c0 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -50,6 +50,7 @@
50 50
51#undef USRQUOTA 51#undef USRQUOTA
52#undef GRPQUOTA 52#undef GRPQUOTA
53#undef PRJQUOTA
53enum quota_type { 54enum quota_type {
54 USRQUOTA = 0, /* element used for user quotas */ 55 USRQUOTA = 0, /* element used for user quotas */
55 GRPQUOTA = 1, /* element used for group quotas */ 56 GRPQUOTA = 1, /* element used for group quotas */
@@ -319,6 +320,7 @@ struct dquot_operations {
319 /* get reserved quota for delayed alloc, value returned is managed by 320 /* get reserved quota for delayed alloc, value returned is managed by
320 * quota code only */ 321 * quota code only */
321 qsize_t *(*get_reserved_space) (struct inode *); 322 qsize_t *(*get_reserved_space) (struct inode *);
323 int (*get_projid) (struct inode *, kprojid_t *);/* Get project ID */
322}; 324};
323 325
324struct path; 326struct path;
diff --git a/include/uapi/linux/quota.h b/include/uapi/linux/quota.h
index 1f49b8341c99..9c95b2c1c88a 100644
--- a/include/uapi/linux/quota.h
+++ b/include/uapi/linux/quota.h
@@ -36,11 +36,12 @@
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/types.h> 37#include <linux/types.h>
38 38
39#define __DQUOT_VERSION__ "dquot_6.5.2" 39#define __DQUOT_VERSION__ "dquot_6.6.0"
40 40
41#define MAXQUOTAS 2 41#define MAXQUOTAS 3
42#define USRQUOTA 0 /* element used for user quotas */ 42#define USRQUOTA 0 /* element used for user quotas */
43#define GRPQUOTA 1 /* element used for group quotas */ 43#define GRPQUOTA 1 /* element used for group quotas */
44#define PRJQUOTA 2 /* element used for project quotas */
44 45
45/* 46/*
46 * Definitions for the default names of the quotas files. 47 * Definitions for the default names of the quotas files.
@@ -48,6 +49,7 @@
48#define INITQFNAMES { \ 49#define INITQFNAMES { \
49 "user", /* USRQUOTA */ \ 50 "user", /* USRQUOTA */ \
50 "group", /* GRPQUOTA */ \ 51 "group", /* GRPQUOTA */ \
52 "project", /* PRJQUOTA */ \
51 "undefined", \ 53 "undefined", \
52}; 54};
53 55