Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1397113 > unrolled thread

[PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs

Started byJames Simmons <jsimmons@infradead.org>
First post2016-05-09 17:00 +0200
Last post2016-05-09 17:00 +0200
Articles 5 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs James Simmons <jsimmons@infradead.org> - 2016-05-09 17:00 +0200
    [PATCH 2/4] staging: lustre: o2iblnd: make rdma_create_id() support containers James Simmons <jsimmons@infradead.org> - 2016-05-09 17:00 +0200
    [PATCH 1/4] staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5 James Simmons <jsimmons@infradead.org> - 2016-05-09 17:00 +0200
    [PATCH 4/4] staging: lustre: ko2iblnd: fix memory corruption with fragments James Simmons <jsimmons@infradead.org> - 2016-05-09 17:00 +0200
    [PATCH 3/4] staging: lustre: libcfs: fix memort leak in libcfs crypto layer James Simmons <jsimmons@infradead.org> - 2016-05-09 17:00 +0200

#1397113 — [PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs

FromJames Simmons <jsimmons@infradead.org>
Date2016-05-09 17:00 +0200
Subject[PATCH 0/4] staging: lustre: small recent fixes for LNet/libcfs
Message-ID<rwUP7-7Fi-1@gated-at.bofh.it>
Here are various fixes and improvements for the libcfs
and LNet layer. Two memory leaks fixed as well as adding
container support for the ko2iblnd driver. Lastly handle
the lower limit of the mlx5 driver for cap.max_send_wr.

Dmitry Eremin (1):
  staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5

James Simmons (2):
  staging: lustre: libcfs: fix memort leak in libcfs crypto layer
  staging: lustre: ko2iblnd: fix memory corruption with fragments

Li Dongyang (1):
  staging: lustre: o2iblnd: make rdma_create_id() support containers

 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |   20 +++++++++++++++-----
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h    |    2 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |    8 ++++++++
 .../lustre/lnet/libcfs/linux/linux-crypto.c        |    1 +
 4 files changed, 25 insertions(+), 6 deletions(-)

[toc] | [next] | [standalone]


#1397114 — [PATCH 2/4] staging: lustre: o2iblnd: make rdma_create_id() support containers

FromJames Simmons <jsimmons@infradead.org>
Date2016-05-09 17:00 +0200
Subject[PATCH 2/4] staging: lustre: o2iblnd: make rdma_create_id() support containers
Message-ID<rwUP8-7Fi-3@gated-at.bofh.it>
In reply to#1397113
From: Li Dongyang <dongyang.li@anu.edu.au>

Add support for lustre's ko2iblnd driver to work with
containers which was requested by Sebastien Buisson.

Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6215
Reviewed-on: http://review.whamcloud.com/18759
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h    |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
index b22984f..45bbe93 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
@@ -109,7 +109,7 @@ extern kib_tunables_t  kiblnd_tunables;
 					IBLND_CREDIT_HIGHWATER_V1 : \
 					t->lnd_peercredits_hiw)
 
-#define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(&init_net, \
+#define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(current->nsproxy->net_ns, \
 							       cb, dev, \
 							       ps, qpt)
 
-- 
1.7.1

[toc] | [prev] | [next] | [standalone]


#1397119 — [PATCH 1/4] staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5

FromJames Simmons <jsimmons@infradead.org>
Date2016-05-09 17:00 +0200
Subject[PATCH 1/4] staging: lustre: o2iblnd: limit cap.max_send_wr for MLX5
Message-ID<rwUP9-7Fi-15@gated-at.bofh.it>
In reply to#1397113
From: Dmitry Eremin <dmitry.eremin@intel.com>

Decrease cap.max_send_wr until it is accepted by rdma_create_qp()

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7124
Reviewed-on: http://review.whamcloud.com/18347
Reviewed-by: Olaf Weber <olaf@sgi.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index d99b4fa..bc179a2 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -768,7 +768,12 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
 
 	conn->ibc_sched = sched;
 
-	rc = rdma_create_qp(cmid, conn->ibc_hdev->ibh_pd, init_qp_attr);
+	do {
+		rc = rdma_create_qp(cmid, conn->ibc_hdev->ibh_pd, init_qp_attr);
+		if (!rc || init_qp_attr->cap.max_send_wr < 16)
+			break;
+	} while (rc);
+
 	if (rc) {
 		CERROR("Can't create QP: %d, send_wr: %d, recv_wr: %d\n",
 		       rc, init_qp_attr->cap.max_send_wr,
@@ -776,6 +781,10 @@ kib_conn_t *kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
 		goto failed_2;
 	}
 
+	if (init_qp_attr->cap.max_send_wr != IBLND_SEND_WRS(conn))
+		CDEBUG(D_NET, "original send wr %d, created with %d\n",
+		       IBLND_SEND_WRS(conn), init_qp_attr->cap.max_send_wr);
+
 	LIBCFS_FREE(init_qp_attr, sizeof(*init_qp_attr));
 
 	/* 1 ref for caller and each rxmsg */
-- 
1.7.1

[toc] | [prev] | [next] | [standalone]


#1397123 — [PATCH 4/4] staging: lustre: ko2iblnd: fix memory corruption with fragments

FromJames Simmons <jsimmons@infradead.org>
Date2016-05-09 17:00 +0200
Subject[PATCH 4/4] staging: lustre: ko2iblnd: fix memory corruption with fragments
Message-ID<rwUP9-7Fi-19@gated-at.bofh.it>
In reply to#1397113
In my test of the upstream client this change exposed a long
standing issues where we have a offset that is not page algined
would causes us to access memory beyond the scatter gather list
which was causing memory corruption when all 256 fragments were
in use.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |    9 +++++----
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c |    8 ++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index bc179a2..8a18384 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2020,8 +2020,8 @@ static void kiblnd_destroy_tx_pool(kib_pool_t *pool)
 				    sizeof(*tx->tx_pages));
 		if (tx->tx_frags)
 			LIBCFS_FREE(tx->tx_frags,
-				    IBLND_MAX_RDMA_FRAGS *
-					    sizeof(*tx->tx_frags));
+				    (1 + IBLND_MAX_RDMA_FRAGS) *
+				     sizeof(*tx->tx_frags));
 		if (tx->tx_wrq)
 			LIBCFS_FREE(tx->tx_wrq,
 				    (1 + IBLND_MAX_RDMA_FRAGS) *
@@ -2099,11 +2099,12 @@ static int kiblnd_create_tx_pool(kib_poolset_t *ps, int size,
 		}
 
 		LIBCFS_CPT_ALLOC(tx->tx_frags, lnet_cpt_table(), ps->ps_cpt,
-				 IBLND_MAX_RDMA_FRAGS * sizeof(*tx->tx_frags));
+				 (1 + IBLND_MAX_RDMA_FRAGS) *
+				 sizeof(*tx->tx_frags));
 		if (!tx->tx_frags)
 			break;
 
-		sg_init_table(tx->tx_frags, IBLND_MAX_RDMA_FRAGS);
+		sg_init_table(tx->tx_frags, IBLND_MAX_RDMA_FRAGS + 1);
 
 		LIBCFS_CPT_ALLOC(tx->tx_wrq, lnet_cpt_table(), ps->ps_cpt,
 				 (1 + IBLND_MAX_RDMA_FRAGS) *
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index bbfee53..0f7e3a1 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -689,6 +689,10 @@ kiblnd_setup_rd_iov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd,
 
 		sg_set_page(sg, page, fragnob, page_offset);
 		sg = sg_next(sg);
+		if (!sg) {
+			CERROR("lacking enough sg entries to map tx\n");
+			return -EFAULT;
+		}
 
 		if (offset + fragnob < iov->iov_len) {
 			offset += fragnob;
@@ -733,6 +737,10 @@ kiblnd_setup_rd_kiov(lnet_ni_t *ni, kib_tx_t *tx, kib_rdma_desc_t *rd,
 		sg_set_page(sg, kiov->kiov_page, fragnob,
 			    kiov->kiov_offset + offset);
 		sg = sg_next(sg);
+		if (!sg) {
+			CERROR("lacking enough sg entries to map tx\n");
+			return -EFAULT;
+		}
 
 		offset = 0;
 		kiov++;
-- 
1.7.1

[toc] | [prev] | [next] | [standalone]


#1397124 — [PATCH 3/4] staging: lustre: libcfs: fix memort leak in libcfs crypto layer

FromJames Simmons <jsimmons@infradead.org>
Date2016-05-09 17:00 +0200
Subject[PATCH 3/4] staging: lustre: libcfs: fix memort leak in libcfs crypto layer
Message-ID<rwUP9-7Fi-27@gated-at.bofh.it>
In reply to#1397113
During code review Boyko discovered a memory leak. This
patch fixes that leak.

Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4423
Reviewed-on: http://review.whamcloud.com/19716
Reviewed-by: Alexander Boyko <alexander.boyko@seagate.com>
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lnet/libcfs/linux/linux-crypto.c        |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
index 84f9b7b..5c0116a 100644
--- a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
+++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
@@ -99,6 +99,7 @@ static int cfs_crypto_hash_alloc(enum cfs_crypto_hash_alg hash_alg,
 					 (*type)->cht_size);
 
 	if (err != 0) {
+		ahash_request_free(*req);
 		crypto_free_ahash(tfm);
 		return err;
 	}
-- 
1.7.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web