summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2015-03-13 11:37:14 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-15 09:07:04 -0700
commitb3f63120e8f2b6f99d44ebe244aafafeb6ac890e (patch)
treeb4134159ef49f4ad6c6d9d0541f346bbee38daf6 /rpc
parentd8c18855caa07ff9d529395a760457281dd2f08e (diff)
rdma:changing list iteration to safe mode
Change-Id: I2299378f02a5577a8bf2874664ba79e92c3811b5 BUG: 1201621 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/9872 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 481621e9ca6..5fc6076f996 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -367,11 +367,12 @@ gf_rdma_deregister_arena (struct list_head **mr_list,
struct iobuf_arena *iobuf_arena)
{
gf_rdma_arena_mr *tmp = NULL;
+ gf_rdma_arena_mr *dummy = NULL;
int count = 0, i = 0;
count = iobuf_arena->iobuf_pool->rdma_device_count;
for (i = 0; i < count; i++) {
- list_for_each_entry(tmp, mr_list[i], list) {
+ list_for_each_entry_safe (tmp, dummy, mr_list[i], list) {
if (tmp->iobuf_arena == iobuf_arena) {
if (ibv_dereg_mr(tmp->mr)) {
gf_log("rdma", GF_LOG_WARNING,
@@ -437,6 +438,7 @@ gf_rdma_register_iobuf_pool (rpc_transport_t *this)
{
struct iobuf_pool *iobuf_pool = NULL;
struct iobuf_arena *tmp = NULL;
+ struct iobuf_arena *dummy = NULL;
gf_rdma_private_t *priv = NULL;
gf_rdma_device_t *device = NULL;
struct ibv_mr *mr = NULL;
@@ -448,7 +450,8 @@ gf_rdma_register_iobuf_pool (rpc_transport_t *this)
if (!list_empty(&iobuf_pool->all_arenas)) {
- list_for_each_entry (tmp, &iobuf_pool->all_arenas, all_list) {
+ list_for_each_entry_safe (tmp, dummy, &iobuf_pool->all_arenas,
+ all_list) {
new = GF_CALLOC(1, sizeof(gf_rdma_arena_mr),
gf_common_mt_rdma_arena_mr);
if (new == NULL) {
@@ -483,7 +486,8 @@ gf_rdma_register_iobuf_pool (rpc_transport_t *this)
static struct ibv_mr*
gf_rdma_get_pre_registred_mr(rpc_transport_t *this, void *ptr, int size)
{
- gf_rdma_arena_mr *tmp = NULL;
+ gf_rdma_arena_mr *tmp = NULL;
+ gf_rdma_arena_mr *dummy = NULL;
gf_rdma_private_t *priv = NULL;
gf_rdma_device_t *device = NULL;
@@ -491,7 +495,7 @@ gf_rdma_get_pre_registred_mr(rpc_transport_t *this, void *ptr, int size)
device = priv->device;
if (!list_empty(&device->all_mr)) {
- list_for_each_entry (tmp, &device->all_mr, list) {
+ list_for_each_entry_safe (tmp, dummy, &device->all_mr, list) {
if (tmp->iobuf_arena->mem_base <= ptr &&
ptr < tmp->iobuf_arena->mem_base +
tmp->iobuf_arena->arena_size)
@@ -1667,6 +1671,7 @@ __gf_rdma_deregister_mr (gf_rdma_device_t *device,
struct ibv_mr **mr, int count)
{
gf_rdma_arena_mr *tmp = NULL;
+ gf_rdma_arena_mr *dummy = NULL;
int i = 0;
int found = 0;
@@ -1677,7 +1682,7 @@ __gf_rdma_deregister_mr (gf_rdma_device_t *device,
for (i = 0; i < count; i++) {
found = 0;
if (!list_empty(&device->all_mr)) {
- list_for_each_entry(tmp, &device->all_mr, list) {
+ list_for_each_entry_safe (tmp, dummy, &device->all_mr, list) {
if (tmp->mr == mr[i]) {
found = 1;
break;