mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Santosh Shilimkar <santosh.shilimkar@oracle.com>,
	"Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Subject: [PATCH review for 4.4 04/47] RDS: RDMA: Fix the composite message user notification
Date: Wed, 20 Sep 2017 04:45:00 +0000	[thread overview]
Message-ID: <20170920044445.7392-4-alexander.levin@verizon.com> (raw)
In-Reply-To: <20170920044445.7392-1-alexander.levin@verizon.com>

From: Santosh Shilimkar <santosh.shilimkar@oracle.com>

[ Upstream commit 941f8d55f6d613a460a5e080d25a38509f45eb75 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 net/rds/ib_send.c | 25 +++++++++++++++----------
 net/rds/rdma.c    | 10 ++++++++++
 net/rds/rds.h     |  1 +
 net/rds/send.c    |  4 +++-
 4 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c
index eac30bf486d7..094e2a12860a 100644
--- a/net/rds/ib_send.c
+++ b/net/rds/ib_send.c
@@ -68,16 +68,6 @@ static void rds_ib_send_complete(struct rds_message *rm,
 	complete(rm, notify_status);
 }
 
-static void rds_ib_send_unmap_data(struct rds_ib_connection *ic,
-				   struct rm_data_op *op,
-				   int wc_status)
-{
-	if (op->op_nents)
-		ib_dma_unmap_sg(ic->i_cm_id->device,
-				op->op_sg, op->op_nents,
-				DMA_TO_DEVICE);
-}
-
 static void rds_ib_send_unmap_rdma(struct rds_ib_connection *ic,
 				   struct rm_rdma_op *op,
 				   int wc_status)
@@ -138,6 +128,21 @@ static void rds_ib_send_unmap_atomic(struct rds_ib_connection *ic,
 		rds_ib_stats_inc(s_ib_atomic_fadd);
 }
 
+static void rds_ib_send_unmap_data(struct rds_ib_connection *ic,
+				   struct rm_data_op *op,
+				   int wc_status)
+{
+	struct rds_message *rm = container_of(op, struct rds_message, data);
+
+	if (op->op_nents)
+		ib_dma_unmap_sg(ic->i_cm_id->device,
+				op->op_sg, op->op_nents,
+				DMA_TO_DEVICE);
+
+	if (rm->rdma.op_active && rm->data.op_notify)
+		rds_ib_send_unmap_rdma(ic, &rm->rdma, wc_status);
+}
+
 /*
  * Unmap the resources associated with a struct send_work.
  *
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index 4c93badeabf2..8d3a851a3476 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -626,6 +626,16 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
 		}
 		op->op_notifier->n_user_token = args->user_token;
 		op->op_notifier->n_status = RDS_RDMA_SUCCESS;
+
+		/* Enable rmda notification on data operation for composite
+		 * rds messages and make sure notification is enabled only
+		 * for the data operation which follows it so that application
+		 * gets notified only after full message gets delivered.
+		 */
+		if (rm->data.op_sg) {
+			rm->rdma.op_notify = 0;
+			rm->data.op_notify = !!(args->flags & RDS_RDMA_NOTIFY_ME);
+		}
 	}
 
 	/* 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 0e2797bdc316..4588860f4c3b 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -378,6 +378,7 @@ struct rds_message {
 		} rdma;
 		struct rm_data_op {
 			unsigned int		op_active:1;
+			unsigned int		op_notify:1;
 			unsigned int		op_nents;
 			unsigned int		op_count;
 			unsigned int		op_dmasg;
diff --git a/net/rds/send.c b/net/rds/send.c
index c9cdb358ea88..6815f03324d7 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -467,12 +467,14 @@ void rds_rdma_send_complete(struct rds_message *rm, int status)
 	struct rm_rdma_op *ro;
 	struct rds_notifier *notifier;
 	unsigned long flags;
+	unsigned int notify = 0;
 
 	spin_lock_irqsave(&rm->m_rs_lock, flags);
 
+	notify =  rm->rdma.op_notify | rm->data.op_notify;
 	ro = &rm->rdma;
 	if (test_bit(RDS_MSG_ON_SOCK, &rm->m_flags) &&
-	    ro->op_active && ro->op_notify && ro->op_notifier) {
+	    ro->op_active && notify && ro->op_notifier) {
 		notifier = ro->op_notifier;
 		rs = rm->m_rs;
 		sock_hold(rds_rs_to_sk(rs));
-- 
2.11.0

  reply	other threads:[~2017-09-20  4:45 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20  4:44 [PATCH review for 4.4 01/47] drm_fourcc: Fix DRM_FORMAT_MOD_LINEAR #define Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` Levin, Alexander (Sasha Levin) [this message]
2017-09-20  4:45 ` [PATCH review for 4.4 02/47] drm: bridge: add DT bindings for TI ths8135 Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 05/47] ARM: dts: r8a7790: Use R-Car Gen 2 fallback binding for msiof nodes Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 03/47] GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 08/47] MIPS: ralink: Fix incorrect assignment on ralink_soc Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 09/47] igb: re-assign hw address pointer on reset after PCI error Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 06/47] MIPS: Ensure bss section ends on a long-aligned address Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 07/47] MIPS: kexec: Do not reserve invalid crashkernel memory on boot Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 12/47] clk: wm831x: fix usleep_range with bad range Levin, Alexander (Sasha Levin)
2017-09-22  8:46   ` Charles Keepax
2017-09-24  0:18     ` Levin, Alexander (Sasha Levin)
2017-10-06  8:03       ` Nicholas Mc Guire
2017-10-06 10:00         ` Charles Keepax
2017-09-20  4:45 ` [PATCH review for 4.4 11/47] sh_eth: use correct name for ECMR_MPDE bit Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 13/47] hwmon: (gl520sm) Fix overflows and crash seen when writing into limit attributes Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 10/47] extcon: axp288: Use vbus-valid instead of -present to determine cable presence Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 16/47] ARM: 8635/1: nommu: allow enabling REMAP_VECTORS_TO_RAM Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 14/47] iio: adc: axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 15/47] iio: adc: hx711: Add DT binding for avia,hx711 Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 17/47] tty: goldfish: Fix a parameter of a call to free_irq Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 18/47] IB/ipoib: Fix deadlock over vlan_mutex Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 21/47] drm/amdkfd: fix improper return value on error Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 20/47] IB/ipoib: Replace list_del of the neigh->list with list_del_init Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 19/47] IB/ipoib: rtnl_unlock can not come after free_netdev Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 23/47] USB: serial: mos7840: fix control-message error handling Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 22/47] USB: serial: mos7720: " Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 25/47] partitions/efi: Fix integer overflow in GPT size calculation Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 24/47] pinctrl: mvebu: Use seq_puts() in mvebu_pinconf_group_dbg_show() Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 28/47] usb: chipidea: vbus event may exist before starting gadget Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 29/47] ASoC: dapm: fix some pointer error handling Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 27/47] audit: log 32-bit socketcalls Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 26/47] ASoC: dapm: handle probe deferrals Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 30/47] MIPS: Lantiq: Fix another request_mem_region() return code check Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 32/47] net/packet: check length in getsockopt() called with PACKET_HDRLEN Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 31/47] net: core: Prevent from dereferencing null pointer when releasing SKB Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 33/47] team: fix memory leaks Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 37/47] netfilter: invoke synchronize_rcu after set the _hook_ to NULL Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 36/47] bridge: netlink: register netdevice before executing changelink Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 34/47] usb: plusb: Add support for PL-27A1 Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 35/47] mmc: sdio: fix alignment issue in struct sdio_func Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 39/47] [media] exynos-gsc: Do not swap cb/cr for semi planar formats Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 41/47] parisc: perf: Fix potential NULL pointer dereference Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 40/47] netfilter: nfnl_cthelper: fix incorrect helper->expect_class_max Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 38/47] MIPS: IRQ Stack: Unwind IRQ stack onto task stack Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 45/47] i2c: meson: fix wrong variable usage in meson_i2c_put_data Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 43/47] rds: ib: add error handle Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 42/47] iommu/io-pgtable-arm: Check for leaf entry before dereferencing it Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 44/47] md/raid10: submit bio directly to replacement disk Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 47/47] libata: transport: Remove circular dependency at free time Levin, Alexander (Sasha Levin)
2017-09-20  4:45 ` [PATCH review for 4.4 46/47] xfs: remove kmem_zalloc_greedy Levin, Alexander (Sasha Levin)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170920044445.7392-4-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=santosh.shilimkar@oracle.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®