summaryrefslogtreecommitdiff
path: root/usr/src/cmd/lvm
diff options
context:
space:
mode:
authorrd117015 <none@none>2006-01-25 08:22:05 -0800
committerrd117015 <none@none>2006-01-25 08:22:05 -0800
commit43b3654d24cf70957f8bd04f71b1919adebad28d (patch)
tree8f969b04209cfac340eafd65615330cd7129811d /usr/src/cmd/lvm
parente0ddff35438f277370a2eae5c6718cd5ba0fe3ab (diff)
downloadillumos-gate-43b3654d24cf70957f8bd04f71b1919adebad28d.tar.gz
PSARC 2005/665 Removal of metaset(1M)'s undocumented "-n" option
6242768 metaset cannot take disk set after metad client create : RPC: Timed out
Diffstat (limited to 'usr/src/cmd/lvm')
-rw-r--r--usr/src/cmd/lvm/rpc.metad/metad_svc_subr.c59
-rw-r--r--usr/src/cmd/lvm/util/metaset.c42
2 files changed, 61 insertions, 40 deletions
diff --git a/usr/src/cmd/lvm/rpc.metad/metad_svc_subr.c b/usr/src/cmd/lvm/rpc.metad/metad_svc_subr.c
index c858736318..690b963239 100644
--- a/usr/src/cmd/lvm/rpc.metad/metad_svc_subr.c
+++ b/usr/src/cmd/lvm/rpc.metad/metad_svc_subr.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -4429,8 +4428,8 @@ mdrpc_lock_set_common(
int op_mode = W_OK;
md_setkey_t *svc_skp;
md_setkey_t new_sk;
- md_set_desc *sd;
- mdsetname_t *sp;
+ md_set_desc *sd = NULL;
+ mdsetname_t *sp = NULL;
/* setup, check permissions */
(void) memset(res, 0, sizeof (*res));
@@ -4441,6 +4440,50 @@ mdrpc_lock_set_common(
svc_skp = svc_get_setkey(args->cl_sk->sk_setno);
+ /* The set is locked */
+ if (svc_skp != NULL) {
+
+ /*
+ * This lock request could be for a new diskset, as
+ * such metasetnosetname() may not return anything
+ * useful. Only call it if there is already a key.
+ */
+ if ((sp = metasetnosetname(args->cl_sk->sk_setno, ep))
+ != NULL) {
+ sd = metaget_setdesc(sp, ep);
+ }
+
+ /*
+ * meta_lock() provides local locking for non-MN
+ * disksets. The local lock is held before we call
+ * this RPC function. We should not receive a lock
+ * request from the host which owns the lock. If we
+ * do, release the lock.
+ */
+ if (!((sd != NULL) && (MD_MNSET_DESC(sd))) &&
+ (strcmp(svc_skp->sk_host, args->cl_sk->sk_host) == 0)) {
+ md_eprintf(
+ "Warning: set locked when lock_set called!\n");
+
+ md_eprintf("Held lock info:\n");
+
+ md_eprintf("\tLock:\n");
+ md_eprintf("\t\tSetname: %s\n", svc_skp->sk_setname);
+ md_eprintf("\t\tSetno: %d\n", svc_skp->sk_setno);
+ md_eprintf("\t\tHost: %s\n", svc_skp->sk_host);
+ md_eprintf("\t\tKey: %d/%d %s\n",
+ svc_skp->sk_key.tv_sec, svc_skp->sk_key.tv_usec,
+ ctime((const time_t *)&svc_skp->sk_key.tv_sec));
+
+ /* Unlock set */
+ del_sk(svc_skp->sk_setno);
+ free_sk(svc_skp);
+ svc_skp = NULL;
+
+ md_eprintf("Released lock held by requesting host\n");
+ }
+ }
+
/* The set is unlocked */
if (svc_skp == NULL) {
/* If we have been given a key, use it. */
@@ -4470,9 +4513,7 @@ mdrpc_lock_set_common(
* commands are issued at the same time - one will complete
* and the other command will fail with MDE_DS_NOTNOW_CMD.
*/
- if (((sp = metasetnosetname(args->cl_sk->sk_setno, ep)) != NULL) &&
- ((sd = metaget_setdesc(sp, ep)) != NULL) &&
- (MD_MNSET_DESC(sd))) {
+ if ((sd != NULL) && MD_MNSET_DESC(sd)) {
(void) mddserror(ep, MDE_DS_NOTNOW_CMD,
svc_skp->sk_setno, mynode(),
svc_skp->sk_host, svc_skp->sk_setname);
diff --git a/usr/src/cmd/lvm/util/metaset.c b/usr/src/cmd/lvm/util/metaset.c
index 856beab172..59c803d2f3 100644
--- a/usr/src/cmd/lvm/util/metaset.c
+++ b/usr/src/cmd/lvm/util/metaset.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1402,7 +1401,6 @@ parse_releaseset(int argc, char **argv)
md_error_t status = mdnullerror;
md_error_t *ep = &status;
char *sname = MD_LOCAL_NAME;
- int no_lock = 0;
sdssc_boolean_e cluster_release = SDSSC_False;
sdssc_version_t vers;
rval_e rval;
@@ -1411,14 +1409,11 @@ parse_releaseset(int argc, char **argv)
/* reset and parse args */
optind = 1;
opterr = 1;
- while ((c = getopt(argc, argv, "C:ns:r")) != -1) {
+ while ((c = getopt(argc, argv, "C:s:r")) != -1) {
switch (c) {
case 'C':
cluster_release = SDSSC_True;
break;
- case 'n':
- no_lock = 1;
- break;
case 's':
sname = optarg;
break;
@@ -1486,12 +1481,8 @@ parse_releaseset(int argc, char **argv)
}
if (meta_lock_nowait(sp, ep) != 0) {
- if (no_lock) {
- mdclrerror(ep); /* continue */
- } else {
- mde_perror(ep, "");
- md_exit(sp, 10); /* special errcode */
- }
+ mde_perror(ep, "");
+ md_exit(sp, 10); /* special errcode */
}
if (meta_set_release(sp, ep)) {
@@ -1516,7 +1507,6 @@ parse_takeset(int argc, char **argv)
static char *nullopts[] = { NULL };
md_error_t status = mdnullerror;
md_error_t *ep = &status;
- int no_lock = 0;
sdssc_boolean_e cluster_take = SDSSC_False;
sdssc_version_t vers;
rval_e rval;
@@ -1524,7 +1514,7 @@ parse_takeset(int argc, char **argv)
/* reset and parse args */
optind = 1;
opterr = 1;
- while ((c = getopt(argc, argv, "C:fns:tu:y")) != -1) {
+ while ((c = getopt(argc, argv, "C:fs:tu:y")) != -1) {
switch (c) {
case 'C':
cluster_take = SDSSC_True;
@@ -1532,9 +1522,6 @@ parse_takeset(int argc, char **argv)
case 'f':
flags |= TAKE_FORCE;
break;
- case 'n':
- no_lock = 1;
- break;
case 's':
sname = optarg;
break;
@@ -1655,12 +1642,8 @@ parse_takeset(int argc, char **argv)
}
if (meta_lock_nowait(sp, ep) != 0) {
- if (no_lock) {
- mdclrerror(ep);
- } else {
- mde_perror(ep, "");
- md_exit(sp, 10); /* special errcode */
- }
+ mde_perror(ep, "");
+ md_exit(sp, 10); /* special errcode */
}
if (meta_set_take(sp, &mhiargs, flags, usetag, &status)) {
@@ -2094,7 +2077,7 @@ parse_cluster(int argc, char **argv)
/* reset and parse args */
optind = 1;
opterr = 1;
- while ((c = getopt(argc, argv, "C:s:h:fntu:yr")) != -1) {
+ while ((c = getopt(argc, argv, "C:s:h:ftu:yr")) != -1) {
switch (c) {
case 'C':
if (cmd != ccnotspecified) {
@@ -2129,7 +2112,6 @@ parse_cluster(int argc, char **argv)
break;
case 'f':
- case 'n':
case 't':
case 'u':
case 'y':
@@ -2279,7 +2261,7 @@ main(int argc, char *argv[])
* NOTE: The "C" option is strictly for cluster use. it is not
* and should not be documented for the customer. - JST
*/
- while ((c = getopt(argc, argv, "C:MaA:bdfh:jl:Lm:noPqrs:tu:wy?"))
+ while ((c = getopt(argc, argv, "C:MaA:bdfh:jl:Lm:oPqrs:tu:wy?"))
!= -1) {
switch (c) {
case 'M':
@@ -2338,8 +2320,6 @@ main(int argc, char *argv[])
break;
case 'm':
break;
- case 'n':
- break;
case 'o':
if (cmd != notspecified) {
usage(sp, gettext(