[lxc-devel] [PATCH] In lxc.mount.auto, skip on ENONENT

Stéphane Graber stgraber at ubuntu.com
Sun Feb 1 15:19:12 UTC 2015


On Sun, Feb 01, 2015 at 07:20:37AM +0000, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgraber at ubuntu.com):
> > 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
> > 
> > Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> > ---
> >  src/lxc/conf.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> > index fbe82b5..5a99324 100644
> > --- a/src/lxc/conf.c
> > +++ b/src/lxc/conf.c
> > @@ -798,7 +798,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
> 
> This will print an error when mount succeeded.

Oops, clearly that shows I can't focus while at a conference :)

I'll send a v2 which fixes that in a bit.

> 
> >  				SYSERROR("error mounting %s on %s flags %lu", source, destination, mflags);
> >  
> >  			free(source);
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20150201/e0430e46/attachment.sig>


More information about the lxc-devel mailing list