src/delta_lease.c | 3 +++
src/direct.c | 8 +-------
src/direct_lib.c | 3 ---
src/main.c | 22 ++++++++++++----------
src/paxos_lease.c | 5 +++++
src/sanlock_direct.h | 4 ++--
6 files changed, 23 insertions(+), 22 deletions(-)
New commits:
commit 6dccd60507a50756b49517e764012758ea2bdc23
Author: David Teigland <teigland(a)redhat.com>
Date: Fri Jun 24 14:09:46 2011 -0500
sanlock: zero num_hosts uses DEFAULT_MAX_HOSTS
the same as zero max_hosts does
diff --git a/src/delta_lease.c b/src/delta_lease.c
index a2683ad..a7f46d1 100644
--- a/src/delta_lease.c
+++ b/src/delta_lease.c
@@ -503,6 +503,9 @@ int delta_lease_init(struct task *task,
int align_size;
int i, rv;
+ if (!max_hosts)
+ max_hosts = DEFAULT_MAX_HOSTS;
+
align_size = direct_align(disk);
if (disk->sector_size * max_hosts > align_size)
diff --git a/src/direct.c b/src/direct.c
index 5c57574..03c6a16 100644
--- a/src/direct.c
+++ b/src/direct.c
@@ -373,7 +373,7 @@ int direct_align(struct sync_disk *disk)
}
/*
- * sanlock direct init -n <num_hosts> [-s LOCKSPACE] [-r RESOURCE]
+ * sanlock direct init [-s LOCKSPACE] [-r RESOURCE]
*
* Note: host_id not used for init, whatever is given in LOCKSPACE
* is ignored
@@ -390,12 +390,6 @@ int direct_init(struct task *task,
rv = do_delta_action(ACT_INIT, task, ls, max_hosts, NULL, NULL);
} else if (res) {
- if (!num_hosts)
- return -EINVAL;
-
- if (num_hosts > max_hosts)
- return SANLK_LEADER_NUMHOSTS;
-
if (!res->num_disks)
return -ENODEV;
diff --git a/src/direct_lib.c b/src/direct_lib.c
index f0a3dcb..71b19e9 100644
--- a/src/direct_lib.c
+++ b/src/direct_lib.c
@@ -102,9 +102,6 @@ int sanlock_direct_init(struct sanlk_lockspace *ls,
setup_task_lib(&task, use_aio, DEFAULT_IO_TIMEOUT);
- if (!max_hosts)
- max_hosts = DEFAULT_MAX_HOSTS;
-
rv = direct_init(&task, ls, res, max_hosts, num_hosts);
close_task_aio(&task);
diff --git a/src/main.c b/src/main.c
index d110f4e..5918c6c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1860,6 +1860,10 @@ static void process_cmd_thread_resource(int ci_in, struct sm_header
*h_recv)
}
if (cl->cmd_active) {
+ if (com.quiet_fail && cl->cmd_active == SM_CMD_ACQUIRE) {
+ result = -EBUSY;
+ goto out;
+ }
log_error("cmd %d %d,%d,%d cmd_active %d",
h_recv->cmd, ci_target, cl->fd, cl->pid,
cl->cmd_active);
@@ -2411,17 +2415,16 @@ static void print_usage(void)
printf(" -p <pid> process whose resource leases should be
displayed\n");
printf("\n");
- printf("direct init -n <num_hosts> [-s LOCKSPACE] [-r RESOURCE]\n");
+ printf("direct init [-s LOCKSPACE] [-r RESOURCE]\n");
printf(" -a <num> use async io (1 yes, 0 no)\n");
printf(" -n <num_hosts> host_id's from 1 to num_hosts will be able to
acquire\n");
- printf(" a resource lease. This is also number of sectors
that\n");
- printf(" are read when paxos is run to acquire a resource
lease.\n");
- printf(" -m <max_hosts> disk space is allocated to support this many
hosts\n");
- printf(" (default max_hosts %d)\n",
DEFAULT_MAX_HOSTS);
- printf(" -s LOCKSPACE initialize host_id leases for host_id's 1 to
max_hosts\n");
- printf(" (the specific host_id in the LOCKSPACE arg is
ignored)\n");
- printf(" -r RESOURCE initialize a resource lease for use by
host_id's 1 to\n");
- printf(" num_hosts (num_hosts can be extended up to
max_hosts)\n");
+ printf(" a resource lease.\n");
+ printf(" (default %d)\n", DEFAULT_MAX_HOSTS);
+ printf(" -m <max_hosts> disk space is initialized for this many
hosts\n");
+ printf(" (default %d)\n", DEFAULT_MAX_HOSTS);
+ printf(" -s LOCKSPACE initialize host_id leases for a lockspace\n");
+ printf(" (host_id in the LOCKSPACE arg is ignored for
init)\n");
+ printf(" -r RESOURCE initialize a resource lease\n");
printf("\n");
printf("direct dump <path>[:<offset>] [options]\n");
printf(" -D debug: print extra info for debugging\n");
@@ -2966,7 +2969,6 @@ int main(int argc, char *argv[])
BUILD_BUG_ON(sizeof(struct sanlk_disk) != sizeof(struct sync_disk));
memset(&com, 0, sizeof(com));
- com.max_hosts = DEFAULT_MAX_HOSTS;
com.use_watchdog = DEFAULT_USE_WATCHDOG;
com.high_priority = DEFAULT_HIGH_PRIORITY;
com.max_worker_threads = DEFAULT_MAX_WORKER_THREADS;
diff --git a/src/paxos_lease.c b/src/paxos_lease.c
index 82010db..8560e8b 100644
--- a/src/paxos_lease.c
+++ b/src/paxos_lease.c
@@ -1468,6 +1468,11 @@ int paxos_lease_init(struct task *task,
int aio_timeout = 0;
int rv, d;
+ if (!num_hosts)
+ num_hosts = DEFAULT_MAX_HOSTS;
+ if (!max_hosts)
+ max_hosts = DEFAULT_MAX_HOSTS;
+
align_size = direct_align(&token->disks[0]);
if (token->disks[0].sector_size * (2 + max_hosts) > align_size)
diff --git a/src/sanlock_direct.h b/src/sanlock_direct.h
index 83f1522..b698c79 100644
--- a/src/sanlock_direct.h
+++ b/src/sanlock_direct.h
@@ -29,8 +29,8 @@ int sanlock_direct_live_id(struct sanlk_lockspace *ls,
int io_timeout_sec);
/*
- * Use max_hosts = 0 for default max_hosts value
- *
+ * Use max_hosts = 0 for default value.
+ * Use num_hosts = 0 for default value.
* Provide either lockspace or resource, not both
*/