summaryrefslogtreecommitdiff
path: root/usr/src/lib/lvm/libmeta/common
diff options
context:
space:
mode:
authorRay Hassan <Ray.Hassan@oracle.COM>2010-06-16 10:53:17 +0100
committerRay Hassan <Ray.Hassan@oracle.COM>2010-06-16 10:53:17 +0100
commite2ef558a4ddedd0d644b0c5ec9e883f0e1f63512 (patch)
tree95b9c26d96a37fcfe45eeb35ec1846b497d3d62c /usr/src/lib/lvm/libmeta/common
parente50ee8ef3546a2325eb1ef7768c1da5758ec16e9 (diff)
downloadillumos-joyent-e2ef558a4ddedd0d644b0c5ec9e883f0e1f63512.tar.gz
6822012 race between stat(2) and /dev creation when running metaimport or metaset -t on a set.
6932906 cstyle errors in usr/src/lib/lvm/libmeta/common/meta_set_tkr.c
Diffstat (limited to 'usr/src/lib/lvm/libmeta/common')
-rw-r--r--usr/src/lib/lvm/libmeta/common/meta_set_tkr.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/usr/src/lib/lvm/libmeta/common/meta_set_tkr.c b/usr/src/lib/lvm/libmeta/common/meta_set_tkr.c
index c14c8b2e8b..27b12b2f20 100644
--- a/usr/src/lib/lvm/libmeta/common/meta_set_tkr.c
+++ b/usr/src/lib/lvm/libmeta/common/meta_set_tkr.c
@@ -19,11 +19,9 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Metadevice diskset interfaces
@@ -520,6 +518,7 @@ meta_set_take(
mddrivenamelist_t *dnlp = NULL;
int retake_flag = 0;
unsigned long node_active[BT_BITOUL(MD_MAXSIDES)];
+ mdnamelist_t *nlp = NULL;
bzero(node_active, sizeof (unsigned long) * BT_BITOUL(MD_MAXSIDES));
@@ -593,10 +592,10 @@ meta_set_take(
side = getnodeside(mynode(), sd);
if (side == MD_SIDEWILD) {
- (void) mddserror(ep, MDE_DS_HOSTNOSIDE, sp->setno, mynode(),
- NULL, mynode());
- rval = -1;
- goto out;
+ (void) mddserror(ep, MDE_DS_HOSTNOSIDE, sp->setno, mynode(),
+ NULL, mynode());
+ rval = -1;
+ goto out;
}
/*
@@ -697,10 +696,10 @@ meta_set_take(
if (sd->sd_flags & MD_SR_MB_DEVID)
dd = metaget_drivedesc(sp,
- MD_BASICNAME_OK | PRINT_FAST, ep);
+ MD_BASICNAME_OK | PRINT_FAST, ep);
else
dd = metaget_drivedesc(sp,
- MD_BASICNAME_OK, ep);
+ MD_BASICNAME_OK, ep);
/* If ep has error, then there was a failure, set rval */
if (!mdisok(ep)) {
rval = -1;
@@ -775,7 +774,7 @@ meta_set_take(
* namespace and the local set namespace.
*/
d->dd_flags |= (MD_DR_FIX_MB_DID |
- MD_DR_FIX_LB_NM_DID);
+ MD_DR_FIX_LB_NM_DID);
retake_flag = 1;
}
}
@@ -842,7 +841,7 @@ meta_set_take(
*/
newname = NULL;
ret = meta_make_sidenmlist(sp,
- d->dd_dnp, 0, NULL, ep);
+ d->dd_dnp, 0, NULL, ep);
d->dd_dnp->side_names_key = side_names_key;
if (ret == -1) {
rval = -1;
@@ -971,6 +970,20 @@ meta_set_take(
}
+ /*
+ * meta_getalldevs() will ultimately force devfsadmd to create
+ * the /dev links for all the configured metadevices if they
+ * do not already exist. This ensures that once the set is
+ * owned all the metadevices are accessible as opposed to waiting
+ * for devfsadmd to create them.
+ */
+ if (meta_getalldevs(sp, &nlp, FALSE, ep) != 0) {
+ metafreenamelist(nlp);
+ goto rollback;
+ }
+
+ metafreenamelist(nlp);
+
pathname_return = pathname_reload(&sp, sp->setno, ep);
if ((pathname_return == METADEVADM_ERR) ||
(pathname_return == METADEVADM_DSKNAME_ERR)) {