[lxc-devel] lxc 0.7.4 does not mount anything

Daniel Lezcano daniel.lezcano at free.fr
Fri Mar 11 22:06:46 UTC 2011


On 03/11/2011 10:23 PM, Michael Tokarev wrote:
> Daniel, this is this part:
>
> conf.c:mount_entry_on_absolute_rootfs():
>
>          aux = strstr(mntent->mnt_dir, rootfs->path);
>
>          snprintf(path, MAXPATHLEN, "%s%s", rootfs->mount,
>                   aux + strlen(rootfs->path));
>
> if rootfs->path ends with a slash we happily eat it,
> producing this in strace (I quoted it in my email):
>
> [pid  2677] read(8, "none /lxc/c0/proc proc defaults "..., 4096) = 36
> [pid  2677] mount("none", "/opt/lxc//lib/lxc/rootfsproc", "proc", 0, NULL) = 0
>
> note "rootfsproc".


It seems this modification fix the problem:

-       snprintf(path, MAXPATHLEN, "%s%s", rootfs->mount,
+       snprintf(path, MAXPATHLEN, "%s/%s", rootfs->mount,
                  aux + strlen(rootfs->path));

> Don't use strstr there - it's not strstr, it's strSTART.
> Also, it may be a good idea to also compare the beginning
> of this string with rootfs->mount - this is where 0.7.3
> mounted stuff so users of it may have changed their mounts
> already and we break them again.

... tbd

> I spotted this yesterday when someone asked for help in
> IRC but had no time to prepare a patch.
>
> And we really, REALLY need to set default log level to
> be at least warning instead of error, or else these
> useful warnings goes nowhere.

Everybody ok with this change ?

extern int lxc_log_init(const char *file, const char *priority,
                         const char *prefix, int quiet)
  {
-       int lxc_priority = LXC_LOG_PRIORITY_ERROR;
+       int lxc_priority = LXC_LOG_PRIORITY_WARN;




More information about the lxc-devel mailing list