#define LUSTRE_MGS_OBDNAME "MGS"
#define LUSTRE_MGC_OBDNAME "MGC"
+static inline int is_lwp_on_mdt(char *name)
+{
+ char *ptr;
+
+ ptr = strrchr(name, '-');
+ if (ptr == NULL) {
+ CERROR("%s is not a obdname\n", name);
+ return 0;
+ }
+
+ /* LWP name on MDT is fsname-MDTxxxx-lwp-MDTxxxx */
+
+ if (strncmp(ptr + 1, "MDT", 3) != 0)
+ return 0;
+
+ while (*(--ptr) != '-' && ptr != name);
+
+ if (ptr == name)
+ return 0;
+
+ if (strncmp(ptr + 1, LUSTRE_LWP_NAME, strlen(LUSTRE_LWP_NAME)) != 0)
+ return 0;
+
+ return 1;
+}
+
+static inline int is_lwp_on_ost(char *name)
+{
+ char *ptr;
+
+ ptr = strrchr(name, '-');
+ if (ptr == NULL) {
+ CERROR("%s is not a obdname\n", name);
+ return 0;
+ }
+
+ /* LWP name on OST is fsname-MDTxxxx-lwp-OSTxxxx */
+
+ if (strncmp(ptr + 1, "OST", 3) != 0)
+ return 0;
+
+ while (*(--ptr) != '-' && ptr != name);
+
+ if (ptr == name)
+ return 0;
+
+ if (strncmp(ptr + 1, LUSTRE_LWP_NAME, strlen(LUSTRE_LWP_NAME)) != 0)
+ return 0;
+
+ return 1;
+}
+
/*
* Events signalled through obd_notify() upcall-chain.
*/
*/
int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
{
- struct client_obd *cli = &obddev->u.cli;
- struct obd_import *imp;
- struct obd_uuid server_uuid;
- int rq_portal, rp_portal, connect_op;
- char *name = obddev->obd_type->typ_name;
- ldlm_ns_type_t ns_type = LDLM_NS_TYPE_UNKNOWN;
- int rc;
- ENTRY;
+ struct client_obd *cli = &obddev->u.cli;
+ struct obd_import *imp;
+ struct obd_uuid server_uuid;
+ int rq_portal, rp_portal, connect_op;
+ char *name = obddev->obd_type->typ_name;
+ ldlm_ns_type_t ns_type = LDLM_NS_TYPE_UNKNOWN;
+ int rc;
+ char *cli_name = lustre_cfg_buf(lcfg, 0);
+ ENTRY;
/* In a more perfect world, we would hang a ptlrpc_client off of
* obd_type and just use the values from there. */
rq_portal = MDS_REQUEST_PORTAL;
rp_portal = MDC_REPLY_PORTAL;
connect_op = MDS_CONNECT;
- cli->cl_sp_me = LUSTRE_SP_CLI;
+ if (is_lwp_on_ost(cli_name))
+ cli->cl_sp_me = LUSTRE_SP_OST;
+ else if (is_lwp_on_mdt(cli_name))
+ cli->cl_sp_me = LUSTRE_SP_MDT;
+ else
+ cli->cl_sp_me = LUSTRE_SP_CLI;
cli->cl_sp_to = LUSTRE_SP_MDT;
ns_type = LDLM_NS_TYPE_MDC;
} else if (!strcmp(name, LUSTRE_OSP_NAME)) {
rq_portal = OST_REQUEST_PORTAL;
}
rp_portal = OSC_REPLY_PORTAL;
- cli->cl_sp_me = LUSTRE_SP_CLI;
+ cli->cl_sp_me = LUSTRE_SP_MDT;
} else if (!strcmp(name, LUSTRE_MGC_NAME)) {
rq_portal = MGS_REQUEST_PORTAL;
rp_portal = MGC_REPLY_PORTAL;
if (rc != 0)
GOTO(err_fini_fs, rc);
+ tgt_adapt_sptlrpc_conf(&m->ofd_lut, 1);
+
RETURN(0);
err_fini_fs:
return;
}
+ sptlrpc_lprocfs_cliobd_attach(obd);
ptlrpc_lprocfs_register_obd(obd);
if (osp->opd_connect_mdt || !strstr(obd->obd_name, "osc"))
RETURN(rc);
}
- if (lprocfs_obd_setup(lwp->lpd_obd) == 0)
+ if (lprocfs_obd_setup(lwp->lpd_obd) == 0) {
+ sptlrpc_lprocfs_cliobd_attach(lwp->lpd_obd);
ptlrpc_lprocfs_register_obd(lwp->lpd_obd);
+ }
RETURN(0);
}
if (strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) &&
strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) &&
- strcmp(obd->obd_type->typ_name, LUSTRE_MGC_NAME)) {
+ strcmp(obd->obd_type->typ_name, LUSTRE_MGC_NAME) &&
+ strcmp(obd->obd_type->typ_name, LUSTRE_LWP_NAME) &&
+ strcmp(obd->obd_type->typ_name, LUSTRE_OSP_NAME)) {
CERROR("obd %s is not a client device\n", obdname);
spin_unlock(&obd->obd_dev_lock);
RETURN(-EINVAL);
static inline
__u32 import_to_gss_svc(struct obd_import *imp)
{
- const char *name = imp->imp_obd->obd_type->typ_name;
-
- if (!strcmp(name, LUSTRE_MGC_NAME))
- return LUSTRE_GSS_TGT_MGS;
- if (!strcmp(name, LUSTRE_MDC_NAME))
- return LUSTRE_GSS_TGT_MDS;
- if (!strcmp(name, LUSTRE_OSC_NAME))
- return LUSTRE_GSS_TGT_OSS;
- LBUG();
- return 0;
+ const char *name = imp->imp_obd->obd_type->typ_name;
+
+ if (!strcmp(name, LUSTRE_MGC_NAME))
+ return LUSTRE_GSS_TGT_MGS;
+ if (!strcmp(name, LUSTRE_MDC_NAME) ||
+ !strcmp(name, LUSTRE_LWP_NAME))
+ return LUSTRE_GSS_TGT_MDS;
+ if (!strcmp(name, LUSTRE_OSC_NAME) ||
+ !strcmp(name, LUSTRE_OSP_NAME))
+ return LUSTRE_GSS_TGT_OSS;
+
+ return 0;
}
/*
* encode real uid/gid into callout info.
*/
+ /* But first we need to make sure the obd type is supported */
+ if (strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_MDC_NAME) &&
+ strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_OSC_NAME) &&
+ strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_MGC_NAME) &&
+ strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_LWP_NAME) &&
+ strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_OSP_NAME)) {
+ CERROR("obd %s is not a supported device\n",
+ imp->imp_obd->obd_name);
+ RETURN(NULL);
+ }
+
construct_key_desc(desc, sizeof(desc), sec, vcred->vc_uid);
/* callout info format:
struct ptlrpc_sec *sec = NULL;
char str[32];
- LASSERT(strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) == 0);
+ LASSERT(strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
+ strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
+ strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) == 0 ||
+ strcmp(dev->obd_type->typ_name, LUSTRE_LWP_NAME) == 0 ||
+ strcmp(dev->obd_type->typ_name, LUSTRE_OSP_NAME) == 0);
if (cli->cl_import)
sec = sptlrpc_import_sec_ref(cli->cl_import);
struct client_obd *cli = &dev->u.cli;
struct ptlrpc_sec *sec = NULL;
- LASSERT(strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
- strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) == 0);
+ LASSERT(strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) == 0 ||
+ strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) == 0 ||
+ strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) == 0 ||
+ strcmp(dev->obd_type->typ_name, LUSTRE_LWP_NAME) == 0 ||
+ strcmp(dev->obd_type->typ_name, LUSTRE_OSP_NAME) == 0);
if (cli->cl_import)
sec = sptlrpc_import_sec_ref(cli->cl_import);
{
int rc;
- if (strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) != 0 &&
- strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) != 0 &&
- strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) != 0) {
- CERROR("can't register lproc for obd type %s\n",
- dev->obd_type->typ_name);
- return -EINVAL;
- }
+ if (strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) != 0 &&
+ strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) != 0 &&
+ strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) != 0 &&
+ strcmp(dev->obd_type->typ_name, LUSTRE_LWP_NAME) != 0 &&
+ strcmp(dev->obd_type->typ_name, LUSTRE_OSP_NAME) != 0) {
+ CERROR("can't register lproc for obd type %s\n",
+ dev->obd_type->typ_name);
+ return -EINVAL;
+ }
rc = lprocfs_obd_seq_create(dev, "srpc_info", 0444,
&sptlrpc_info_lprocfs_fops, dev);