aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFan Yong <fan.yong@intel.com>2018-05-29 10:21:43 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-31 12:55:36 -0400
commit6f17a0443972fb700dca7f0be882206ae23c27d6 (patch)
treef7e3b3c292c0b24e1f14af6f9d286f1e3c91d1d5
parenta694be449afb7f8581f491a675aa885263b6f2b3 (diff)
staging: lustre: acl: increase ACL entries limitation
Originally, the limitation of ACL entries is 32, that is not enough for some use cases. In fact, restricting ACL entries count is mainly for preparing the RPC reply buffer to receive the ACL data. So we cannot make the ACL entries count to be unlimited. But we can enlarge the RPC reply buffer to hold more ACL entries. On the other hand, MDT backend filesystem has its own EA size limitation. For example, for ldiskfs case, if large EA enable, then the max ACL size is 1048492 bytes; otherwise, it is 4012 bytes. For ZFS backend, such value is 32768 bytes. With such hard limitation, we can calculate how many ACL entries we can have at most. This patch increases the RPC reply buffer to match such hard limitation. For old client, to avoid buffer overflow because of large ACL data (more than 32 ACL entries), the MDT will forbid the old client to access the file with large ACL data. As for how to know whether it is old client or new, a new connection flag OBD_CONNECT_LARGE_ACL is used for that. Signed-off-by: Fan Yong <fan.yong@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7473 Reviewed-on: https://review.whamcloud.com/19790 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Li Xi <lixi@ddn.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h2
-rw-r--r--drivers/staging/lustre/lustre/include/lustre_acl.h7
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_lib.c3
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_locks.c6
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_reint.c2
-rw-r--r--drivers/staging/lustre/lustre/mdc/mdc_request.c4
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/layout.c4
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/wiretest.c4
8 files changed, 24 insertions, 8 deletions
diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h
index 8a7301a76122..6c7e3992d646 100644
--- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h
@@ -615,7 +615,7 @@ struct ptlrpc_body_v2 {
615#define OBD_CONNECT_REQPORTAL 0x40ULL /*Separate non-IO req portal */ 615#define OBD_CONNECT_REQPORTAL 0x40ULL /*Separate non-IO req portal */
616#define OBD_CONNECT_ACL 0x80ULL /*access control lists */ 616#define OBD_CONNECT_ACL 0x80ULL /*access control lists */
617#define OBD_CONNECT_XATTR 0x100ULL /*client use extended attr */ 617#define OBD_CONNECT_XATTR 0x100ULL /*client use extended attr */
618#define OBD_CONNECT_CROW 0x200ULL /*MDS+OST create obj on write*/ 618#define OBD_CONNECT_LARGE_ACL 0x200ULL /* more than 32 ACL entries */
619#define OBD_CONNECT_TRUNCLOCK 0x400ULL /*locks on server for punch */ 619#define OBD_CONNECT_TRUNCLOCK 0x400ULL /*locks on server for punch */
620#define OBD_CONNECT_TRANSNO 0x800ULL /*replay sends init transno */ 620#define OBD_CONNECT_TRANSNO 0x800ULL /*replay sends init transno */
621#define OBD_CONNECT_IBITS 0x1000ULL /*support for inodebits locks*/ 621#define OBD_CONNECT_IBITS 0x1000ULL /*support for inodebits locks*/
diff --git a/drivers/staging/lustre/lustre/include/lustre_acl.h b/drivers/staging/lustre/lustre/include/lustre_acl.h
index 35ff61ce4e9d..e7575a172b5f 100644
--- a/drivers/staging/lustre/lustre/include/lustre_acl.h
+++ b/drivers/staging/lustre/lustre/include/lustre_acl.h
@@ -36,11 +36,16 @@
36 36
37#include <linux/fs.h> 37#include <linux/fs.h>
38#include <linux/dcache.h> 38#include <linux/dcache.h>
39#ifdef CONFIG_FS_POSIX_ACL
39#include <linux/posix_acl_xattr.h> 40#include <linux/posix_acl_xattr.h>
40 41
41#define LUSTRE_POSIX_ACL_MAX_ENTRIES 32 42#define LUSTRE_POSIX_ACL_MAX_ENTRIES 32
42#define LUSTRE_POSIX_ACL_MAX_SIZE \ 43#define LUSTRE_POSIX_ACL_MAX_SIZE_OLD \
43 (sizeof(struct posix_acl_xattr_header) + \ 44 (sizeof(struct posix_acl_xattr_header) + \
44 LUSTRE_POSIX_ACL_MAX_ENTRIES * sizeof(struct posix_acl_xattr_entry)) 45 LUSTRE_POSIX_ACL_MAX_ENTRIES * sizeof(struct posix_acl_xattr_entry))
45 46
47#else /* ! CONFIG_FS_POSIX_ACL */
48#define LUSTRE_POSIX_ACL_MAX_SIZE_OLD 0
49#endif /* CONFIG_FS_POSIX_ACL */
50
46#endif 51#endif
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 1bc0782feae3..36066c839160 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -199,7 +199,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
199 if (sbi->ll_flags & LL_SBI_LRU_RESIZE) 199 if (sbi->ll_flags & LL_SBI_LRU_RESIZE)
200 data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE; 200 data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
201#ifdef CONFIG_FS_POSIX_ACL 201#ifdef CONFIG_FS_POSIX_ACL
202 data->ocd_connect_flags |= OBD_CONNECT_ACL | OBD_CONNECT_UMASK; 202 data->ocd_connect_flags |= OBD_CONNECT_ACL | OBD_CONNECT_UMASK |
203 OBD_CONNECT_LARGE_ACL;
203#endif 204#endif
204 205
205 if (OBD_FAIL_CHECK(OBD_FAIL_MDC_LIGHTWEIGHT)) 206 if (OBD_FAIL_CHECK(OBD_FAIL_MDC_LIGHTWEIGHT))
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index 253a54550ba8..65a5341e8a7c 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -308,6 +308,8 @@ mdc_intent_open_pack(struct obd_export *exp, struct lookup_intent *it,
308 308
309 req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, 309 req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
310 obddev->u.cli.cl_max_mds_easize); 310 obddev->u.cli.cl_max_mds_easize);
311 req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
312 req->rq_import->imp_connect_data.ocd_max_easize);
311 313
312 ptlrpc_request_set_replen(req); 314 ptlrpc_request_set_replen(req);
313 return req; 315 return req;
@@ -352,6 +354,8 @@ mdc_intent_getxattr_pack(struct obd_export *exp,
352 req_capsule_set_size(&req->rq_pill, &RMF_EAVALS_LENS, 354 req_capsule_set_size(&req->rq_pill, &RMF_EAVALS_LENS,
353 RCL_SERVER, maxdata); 355 RCL_SERVER, maxdata);
354 356
357 req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER, maxdata);
358
355 ptlrpc_request_set_replen(req); 359 ptlrpc_request_set_replen(req);
356 360
357 return req; 361 return req;
@@ -433,6 +437,8 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,
433 mdc_getattr_pack(req, valid, it->it_flags, op_data, easize); 437 mdc_getattr_pack(req, valid, it->it_flags, op_data, easize);
434 438
435 req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, easize); 439 req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, easize);
440 req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
441 req->rq_import->imp_connect_data.ocd_max_easize);
436 ptlrpc_request_set_replen(req); 442 ptlrpc_request_set_replen(req);
437 return req; 443 return req;
438} 444}
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
index 94ab43bcbe4f..e77c00df0693 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
@@ -134,6 +134,8 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
134 LTIME_S(op_data->op_attr.ia_ctime)); 134 LTIME_S(op_data->op_attr.ia_ctime));
135 mdc_setattr_pack(req, op_data, ea, ealen); 135 mdc_setattr_pack(req, op_data, ea, ealen);
136 136
137 req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
138 req->rq_import->imp_connect_data.ocd_max_easize);
137 ptlrpc_request_set_replen(req); 139 ptlrpc_request_set_replen(req);
138 140
139 rc = mdc_reint(req, LUSTRE_IMP_FULL); 141 rc = mdc_reint(req, LUSTRE_IMP_FULL);
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 9b1180547afc..cff31cb0a9ac 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -184,6 +184,8 @@ static int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data,
184 mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid, 184 mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid,
185 op_data->op_mode, -1, 0); 185 op_data->op_mode, -1, 0);
186 186
187 req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
188 req->rq_import->imp_connect_data.ocd_max_easize);
187 req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, 189 req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
188 op_data->op_mode); 190 op_data->op_mode);
189 ptlrpc_request_set_replen(req); 191 ptlrpc_request_set_replen(req);
@@ -230,6 +232,8 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
230 232
231 req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, 233 req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
232 op_data->op_mode); 234 op_data->op_mode);
235 req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
236 req->rq_import->imp_connect_data.ocd_max_easize);
233 ptlrpc_request_set_replen(req); 237 ptlrpc_request_set_replen(req);
234 238
235 rc = mdc_getattr_common(exp, req); 239 rc = mdc_getattr_common(exp, req);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c
index 2855f38c8190..417d4a151433 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/layout.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c
@@ -992,9 +992,7 @@ EXPORT_SYMBOL(RMF_EADATA);
992struct req_msg_field RMF_EAVALS = DEFINE_MSGF("eavals", 0, -1, NULL, NULL); 992struct req_msg_field RMF_EAVALS = DEFINE_MSGF("eavals", 0, -1, NULL, NULL);
993EXPORT_SYMBOL(RMF_EAVALS); 993EXPORT_SYMBOL(RMF_EAVALS);
994 994
995struct req_msg_field RMF_ACL = 995struct req_msg_field RMF_ACL = DEFINE_MSGF("acl", 0, -1, NULL, NULL);
996 DEFINE_MSGF("acl", RMF_F_NO_SIZE_CHECK,
997 LUSTRE_POSIX_ACL_MAX_SIZE, NULL, NULL);
998EXPORT_SYMBOL(RMF_ACL); 996EXPORT_SYMBOL(RMF_ACL);
999 997
1000/* FIXME: this should be made to use RMF_F_STRUCT_ARRAY */ 998/* FIXME: this should be made to use RMF_F_STRUCT_ARRAY */
diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c
index 2f64eb417e77..f9394c3e1ee2 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c
@@ -1010,8 +1010,8 @@ void lustre_assert_wire_constants(void)
1010 OBD_CONNECT_ACL); 1010 OBD_CONNECT_ACL);
1011 LASSERTF(OBD_CONNECT_XATTR == 0x100ULL, "found 0x%.16llxULL\n", 1011 LASSERTF(OBD_CONNECT_XATTR == 0x100ULL, "found 0x%.16llxULL\n",
1012 OBD_CONNECT_XATTR); 1012 OBD_CONNECT_XATTR);
1013 LASSERTF(OBD_CONNECT_CROW == 0x200ULL, "found 0x%.16llxULL\n", 1013 LASSERTF(OBD_CONNECT_LARGE_ACL == 0x200ULL, "found 0x%.16llxULL\n",
1014 OBD_CONNECT_CROW); 1014 OBD_CONNECT_LARGE_ACL);
1015 LASSERTF(OBD_CONNECT_TRUNCLOCK == 0x400ULL, "found 0x%.16llxULL\n", 1015 LASSERTF(OBD_CONNECT_TRUNCLOCK == 0x400ULL, "found 0x%.16llxULL\n",
1016 OBD_CONNECT_TRUNCLOCK); 1016 OBD_CONNECT_TRUNCLOCK);
1017 LASSERTF(OBD_CONNECT_TRANSNO == 0x800ULL, "found 0x%.16llxULL\n", 1017 LASSERTF(OBD_CONNECT_TRANSNO == 0x800ULL, "found 0x%.16llxULL\n",