summaryrefslogtreecommitdiffstats
path: root/net/rds
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@oracle.com>2016-02-18 23:06:47 -0500
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>2017-01-02 17:02:54 -0500
commit941f8d55f6d613a460a5e080d25a38509f45eb75 (patch)
tree64210e6e92f8c09fdb480843c92a5ce1c516968e /net/rds
parentbe2f76eacc278c272f26d46e4168efe5a55f5383 (diff)
RDS: RDMA: Fix the composite message user notification
When application sends an RDS RDMA composite message consist of RDMA transfer to be followed up by non RDMA payload, it expect to be notified *only* when the full message gets delivered. RDS RDMA notification doesn't behave this way though. Thanks to Venkat for debug and root casuing the issue where only first part of the message(RDMA) was successfully delivered but remainder payload delivery failed. In that case, application should not be notified with a false positive of message delivery success. Fix this case by making sure the user gets notified only after the full message delivery. Reviewed-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/ib_send.c25
-rw-r--r--net/rds/rdma.c10
-rw-r--r--net/rds/rds.h1
-rw-r--r--net/rds/send.c4
4 files changed, 29 insertions, 11 deletions
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c
index 19eca5c4c00c..5e72de10c484 100644
--- a/net/rds/ib_send.c
+++ b/net/rds/ib_send.c
@@ -69,16 +69,6 @@ static void rds_ib_send_complete(struct rds_message *rm,
69 complete(rm, notify_status); 69 complete(rm, notify_status);
70} 70}
71 71
72static void rds_ib_send_unmap_data(struct rds_ib_connection *ic,
73 struct rm_data_op *op,
74 int wc_status)
75{
76 if (op->op_nents)
77 ib_dma_unmap_sg(ic->i_cm_id->device,
78 op->op_sg, op->op_nents,
79 DMA_TO_DEVICE);
80}
81
82static void rds_ib_send_unmap_rdma(struct rds_ib_connection *ic, 72static void rds_ib_send_unmap_rdma(struct rds_ib_connection *ic,
83 struct rm_rdma_op *op, 73 struct rm_rdma_op *op,
84 int wc_status) 74 int wc_status)
@@ -139,6 +129,21 @@ static void rds_ib_send_unmap_atomic(struct rds_ib_connection *ic,
139 rds_ib_stats_inc(s_ib_atomic_fadd); 129 rds_ib_stats_inc(s_ib_atomic_fadd);
140} 130}
141 131
132static void rds_ib_send_unmap_data(struct rds_ib_connection *ic,
133 struct rm_data_op *op,
134 int wc_status)
135{
136 struct rds_message *rm = container_of(op, struct rds_message, data);
137
138 if (op->op_nents)
139 ib_dma_unmap_sg(ic->i_cm_id->device,
140 op->op_sg, op->op_nents,
141 DMA_TO_DEVICE);
142
143 if (rm->rdma.op_active && rm->data.op_notify)
144 rds_ib_send_unmap_rdma(ic, &rm->rdma, wc_status);
145}
146
142/* 147/*
143 * Unmap the resources associated with a struct send_work. 148 * Unmap the resources associated with a struct send_work.
144 * 149 *
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index 4297f3f337d7..138aef644c56 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -627,6 +627,16 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
627 } 627 }
628 op->op_notifier->n_user_token = args->user_token; 628 op->op_notifier->n_user_token = args->user_token;
629 op->op_notifier->n_status = RDS_RDMA_SUCCESS; 629 op->op_notifier->n_status = RDS_RDMA_SUCCESS;
630
631 /* Enable rmda notification on data operation for composite
632 * rds messages and make sure notification is enabled only
633 * for the data operation which follows it so that application
634 * gets notified only after full message gets delivered.
635 */
636 if (rm->data.op_sg) {
637 rm->rdma.op_notify = 0;
638 rm->data.op_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME);
639 }
630 } 640 }
631 641
632 /* The cookie contains the R_Key of the remote memory region, and 642 /* The cookie contains the R_Key of the remote memory region, and
diff --git a/net/rds/rds.h b/net/rds/rds.h
index ebbf909b87ec..0bb8213c7d0b 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -419,6 +419,7 @@ struct rds_message {
419 } rdma; 419 } rdma;
420 struct rm_data_op { 420 struct rm_data_op {
421 unsigned int op_active:1; 421 unsigned int op_active:1;
422 unsigned int op_notify:1;
422 unsigned int op_nents; 423 unsigned int op_nents;
423 unsigned int op_count; 424 unsigned int op_count;
424 unsigned int op_dmasg; 425 unsigned int op_dmasg;
diff --git a/net/rds/send.c b/net/rds/send.c
index 0a6f38b1c8a5..45e025b65d29 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -476,12 +476,14 @@ void rds_rdma_send_complete(struct rds_message *rm, int status)
476 struct rm_rdma_op *ro; 476 struct rm_rdma_op *ro;
477 struct rds_notifier *notifier; 477 struct rds_notifier *notifier;
478 unsigned long flags; 478 unsigned long flags;
479 unsigned int notify = 0;
479 480
480 spin_lock_irqsave(&rm->m_rs_lock, flags); 481 spin_lock_irqsave(&rm->m_rs_lock, flags);
481 482
483 notify = rm->rdma.op_notify | rm->data.op_notify;
482 ro = &rm->rdma; 484 ro = &rm->rdma;
483 if (test_bit(RDS_MSG_ON_SOCK, &rm->m_flags) && 485 if (test_bit(RDS_MSG_ON_SOCK, &rm->m_flags) &&
484 ro->op_active && ro->op_notify && ro->op_notifier) { 486 ro->op_active && notify && ro->op_notifier) {
485 notifier = ro->op_notifier; 487 notifier = ro->op_notifier;
486 rs = rm->m_rs; 488 rs = rm->m_rs;
487 sock_hold(rds_rs_to_sk(rs)); 489 sock_hold(rds_rs_to_sk(rs));