]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
In lxc.mount.auto, skip on ENONENT
authorStéphane Graber <stgraber@ubuntu.com>
Mon, 2 Feb 2015 09:21:20 +0000 (11:21 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 8 Feb 2015 16:16:13 +0000 (18:16 +0200)
This resolves the case where /proc/sysrq-trigger doesn't exist by simply
ignoring any mount failure on ENOENT. With the current mount list, this
will always result in a safe environment (typically the read-only
underlay).

Closes #425

v2: Don't always show an error

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c

index 36928c180c07651bcc5cb4227e6455f0657a01ee..1153c9023456319bd5f5008d1c33a500f11dd47d 100644 (file)
@@ -797,7 +797,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha
                                        default_mounts[i].flags);
                        r = mount(source, destination, default_mounts[i].fstype, mflags, default_mounts[i].options);
                        saved_errno = errno;
-                       if (r < 0)
+                       if (r < 0 && errno == ENOENT) {
+                               INFO("Mount source or target for %s on %s doesn't exist. Skipping.", source, destination);
+                               r = 0;
+                       }
+                       else if (r < 0)
                                SYSERROR("error mounting %s on %s flags %lu", source, destination, mflags);
                        free(source);
                        free(destination);