[ovs-dev] [PATCH 1/2] datapath: Do not send success message when OVS_VPORT_CMD_SET command fails

Ansis Atteka aatteka at nicira.com
Sat Mar 24 01:04:49 UTC 2012


The kernel-space is incorrectly sending two NETLINK messages to the user-space
if OVS_VPORT_CMD_SET command failed (one unnecessary success message and also
one error message with the same sequence ID).

This caused user-space to lose the track of reply message that contained error
reported by the kernel module (e.g. when user-space attempts to create two
tunnels with duplicate configs).

Issue#10285
Signed-off-by: Ansis Atteka <aatteka at nicira.com>
---
 datapath/datapath.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index d64fc32..daf7b69 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -1879,18 +1879,17 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
 	if (!err && a[OVS_VPORT_ATTR_UPCALL_PID])
 		vport->upcall_pid = nla_get_u32(a[OVS_VPORT_ATTR_UPCALL_PID]);
 
-	reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
-					 OVS_VPORT_CMD_NEW);
-	if (IS_ERR(reply)) {
-		err = PTR_ERR(reply);
-		netlink_set_err(GENL_SOCK(sock_net(skb->sk)), 0,
-				ovs_dp_vport_multicast_group.id, err);
-		return 0;
+	if (!err) {
+		reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
+						 OVS_VPORT_CMD_NEW);
+		if (IS_ERR(reply))
+			netlink_set_err(GENL_SOCK(sock_net(skb->sk)), 0,
+					ovs_dp_vport_multicast_group.id, err);
+		else
+			genl_notify(reply, genl_info_net(info), info->snd_pid,
+				    ovs_dp_vport_multicast_group.id, info->nlhdr, GFP_KERNEL);
 	}
 
-	genl_notify(reply, genl_info_net(info), info->snd_pid,
-		    ovs_dp_vport_multicast_group.id, info->nlhdr, GFP_KERNEL);
-
 exit_unlock:
 	rtnl_unlock();
 exit:
-- 
1.7.9




More information about the dev mailing list