From 8b7a8056ef50c1a27e9ade1f0523beef3a5fe393 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Thu, 8 Dec 2016 14:10:59 +0100 Subject: [PATCH] LU-8880 gss: fix GSS support for DNE With DNE, an OSP can be used on MDT for connections to other MDTs. So to determine exactly every connection's purpose, use client_obd's cl_sp_to in import_to_gss_svc() and gss_svc_upcall_install_rvs_ctx(). Signed-off-by: Sebastien Buisson Change-Id: I84934010102bdf760d07796866272b359bf0465e Reviewed-on: https://review.whamcloud.com/24236 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: wangdi --- lustre/ptlrpc/gss/gss_internal.h | 24 +++++++++++++++--------- lustre/ptlrpc/gss/gss_svc_upcall.c | 18 ++++++++++++------ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/lustre/ptlrpc/gss/gss_internal.h b/lustre/ptlrpc/gss/gss_internal.h index 1bf23ed..5558176 100644 --- a/lustre/ptlrpc/gss/gss_internal.h +++ b/lustre/ptlrpc/gss/gss_internal.h @@ -124,18 +124,24 @@ enum ptlrpc_gss_header_flags { static inline __u32 import_to_gss_svc(struct obd_import *imp) { - const char *name = imp->imp_obd->obd_type->typ_name; + int cl_sp_to = LUSTRE_SP_ANY; - if (!strcmp(name, LUSTRE_MGC_NAME)) - return LUSTRE_GSS_TGT_MGS; - if (!strcmp(name, LUSTRE_MDC_NAME) || - !strcmp(name, LUSTRE_LWP_NAME)) + if (imp->imp_obd) + cl_sp_to = imp->imp_obd->u.cli.cl_sp_to; + + switch (cl_sp_to) { + case LUSTRE_SP_MDT: return LUSTRE_GSS_TGT_MDS; - if (!strcmp(name, LUSTRE_OSC_NAME) || - !strcmp(name, LUSTRE_OSP_NAME)) + case LUSTRE_SP_OST: return LUSTRE_GSS_TGT_OSS; - - return 0; + case LUSTRE_SP_MGC: + case LUSTRE_SP_MGS: + return LUSTRE_GSS_TGT_MGS; + case LUSTRE_SP_CLI: + case LUSTRE_SP_ANY: + default: + return 0; + } } /* diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index 245e0e7..e655aa1 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -839,12 +839,18 @@ int gss_svc_upcall_install_rvs_ctx(struct obd_import *imp, } rsci.h.expiry_time = (time_t) ctx_expiry; - if (strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_MDC_NAME) == 0) - rsci.ctx.gsc_usr_mds = 1; - else if (strcmp(imp->imp_obd->obd_type->typ_name, LUSTRE_OSC_NAME) == 0) - rsci.ctx.gsc_usr_oss = 1; - else - rsci.ctx.gsc_usr_root = 1; + switch (imp->imp_obd->u.cli.cl_sp_to) { + case LUSTRE_SP_MDT: + rsci.ctx.gsc_usr_mds = 1; + break; + case LUSTRE_SP_OST: + rsci.ctx.gsc_usr_oss = 1; + break; + case LUSTRE_SP_CLI: + rsci.ctx.gsc_usr_root = 1; + default: + break; + } rscp = rsc_update(&rsci, rscp); if (rscp == NULL) -- 1.8.3.1