netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tipc: failed transmissions should return error
@ 2014-02-18 13:29 erik.hugne
  2014-02-18 23:11 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: erik.hugne @ 2014-02-18 13:29 UTC (permalink / raw)
  To: netdev
  Cc: tipc-discussion, ying.xue, paul.gortmaker, jon.maloy, maloy,
	Erik Hugne

From: Erik Hugne <erik.hugne@ericsson.com>

When a message could not be sent out because the destination
node or link could not be found, the full message size is
returned from sendmsg() as if it had been sent successfully.
An application will then get a false indication that it's
making forward progress. This problem has existed since the
initial commit in 2.6.16.

We change this to return -ENETUNREACH if the message cannot be
delivered due to the destination node/link being unavailable.
We also get rid of the redundant tipc_reject_msg call since
freeing the buffer and doing a tipc_port_reject_sections
accomplishes exactly the same thing.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
---
 net/tipc/link.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index 5422e96..e79f0f4 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1016,12 +1016,9 @@ exit:
 	read_unlock_bh(&tipc_net_lock);
 
 	/* Couldn't find a link to the destination node */
-	if (buf)
-		return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
-	if (res >= 0)
-		return tipc_port_reject_sections(sender, hdr, msg_sect,
-						 len, TIPC_ERR_NO_NODE);
-	return res;
+	kfree_skb(buf);
+	tipc_port_reject_sections(sender, hdr, msg_sect, len, TIPC_ERR_NO_NODE);
+	return -ENETUNREACH;
 }
 
 /*
@@ -1159,8 +1156,9 @@ error:
 	} else {
 reject:
 		kfree_skb_list(buf_chain);
-		return tipc_port_reject_sections(sender, hdr, msg_sect,
-						 len, TIPC_ERR_NO_NODE);
+		tipc_port_reject_sections(sender, hdr, msg_sect,
+					  len, TIPC_ERR_NO_NODE);
+		return -ENETUNREACH;
 	}
 
 	/* Append chain of fragments to send queue & send them */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-18 23:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-18 13:29 [PATCH net-next] tipc: failed transmissions should return error erik.hugne
2014-02-18 23:11 ` David Miller

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).