Print this page
Forgot to merge in unlink of ZONE_LOCK in dlmgmtd.
dlmgmt mismerge
OS-3007 dlmgmtd needs to work with non-native zones
*** 20,29 ****
--- 20,30 ----
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2014 Joyent, Inc. All rights reserved.
*/
/*
* The dlmgmtd daemon is started by the datalink-management SMF service.
* This daemon is used to manage <link name, linkid> mapping and the
*** 129,141 ****
dlmgmt_door_attach(zoneid_t zoneid, char *rootdir)
{
int fd;
int err = 0;
char doorpath[MAXPATHLEN];
! (void) snprintf(doorpath, sizeof (doorpath), "%s%s", rootdir,
! DLMGMT_DOOR);
/*
* Create the door file for dlmgmtd.
*/
if ((fd = open(doorpath, O_CREAT|O_RDONLY, 0644)) == -1) {
--- 130,151 ----
dlmgmt_door_attach(zoneid_t zoneid, char *rootdir)
{
int fd;
int err = 0;
char doorpath[MAXPATHLEN];
+ struct stat statbuf;
! /* Handle running in a non-native branded zone (i.e. has /native) */
! (void) snprintf(doorpath, sizeof (doorpath), "%s/native%s",
! rootdir, DLMGMT_TMPFS_DIR);
! if (stat(doorpath, &statbuf) == 0) {
! (void) snprintf(doorpath, sizeof (doorpath), "%s/native%s",
! rootdir, DLMGMT_DOOR);
! } else {
! (void) snprintf(doorpath, sizeof (doorpath), "%s%s",
! rootdir, DLMGMT_DOOR);
! }
/*
* Create the door file for dlmgmtd.
*/
if ((fd = open(doorpath, O_CREAT|O_RDONLY, 0644)) == -1) {
*** 190,211 ****
* Create the DLMGMT_TMPFS_DIR directory.
*/
(void) snprintf(tmpfsdir, sizeof (tmpfsdir), "%s%s", rootdir,
DLMGMT_TMPFS_DIR);
if (stat(tmpfsdir, &statbuf) < 0) {
if (mkdir(tmpfsdir, (mode_t)0755) < 0)
return (errno);
} else if ((statbuf.st_mode & S_IFMT) != S_IFDIR) {
return (ENOTDIR);
}
if ((chmod(tmpfsdir, 0755) < 0) ||
(chown(tmpfsdir, UID_DLADM, GID_NETADM) < 0)) {
return (EPERM);
}
! if ((err = dlmgmt_db_init(zoneid)) != 0)
return (err);
return (dlmgmt_door_attach(zoneid, rootdir));
}
/*
--- 200,229 ----
* Create the DLMGMT_TMPFS_DIR directory.
*/
(void) snprintf(tmpfsdir, sizeof (tmpfsdir), "%s%s", rootdir,
DLMGMT_TMPFS_DIR);
if (stat(tmpfsdir, &statbuf) < 0) {
+ if (mkdir(tmpfsdir, (mode_t)0755) < 0) {
+ /*
+ * Handle running in a non-native branded zone
+ * (i.e. has /native)
+ */
+ (void) snprintf(tmpfsdir, sizeof (tmpfsdir),
+ "%s/native%s", rootdir, DLMGMT_TMPFS_DIR);
if (mkdir(tmpfsdir, (mode_t)0755) < 0)
return (errno);
+ }
} else if ((statbuf.st_mode & S_IFMT) != S_IFDIR) {
return (ENOTDIR);
}
if ((chmod(tmpfsdir, 0755) < 0) ||
(chown(tmpfsdir, UID_DLADM, GID_NETADM) < 0)) {
return (EPERM);
}
! if ((err = dlmgmt_db_init(zoneid, rootdir)) != 0)
return (err);
return (dlmgmt_door_attach(zoneid, rootdir));
}
/*
*** 260,269 ****
--- 278,289 ----
dlmgmt_log(LOG_ERR, "signal() for SIGTERM/INT failed: %s",
strerror(err));
return (err);
}
+ (void) unlink(ZONE_LOCK);
+
/*
* First derive the name of the cache file from the FMRI name. This
* cache name is used to keep active datalink configuration.
*/
if (debug) {