@@ -269,6 +269,7 @@ void req_capsule_shrink(struct req_capsule *pill,
extern struct req_msg_field RMF_HSM_STATE_SET;
extern struct req_msg_field RMF_MDS_HSM_CURRENT_ACTION;
extern struct req_msg_field RMF_MDS_HSM_REQUEST;
+extern struct req_msg_field RMF_SELINUX_POL;
/* seq-mgr fields */
extern struct req_msg_field RMF_SEQ_OPC;
@@ -256,6 +256,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
obd_connect_set_secctx(data);
+#if defined(CONFIG_SECURITY)
+ data->ocd_connect_flags2 |= OBD_CONNECT2_SELINUX_POLICY;
+#endif
+
data->ocd_brw_size = MD_MAX_BRW_SIZE;
err = obd_connect(NULL, &sbi->ll_md_exp, sbi->ll_md_obd,
@@ -606,7 +606,8 @@ int ptlrpc_connect_import(struct obd_import *imp)
obd2cli_tgt(imp->imp_obd),
obd->obd_uuid.uuid,
(char *)&imp->imp_dlm_handle,
- (char *)&imp->imp_connect_data };
+ (char *)&imp->imp_connect_data,
+ NULL };
struct ptlrpc_connect_async_args *aa;
int rc;
@@ -670,6 +671,19 @@ int ptlrpc_connect_import(struct obd_import *imp)
goto out;
}
+ /* get SELinux policy info if any */
+ rc = sptlrpc_get_sepol(request);
+ if (rc < 0) {
+ ptlrpc_request_free(request);
+ goto out;
+ }
+
+ bufs[5] = request->rq_sepol;
+
+ req_capsule_set_size(&request->rq_pill, &RMF_SELINUX_POL, RCL_CLIENT,
+ strlen(request->rq_sepol) ?
+ strlen(request->rq_sepol) + 1 : 0);
+
rc = ptlrpc_request_bufs_pack(request, LUSTRE_OBD_VERSION,
imp->imp_connect_op, bufs, NULL);
if (rc) {
@@ -315,7 +315,8 @@
&RMF_TGTUUID,
&RMF_CLUUID,
&RMF_CONN,
- &RMF_CONNECT_DATA
+ &RMF_CONNECT_DATA,
+ &RMF_SELINUX_POL,
};
static const struct req_msg_field *obd_connect_server[] = {
@@ -1039,6 +1040,10 @@ struct req_msg_field RMF_LAYOUT_INTENT =
NULL);
EXPORT_SYMBOL(RMF_LAYOUT_INTENT);
+struct req_msg_field RMF_SELINUX_POL =
+ DEFINE_MSGF("selinux_pol", RMF_F_STRING, -1, NULL, NULL);
+EXPORT_SYMBOL(RMF_SELINUX_POL);
+
/*
* OST request field.
*/