netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Santosh Shilimkar <santosh.shilimkar@oracle.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, davem@davemloft.net,
	ssantosh@kernel.org,
	Santosh Shilimkar <santosh.shilimkar@oracle.com>
Subject: [PATCH 08/14] RDS: Mark message mapped before transmit
Date: Sat, 22 Aug 2015 15:45:29 -0700	[thread overview]
Message-ID: <1440283535-4800-9-git-send-email-santosh.shilimkar@oracle.com> (raw)
In-Reply-To: <1440283535-4800-1-git-send-email-santosh.shilimkar@oracle.com>

rds_send_xmit() marks the rds message map flag after
xmit_[rdma/atomic]() which is clearly wrong.  We need
to maintain the ownership between transport and rds.

Also take care of error path.

Reviewed-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
---
 net/rds/send.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/net/rds/send.c b/net/rds/send.c
index dbdf907..96ae38d 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -282,26 +282,34 @@ restart:
 		/* The transport either sends the whole rdma or none of it */
 		if (rm->rdma.op_active && !conn->c_xmit_rdma_sent) {
 			rm->m_final_op = &rm->rdma;
+			/* The transport owns the mapped memory for now.
+			 * You can't unmap it while it's on the send queue
+			 */
+			set_bit(RDS_MSG_MAPPED, &rm->m_flags);
 			ret = conn->c_trans->xmit_rdma(conn, &rm->rdma);
-			if (ret)
+			if (ret) {
+				clear_bit(RDS_MSG_MAPPED, &rm->m_flags);
+				wake_up_interruptible(&rm->m_flush_wait);
 				break;
+			}
 			conn->c_xmit_rdma_sent = 1;
 
-			/* The transport owns the mapped memory for now.
-			 * You can't unmap it while it's on the send queue */
-			set_bit(RDS_MSG_MAPPED, &rm->m_flags);
 		}
 
 		if (rm->atomic.op_active && !conn->c_xmit_atomic_sent) {
 			rm->m_final_op = &rm->atomic;
+			/* The transport owns the mapped memory for now.
+			 * You can't unmap it while it's on the send queue
+			 */
+			set_bit(RDS_MSG_MAPPED, &rm->m_flags);
 			ret = conn->c_trans->xmit_atomic(conn, &rm->atomic);
-			if (ret)
+			if (ret) {
+				clear_bit(RDS_MSG_MAPPED, &rm->m_flags);
+				wake_up_interruptible(&rm->m_flush_wait);
 				break;
+			}
 			conn->c_xmit_atomic_sent = 1;
 
-			/* The transport owns the mapped memory for now.
-			 * You can't unmap it while it's on the send queue */
-			set_bit(RDS_MSG_MAPPED, &rm->m_flags);
 		}
 
 		/*
-- 
1.9.1

  parent reply	other threads:[~2015-08-22 22:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-22 22:45 [PATCH 00/14] RDS: Assorted bug fixes Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 01/14] RDS: restore return value in rds_cmsg_rdma_args() Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 02/14] RDS: always free recv frag as we free its ring entry Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 03/14] RDS: destroy the ib state earlier during shutdown Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 04/14] RDS: don't update ip address tables if the address hasn't changed Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 05/14] RDS: make sure we post recv buffers Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 06/14] RDS: check for congestion updates during rds_send_xmit Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 07/14] RDS: add a sock_destruct callback debug aid Santosh Shilimkar
2015-08-22 22:45 ` Santosh Shilimkar [this message]
2015-08-22 22:45 ` [PATCH 09/14] RDS: Make sure we do a signaled send for large-send Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 10/14] RDS: Fix assertion level from fatal to warning Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 11/14] RDS: Don't destroy the rdma id until after we're done using it Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 12/14] RDS: make sure rds_send_drop_to properly takes the m_rs_lock Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 13/14] RDS: return EMSGSIZE for oversize requests before processing/queueing Santosh Shilimkar
2015-08-22 22:45 ` [PATCH 14/14] RDS: check for valid cm_id before initiating connection Santosh Shilimkar
2015-08-25 20:35 ` [PATCH 00/14] RDS: Assorted bug fixes David Miller

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=1440283535-4800-9-git-send-email-santosh.shilimkar@oracle.com \
    --to=santosh.shilimkar@oracle.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ssantosh@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;
as well as URLs for NNTP newsgroup(s).