linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Lustre: get rid of is_osp_on_mdt
@ 2014-09-09  1:41 Oleg Drokin
  2014-09-09  1:41 ` [PATCH 1/2] staging/lustre: use osc_reply_portal for OUT services Oleg Drokin
  2014-09-09  1:41 ` [PATCH 2/2] staging/lustre: remove unused function is_osp_on_mdt Oleg Drokin
  0 siblings, 2 replies; 3+ messages in thread
From: Oleg Drokin @ 2014-09-09  1:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, devel, Andreas Dilger
  Cc: Hugues, Oleg Drokin

Hugues <morisset.hugues@gmail.com> has recently discovered a possibility
of buffer underflow in is_osp_on_mdt.
Instead of fixing it up, let's just get rid of this function altogether,
since it's no longer needed.

Mikhail Pershin (1):
  staging/lustre: use osc_reply_portal for OUT services

Oleg Drokin (1):
  staging/lustre: remove unused function is_osp_on_mdt

 drivers/staging/lustre/lustre/fld/fld_request.c    |  1 +
 .../lustre/lustre/include/lustre/lustre_idl.h      |  2 +-
 drivers/staging/lustre/lustre/include/obd.h        | 29 ----------------------
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c      | 29 ++++++++++++++--------
 4 files changed, 20 insertions(+), 41 deletions(-)

-- 
1.9.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] staging/lustre: use osc_reply_portal for OUT services
  2014-09-09  1:41 [PATCH 0/2] Lustre: get rid of is_osp_on_mdt Oleg Drokin
@ 2014-09-09  1:41 ` Oleg Drokin
  2014-09-09  1:41 ` [PATCH 2/2] staging/lustre: remove unused function is_osp_on_mdt Oleg Drokin
  1 sibling, 0 replies; 3+ messages in thread
From: Oleg Drokin @ 2014-09-09  1:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, devel, Andreas Dilger
  Cc: Hugues, Mikhail Pershin, Oleg Drokin

From: Mikhail Pershin <mike.pershin@intel.com>

OUT service is used to server both MDS-MDS updates and MDS-OST
therefore services on MDT and OST are set to use the same request
and reply portals to be fully unified and able to serve any type
of requests.

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Reviewed-on: http://review.whamcloud.com/8390
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3467
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
 drivers/staging/lustre/lustre/fld/fld_request.c    |  1 +
 .../lustre/lustre/include/lustre/lustre_idl.h      |  2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c      | 29 ++++++++++++++--------
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c
index 02454db..0d361ff 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -426,6 +426,7 @@ int fld_client_rpc(struct obd_export *exp,
 
 	ptlrpc_request_set_replen(req);
 	req->rq_request_portal = FLD_REQUEST_PORTAL;
+	req->rq_reply_portal = MDC_REPLY_PORTAL;
 	ptlrpc_at_set_req_timeout(req);
 
 	if (fld_op == FLD_LOOKUP &&
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index e529ad4..7b7457c 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -128,7 +128,7 @@
 //#define PTLBD_BULK_PORTAL	      21
 #define MDS_SETATTR_PORTAL	     22
 #define MDS_READPAGE_PORTAL	    23
-#define MDS_MDS_PORTAL		 24
+#define OUT_PORTAL		    24
 
 #define MGC_REPLY_PORTAL	       25
 #define MGS_REQUEST_PORTAL	     26
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
index 9b3dac4..c21e30a 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
@@ -267,15 +267,10 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
 	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);
 
 	/* In a more perfect world, we would hang a ptlrpc_client off of
 	 * obd_type and just use the values from there. */
-	if (!strcmp(name, LUSTRE_OSC_NAME) ||
-	    (!(strcmp(name, LUSTRE_OSP_NAME)) &&
-	     (is_osp_on_mdt(cli_name) &&
-	       strstr(lustre_cfg_buf(lcfg, 1), "OST") != NULL))) {
-		/* OSC or OSP_on_MDT for OSTs */
+	if (!strcmp(name, LUSTRE_OSC_NAME)) {
 		rq_portal = OST_REQUEST_PORTAL;
 		rp_portal = OSC_REPLY_PORTAL;
 		connect_op = OST_CONNECT;
@@ -283,17 +278,29 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)
 		cli->cl_sp_to = LUSTRE_SP_OST;
 		ns_type = LDLM_NS_TYPE_OSC;
 	} else if (!strcmp(name, LUSTRE_MDC_NAME) ||
-		   !strcmp(name, LUSTRE_LWP_NAME) ||
-		   (!strcmp(name, LUSTRE_OSP_NAME) &&
-		    (is_osp_on_mdt(cli_name) &&
-		     strstr(lustre_cfg_buf(lcfg, 1), "OST") == NULL))) {
-		/* MDC or OSP_on_MDT for other MDTs */
+		   !strcmp(name, LUSTRE_LWP_NAME)) {
 		rq_portal = MDS_REQUEST_PORTAL;
 		rp_portal = MDC_REPLY_PORTAL;
 		connect_op = MDS_CONNECT;
 		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)) {
+		if (strstr(lustre_cfg_buf(lcfg, 1), "OST") == NULL) {
+			/* OSP_on_MDT for other MDTs */
+			connect_op = MDS_CONNECT;
+			cli->cl_sp_to = LUSTRE_SP_MDT;
+			ns_type = LDLM_NS_TYPE_MDC;
+			rq_portal = OUT_PORTAL;
+		} else {
+			/* OSP on MDT for OST */
+			connect_op = OST_CONNECT;
+			cli->cl_sp_to = LUSTRE_SP_OST;
+			ns_type = LDLM_NS_TYPE_OSC;
+			rq_portal = OST_REQUEST_PORTAL;
+		}
+		rp_portal = OSC_REPLY_PORTAL;
+		cli->cl_sp_me = LUSTRE_SP_CLI;
 	} else if (!strcmp(name, LUSTRE_MGC_NAME)) {
 		rq_portal = MGS_REQUEST_PORTAL;
 		rp_portal = MGC_REPLY_PORTAL;
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] staging/lustre: remove unused function is_osp_on_mdt
  2014-09-09  1:41 [PATCH 0/2] Lustre: get rid of is_osp_on_mdt Oleg Drokin
  2014-09-09  1:41 ` [PATCH 1/2] staging/lustre: use osc_reply_portal for OUT services Oleg Drokin
@ 2014-09-09  1:41 ` Oleg Drokin
  1 sibling, 0 replies; 3+ messages in thread
From: Oleg Drokin @ 2014-09-09  1:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, devel, Andreas Dilger
  Cc: Hugues, Oleg Drokin

This function is no longer used anywhere.

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
 drivers/staging/lustre/lustre/include/obd.h | 29 -----------------------------
 1 file changed, 29 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index 66fc457..63e9ca8 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -660,35 +660,6 @@ struct niobuf_local {
 #define LUSTRE_MGS_OBDNAME "MGS"
 #define LUSTRE_MGC_OBDNAME "MGC"
 
-static inline int is_osp_on_mdt(char *name)
-{
-	char   *ptr;
-
-	ptr = strrchr(name, '-');
-	if (ptr == NULL) {
-		CERROR("%s is not a obdname\n", name);
-		return 0;
-	}
-
-	/* 1.8 OSC/OSP name on MDT is fsname-OSTxxxx-osc */
-	if (strncmp(ptr + 1, "osc", 3) == 0)
-		return 1;
-
-	if (strncmp(ptr + 1, "MDT", 3) != 0)
-		return 0;
-
-	while (*(--ptr) != '-' && ptr != name);
-
-	if (ptr == name)
-		return 0;
-
-	if (strncmp(ptr + 1, LUSTRE_OSP_NAME, strlen(LUSTRE_OSP_NAME)) != 0 &&
-	    strncmp(ptr + 1, LUSTRE_OSC_NAME, strlen(LUSTRE_OSC_NAME)) != 0)
-		return 0;
-
-	return 1;
-}
-
 /* Don't conflict with on-wire flags OBD_BRW_WRITE, etc */
 #define N_LOCAL_TEMP_PAGE 0x10000000
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-09  1:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-09  1:41 [PATCH 0/2] Lustre: get rid of is_osp_on_mdt Oleg Drokin
2014-09-09  1:41 ` [PATCH 1/2] staging/lustre: use osc_reply_portal for OUT services Oleg Drokin
2014-09-09  1:41 ` [PATCH 2/2] staging/lustre: remove unused function is_osp_on_mdt Oleg Drokin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).