Whamcloud - gitweb
LU-6356 sptlrpc: notify OSP and LWP for sptlrpc conf change 52/15552/4
authorSebastien Buisson <sebastien.buisson@bull.net>
Fri, 10 Jul 2015 06:12:16 +0000 (08:12 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 10 Sep 2015 04:15:23 +0000 (04:15 +0000)
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 <sebastien.buisson@bull.net>
Change-Id: Ide4d9e61da708a145431f4f7993d52d2a7d29877
Reviewed-on: http://review.whamcloud.com/15552
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/genops.c
lustre/osp/lwp_dev.c
lustre/osp/osp_dev.c
lustre/ptlrpc/sec_config.c

index 194781b..8e816c5 100644 (file)
@@ -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;
index a5ecc88..73d5deb 100644 (file)
@@ -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,
 };
index 310ab15..528e589 100644 (file)
@@ -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;
index 6812d82..e98c11d 100644 (file)
@@ -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);