[ISSUE] Failed to find "enabled" option.
by Xin Long
I found this err in "loadbalance" and "lacp" runner when adding ports.
It's caused by trying to set "enabled" option in .port_link_changed()
or .port_changed().
When a new port is added, the first 'port changed event' process is
earlier than CMD TEAM_CMD_OPTIONS_GET, in this CMD, all
the options are synchronized from kernel.
It means there's no 'enabled' option yet when calling port_link_changed
in the first 'port changed event' process. In lb_event_watch_port_link_changed
and lacp_event_watch_port_changed, they call teamd_port_check_enable
to set 'enabled' option. this err is triggered.
I'm not sure why teamd_port_check_enable needs to check if
'enabled' option exists. I checked the ab's .port_link_changed(),
it just sets it by calling team_set_port_enabled(), instead of
checking 'enabled' option first.
can we just use team_set_port_enabled to set it directly in
.port(_link)_changed OR improve teamd_port_check_enable
to avoid this err ?
Thanks.
4 years
[patch libteam] initscripts: fix if/fi align
by Hangbin Liu
Signed-off-by: Hangbin Liu <liuhangbin(a)gmail.com>
---
teamd/redhat/initscripts/network-scripts/ifup-Team | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/teamd/redhat/initscripts/network-scripts/ifup-Team b/teamd/redhat/initscripts/network-scripts/ifup-Team
index a245dac..1e38b8f 100755
--- a/teamd/redhat/initscripts/network-scripts/ifup-Team
+++ b/teamd/redhat/initscripts/network-scripts/ifup-Team
@@ -36,7 +36,7 @@ if [ -n "${TEAM_CONFIG}" ]; then
if [ ! -x /usr/bin/teamd ]; then
net_log $"Team support not available: teamd not found"
exit 1
- fi
+ fi
/usr/bin/teamd ${TEAMD_CMDLINE} -d -D -t ${DEVICE} -c "${TEAM_CONFIG}" -p /var/run/teamd-${DEVICE}.pid || exit 1
# Bring up all existing port devices now
for device in $(LANG=C egrep -l "^[[:space:]]*TEAM_MASTER=\"?${DEVICE}\"?" /etc/sysconfig/network-scripts/ifcfg-*) ; do
--
2.19.2
4 years, 2 months
[patch libteam] initscripts: need add the port before update config
by Hangbin Liu
After c8b356a3cd36 ("teamd: config: update local prio to kernel"),
we update team port prio not only on local, but also on kernel side.
So we need to add the port to team first before update TEAM_PORT_CONFIG.
Or the teamd_config_port_update() would be failed because we could not find
the port in teamd_get_port_by_ifname() during teamd_config_port_set().
Reported-by: LiLiang <liali(a)redhat.com>
Fixes: c8b356a3cd36 ("teamd: config: update local prio to kernel")
Signed-off-by: Hangbin Liu <liuhangbin(a)gmail.com>
---
teamd/redhat/initscripts/network-scripts/ifup-TeamPort | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/teamd/redhat/initscripts/network-scripts/ifup-TeamPort b/teamd/redhat/initscripts/network-scripts/ifup-TeamPort
index 8c3cc3a..954b47a 100755
--- a/teamd/redhat/initscripts/network-scripts/ifup-TeamPort
+++ b/teamd/redhat/initscripts/network-scripts/ifup-TeamPort
@@ -51,8 +51,8 @@ if [ -n "${TEAM_MASTER}" ]; then
exit 0
fi
/sbin/ip link set dev ${DEVICE} down
+ /usr/bin/teamdctl ${TEAM_MASTER} port add ${DEVICE} || exit 1
if [ -n "${TEAM_PORT_CONFIG}" ]; then
/usr/bin/teamdctl ${TEAM_MASTER} port config update ${DEVICE} "${TEAM_PORT_CONFIG}" || exit 1
fi
- /usr/bin/teamdctl ${TEAM_MASTER} port add ${DEVICE} || exit 1
fi
--
2.19.2
4 years, 2 months
[PATCH] teamd: fix a json object memleak in get_port_obj()
by Xin Long
The issue can be noticed simply by doing:
# ip link add aeth0 type dummy
# teamd -d -t ateam0 -c '{"link_watch" : {"name" : "ethtool"}}'
# teamdctl ateam0 port add aeth0
# while true; do
# teamdctl ateam0 config dump actual > /dev/null
# date "+%Y-%m-%dT%H:%M:%S $(ps -auwwx | grep teamd |grep -v grep)"
# done
After 30 mins:
USER PID %CPU %MEM VSZ ... COMMAND
2019-06-06T06:25:55 root 26574 0.0 0.0 66572 ... teamd ...
...
2019-06-06T06:55:55 root 26574 1.2 0.6 89012 ... teamd ...
MEM used by team grew from 0.0% to 0.6%, VSZ from 66572 to 89012.
get_port_obj() calld in teamd_config_actual_dump() should not have used
json_object_set(), which can json_incref the child object causing later
json_decref(parent object) not to be able to free it.
So change to use json_object_set_new(), a function for setting newly
created objects, and it won't json_incref the child object that will
be freed when its parent object gets freed later.
Fixes: c6eba4866e18 ("teamd: add possibility to add/change port config")
Reported-by: Michael Colombo <mcolombo(a)redhat.com>
Signed-off-by: Xin Long <lucien.xin(a)gmail.com>
---
teamd/teamd_config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/teamd/teamd_config.c b/teamd/teamd_config.c
index 69b25de..34fef1f 100644
--- a/teamd/teamd_config.c
+++ b/teamd/teamd_config.c
@@ -84,7 +84,7 @@ static int get_port_obj(json_t **pport_obj, json_t *config_json,
ports_obj = json_object();
if (!ports_obj)
return -ENOMEM;
- err = json_object_set(config_json, "ports", ports_obj);
+ err = json_object_set_new(config_json, "ports", ports_obj);
if (err) {
json_decref(ports_obj);
return -ENOMEM;
@@ -95,7 +95,7 @@ static int get_port_obj(json_t **pport_obj, json_t *config_json,
port_obj = json_object();
if (!port_obj)
return -ENOMEM;
- err = json_object_set(ports_obj, port_name, port_obj);
+ err = json_object_set_new(ports_obj, port_name, port_obj);
if (err) {
json_decref(port_obj);
return -ENOMEM;
--
2.1.0
4 years, 2 months