[lxc-devel] call to setup_dev_symlinks with lxc.autodev

Michael H. Warfield mhw at WittsEnd.com
Thu Apr 17 19:04:06 UTC 2014


On Thu, 2014-04-17 at 18:20 +0200, William Dauchy wrote:
> On Thu, Apr 17, 2014 at 5:49 PM, Michael H. Warfield <mhw at wittsend.com> wrote:
> > Without first understanding why this is failing, I would vote against
> > it.  That's just ignoring a problem when we don't fully understand it.

> yup I will dig into it but as I already said, my first need was to
> disable such things when you know your FS is RO.

> > Right now, I would suggest a temporary patch where we ignore the error
> > and print a full warning message of what the error is.  If I send you a
> > patch, can you apply it and try it out?

Ok...  Below my signature block is a test patch.  If what I suspect is
true, it might actually fix the problem.  It's overloaded with various
messages to try and tell me what's happening and what's going wrong if
it doesn't.  So it's a test and recon patch.  If it fixes the problem,
not all of those messages will go into the patch I send in.  Don't run
it with your mount hook script.  Run it the way it would have failed.

Patch it and build new rpm's bumping the cycle in lxc.spec.in then
update.

Then run something like this:

lxc-start -n ${NAME} [your various options] -o logfile.txt -l DEBUG

Then send me the logfile.txt file.

> Yes.

> -- 
> William

Regards,
Mike
-- 
Michael H. Warfield (AI4NB) | (770) 978-7061 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!


-- diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 06235fb..65f1f85 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -828,19 +828,38 @@ static int setup_dev_symlinks(const struct lxc_rootfs *rootfs)
 {
 	char path[MAXPATHLEN];
 	int ret,i;
+	struct stat s;
 
 
+	INFO("Entering setup_dev_symlinks");
 	for (i = 0; i < sizeof(dev_symlinks) / sizeof(dev_symlinks[0]); i++) {
 		const struct dev_symlinks *d = &dev_symlinks[i];
 		ret = snprintf(path, sizeof(path), "%s/dev/%s", rootfs->mount, d->name);
 		if (ret < 0 || ret >= MAXPATHLEN)
 			return -1;
+
+		/*
+		 * Stat the path first.  If we don't get an error
+		 * accept it as is and don't try to create it
+		 */
+		if (!stat(path, &s)) {
+			INFO("Symlink to %s exists", path);
+			continue;
+		}
+
+		INFO("Creating symlink from %s to %s", d->oldpath, path);
 		ret = symlink(d->oldpath, path);
+
 		if (ret && errno != EEXIST) {
-			SYSERROR("Error creating %s", path);
-			return -1;
+			if ( errno == EROFS ) {
+				SYSERROR("Warning: Read Only file system while creating %s", path);
+			} else {
+				SYSERROR("Error creating %s", path);
+				return -1;
+			}
 		}
 	}
+	INFO("Exiting setup_dev_symlinks");
 	return 0;
 }
 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 482 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140417/5995db78/attachment.sig>


More information about the lxc-devel mailing list