[libvirt] [PATCH] Handle ENOTSUP from setfilecon on FUSE in LXC startup

Daniel P. Berrange berrange at redhat.com
Thu May 16 18:00:04 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

The setfilecon method can return ENOTSUP when trying to set
the context of the /proc/meminfo FUSE filesystem. We must
ignore this error and carry on, to prevent container startup
failing entirely

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/lxc/lxc_container.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 48ccc09..9295d80 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -782,10 +782,15 @@ static int lxcContainerMountProcFuse(virDomainDefPtr def,
         ret = setfilecon(meminfo_path, scon);
         freecon(scon);
         if (ret < 0) {
-            virReportSystemError(errno,
-                                 _("Failed to set security context of %s for /proc/meminfo mount point"),
-                                 meminfo_path);
-            return ret;
+            if (errno == ENOTSUP) {
+                VIR_WARN("Setting security context of %s for /proc/meminfo not supported",
+                         meminfo_path);
+            } else {
+                virReportSystemError(errno,
+                                     _("Failed to set security context of %s for /proc/meminfo mount point"),
+                                     meminfo_path);
+                return ret;
+            }
         }
     }
 # endif
-- 
1.8.2.1




More information about the libvir-list mailing list