[lxc-devel] [lxc/master] log: fixes

brauner on Github lxc-bot at linuxcontainers.org
Fri Feb 15 22:54:36 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 446 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190215/de8dc36b/attachment.bin>
-------------- next part --------------
From 29a7b484ffa86e8b552bd90dc26d9ea5f577eed2 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 15 Feb 2019 23:42:30 +0100
Subject: [PATCH 1/2] conf: do not log devpts umount2() failure

We're not acting based on the return value so don't log anything.

Fixes: https://discuss.linuxcontainers.org/t/warning-in-the-container-log/4072/2
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/conf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 65011cef3..cb5730af6 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1639,11 +1639,7 @@ static int lxc_setup_devpts(struct lxc_conf *conf)
 	if (ret < 0 || (size_t)ret >= sizeof(devpts_mntopts))
 		return -1;
 
-	ret = umount2("/dev/pts", MNT_DETACH);
-	if (ret < 0)
-		SYSWARN("Failed to unmount old devpts instance");
-	else
-		DEBUG("Unmounted old devpts instance");
+	(void)umount2("/dev/pts", MNT_DETACH);
 
 	/* Create mountpoint for devpts instance. */
 	ret = mkdir("/dev/pts", 0755);

From 24548539af7fa95cd9ca7b971eb9f301065492e0 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 15 Feb 2019 23:50:34 +0100
Subject: [PATCH 2/2] network: do not log false friends

The netlink functions just return -1 and not specific negative errno values so
logging them doesn't make any sense.

Fixes: https://discuss.linuxcontainers.org/t/warning-in-the-container-log/4072/2
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/network.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/lxc/network.c b/src/lxc/network.c
index e05c56615..fd7d867fc 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -2581,10 +2581,9 @@ bool lxc_delete_network_priv(struct lxc_handler *handler)
 			     netdev->name[0] != '\0' ? netdev->name : "(null)",
 			     netdev->ifindex);
 		} else if (ret < 0) {
-			errno = -ret;
-			SYSWARN("Failed to remove interface \"%s\" with index %d",
-			        netdev->name[0] != '\0' ? netdev->name : "(null)",
-			        netdev->ifindex);
+			WARN("Failed to remove interface \"%s\" with index %d",
+			     netdev->name[0] != '\0' ? netdev->name : "(null)",
+			     netdev->ifindex);
 			goto clear_ifindices;
 		}
 		INFO("Removed interface \"%s\" with index %d",
@@ -2606,9 +2605,8 @@ bool lxc_delete_network_priv(struct lxc_handler *handler)
 
 		ret = lxc_netdev_delete_by_name(hostveth);
 		if (ret < 0) {
-			errno = -ret;
-			SYSWARN("Failed to remove interface \"%s\" from \"%s\"",
-			        hostveth, netdev->link);
+			WARN("Failed to remove interface \"%s\" from \"%s\"",
+			     hostveth, netdev->link);
 			goto clear_ifindices;
 		}
 		INFO("Removed interface \"%s\" from \"%s\"", hostveth, netdev->link);


More information about the lxc-devel mailing list