From c27bfc3b78c13a164440f50c5de82aa4493235a9 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Fri, 10 Jul 2015 08:12:16 +0200 Subject: [PATCH] LU-6356 sptlrpc: notify OSP and LWP for sptlrpc conf change Add .o_set_info_async handler for OSP and LWP. This handler only deals with sptlrpc conf change, calling sptlrpc_conf_client_adapt(). The latter is also modified to accept LUSTRE_OSP_NAME and LUSTRE_LWP_NAME obd types. This enables OSP and LWP to dynamically take into account security flavor change. Signed-off-by: Sebastien Buisson Change-Id: Ide4d9e61da708a145431f4f7993d52d2a7d29877 Reviewed-on: http://review.whamcloud.com/15552 Tested-by: Jenkins Reviewed-by: John L. Hammond Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Andrew Perepechko Reviewed-by: Oleg Drokin --- lustre/obdclass/genops.c | 25 ++++++++++++++----------- lustre/osp/lwp_dev.c | 18 ++++++++++++++++++ lustre/osp/osp_dev.c | 19 +++++++++++++++++++ lustre/ptlrpc/sec_config.c | 8 +++++--- 4 files changed, 56 insertions(+), 14 deletions(-) diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 194781b..8e816c5 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -620,19 +620,22 @@ int class_notify_sptlrpc_conf(const char *fsname, int namelen) LASSERT(namelen > 0); read_lock(&obd_dev_lock); - for (i = 0; i < class_devno_max(); i++) { - obd = class_num2obd(i); + for (i = 0; i < class_devno_max(); i++) { + obd = class_num2obd(i); - if (obd == NULL || obd->obd_set_up == 0 || obd->obd_stopping) - continue; + if (obd == NULL || obd->obd_set_up == 0 || obd->obd_stopping) + continue; - /* only notify mdc, osc, mdt, ost */ - type = obd->obd_type->typ_name; - if (strcmp(type, LUSTRE_MDC_NAME) != 0 && - strcmp(type, LUSTRE_OSC_NAME) != 0 && - strcmp(type, LUSTRE_MDT_NAME) != 0 && - strcmp(type, LUSTRE_OST_NAME) != 0) - continue; + /* only notify mdc, osc, osp, lwp, mdt, ost + * because only these have a -sptlrpc llog */ + type = obd->obd_type->typ_name; + if (strcmp(type, LUSTRE_MDC_NAME) != 0 && + strcmp(type, LUSTRE_OSC_NAME) != 0 && + strcmp(type, LUSTRE_OSP_NAME) != 0 && + strcmp(type, LUSTRE_LWP_NAME) != 0 && + strcmp(type, LUSTRE_MDT_NAME) != 0 && + strcmp(type, LUSTRE_OST_NAME) != 0) + continue; if (strncmp(obd->obd_name, fsname, namelen)) continue; diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c index a5ecc88..73d5deb 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c @@ -528,6 +528,23 @@ static int lwp_import_event(struct obd_device *obd, struct obd_import *imp, return 0; } +static int lwp_set_info_async(const struct lu_env *env, + struct obd_export *exp, + u32 keylen, void *key, + u32 vallen, void *val, + struct ptlrpc_request_set *set) +{ + ENTRY; + + if (KEY_IS(KEY_SPTLRPC_CONF)) { + sptlrpc_conf_client_adapt(exp->exp_obd); + RETURN(0); + } + + CERROR("Unknown key %s\n", (char *)key); + RETURN(-EINVAL); +} + struct obd_ops lwp_obd_device_ops = { .o_owner = THIS_MODULE, .o_add_conn = client_import_add_conn, @@ -535,4 +552,5 @@ struct obd_ops lwp_obd_device_ops = { .o_connect = lwp_obd_connect, .o_disconnect = lwp_obd_disconnect, .o_import_event = lwp_import_event, + .o_set_info_async = lwp_set_info_async, }; diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index 310ab15..528e5899 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -1688,6 +1688,24 @@ static int osp_iocontrol(unsigned int cmd, struct obd_export *exp, int len, return rc; } + +static int osp_set_info_async(const struct lu_env *env, + struct obd_export *exp, + u32 keylen, void *key, + u32 vallen, void *val, + struct ptlrpc_request_set *set) +{ + ENTRY; + + if (KEY_IS(KEY_SPTLRPC_CONF)) { + sptlrpc_conf_client_adapt(exp->exp_obd); + RETURN(0); + } + + CERROR("Unknown key %s\n", (char *)key); + RETURN(-EINVAL); +} + /** * Implementation of obd_ops::o_get_info * @@ -1829,6 +1847,7 @@ static struct obd_ops osp_obd_device_ops = { .o_fid_init = client_fid_init, .o_fid_fini = client_fid_fini, .o_fid_alloc = osp_fid_alloc, + .o_set_info_async = osp_set_info_async, }; struct llog_operations osp_mds_ost_orig_logops; diff --git a/lustre/ptlrpc/sec_config.c b/lustre/ptlrpc/sec_config.c index 6812d82..e98c11d 100644 --- a/lustre/ptlrpc/sec_config.c +++ b/lustre/ptlrpc/sec_config.c @@ -907,9 +907,11 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd) struct obd_import *imp; ENTRY; - LASSERT(strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 || - strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) ==0); - CDEBUG(D_SEC, "obd %s\n", obd->u.cli.cl_target_uuid.uuid); + LASSERT(strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 || + strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 || + strcmp(obd->obd_type->typ_name, LUSTRE_OSP_NAME) == 0 || + strcmp(obd->obd_type->typ_name, LUSTRE_LWP_NAME) == 0); + CDEBUG(D_SEC, "obd %s\n", obd->u.cli.cl_target_uuid.uuid); /* serialize with connect/disconnect import */ down_read(&obd->u.cli.cl_sem); -- 1.8.3.1