[sanlock] branch master updated: release 3.9.0
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
The following commit(s) were added to refs/heads/master by this push:
new 23766f9 release 3.9.0
23766f9 is described below
commit 23766f9119b7c06b463110aeb9b969a742f0fe23
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Dec 13 16:47:19 2023 -0600
release 3.9.0
---
VERSION | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/VERSION b/VERSION
index 0cbfaed..a5c4c76 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.8.5
+3.9.0
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 months, 2 weeks
[sanlock] 06/06: sanlock: replace strncat for creating debug output
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit 19575183392dab154ca1b9962189cd666c4576b6
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Dec 12 17:50:58 2023 -0600
sanlock: replace strncat for creating debug output
---
src/paxos_lease.c | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/src/paxos_lease.c b/src/paxos_lease.c
index 179d8e7..5643739 100644
--- a/src/paxos_lease.c
+++ b/src/paxos_lease.c
@@ -51,6 +51,35 @@ int get_rand(int a, int b);
#define BK_DEBUG_COUNT 4
#define BK_STR_SIZE 80
+static void bk_debug_append(char *bk_debug, char *bk_str)
+{
+ int off = 0;
+ int i, j;
+
+ /* bk_debug buffer is BK_DEBUG_SIZE, bk_str is BK_STR_SIZE */
+ /* include as much debugging text in bk_debug as will fit */
+
+ for (i = 0; i < BK_DEBUG_SIZE - 1; i++) {
+ if (!bk_debug[i]) {
+ off = i;
+ break;
+ }
+ }
+
+ if (off >= (BK_DEBUG_SIZE-1)) {
+ bk_debug[BK_DEBUG_SIZE-1] = '\0';
+ return;
+ }
+
+ for (j = 0; j < strlen(bk_str); j++) {
+ bk_debug[off++] = bk_str[j];
+ if (off >= BK_DEBUG_SIZE) {
+ bk_debug[BK_DEBUG_SIZE-1] = '\0';
+ return;
+ }
+ }
+}
+
static uint32_t roundup_power_of_two(uint32_t val)
{
val--;
@@ -577,7 +606,7 @@ static int run_ballot(struct task *task, struct token *token, uint32_t flags,
(unsigned long long)bk_in.lver,
bk_in.flags);
bk_str[BK_STR_SIZE-1] = '\0';
- strncat(bk_debug, bk_str, BK_STR_SIZE-1);
+ bk_debug_append(bk_debug, bk_str);
bk_debug_count++;
}
@@ -790,7 +819,7 @@ static int run_ballot(struct task *task, struct token *token, uint32_t flags,
(unsigned long long)bk->lver,
bk->flags);
bk_str[BK_STR_SIZE-1] = '\0';
- strncat(bk_debug, bk_str, BK_STR_SIZE-1);
+ bk_debug_append(bk_debug, bk_str);
bk_debug_count++;
}
@@ -1407,7 +1436,7 @@ static int _lease_read_one(struct task *task,
(unsigned long long)bk.lver,
bk.flags);
bk_str[BK_STR_SIZE-1] = '\0';
- strncat(bk_debug, bk_str, BK_STR_SIZE-1);
+ bk_debug_append(bk_debug, bk_str);
bk_debug_count++;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 months, 2 weeks
[sanlock] 05/06: sanlock: reduce warnings
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit 666d4da3769b91b40c7030190360e33e94f921ad
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Dec 12 16:14:32 2023 -0600
sanlock: reduce warnings
Stop treating the non-null-terminated buffers as strings
to avoid warnings.
---
src/cmd.c | 12 ++++++------
src/delta_lease.c | 2 +-
src/direct.c | 12 ++++++------
src/leader.h | 4 ++--
src/lockspace.c | 9 +++++----
src/main.c | 11 +++++++----
src/paxos_lease.c | 4 ++--
src/resource.c | 4 ++--
src/rindex.c | 2 +-
src/sanlock.h | 12 ++++++------
src/sanlock_internal.h | 4 ++--
11 files changed, 40 insertions(+), 36 deletions(-)
diff --git a/src/cmd.c b/src/cmd.c
index ae57bf3..64ee409 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -358,7 +358,7 @@ static void cmd_acquire(struct task *task, struct cmd_args *ca, uint32_t cmd)
goto done;
}
- strncpy(cl->owner_name, opt.owner_name, SANLK_NAME_LEN);
+ memcpy(cl->owner_name, opt.owner_name, SANLK_NAME_LEN);
/* data after opt is not used */
/*
@@ -2511,7 +2511,7 @@ static void send_state_daemon(int fd)
int str_len;
memset(&st, 0, sizeof(st));
- strncpy(st.name, our_host_name_global, NAME_ID_SIZE);
+ memcpy(st.name, our_host_name_global, NAME_ID_SIZE);
st.type = SANLK_STATE_DAEMON;
@@ -2534,7 +2534,7 @@ static void send_state_client(int fd, struct client *cl, int ci)
st.type = SANLK_STATE_CLIENT;
st.data32 = cl->pid;
- strncpy(st.name, cl->owner_name, NAME_ID_SIZE);
+ memcpy(st.name, cl->owner_name, NAME_ID_SIZE);
str_len = print_state_client(cl, ci, str);
@@ -2556,7 +2556,7 @@ static void send_state_lockspace(int fd, struct space *sp, const char *list_name
st.type = SANLK_STATE_LOCKSPACE;
st.data64 = sp->host_id;
- strncpy(st.name, sp->space_name, NAME_ID_SIZE);
+ memcpy(st.name, sp->space_name, NAME_ID_SIZE);
str_len = print_state_lockspace(sp, str, list_name);
@@ -2567,7 +2567,7 @@ static void send_state_lockspace(int fd, struct space *sp, const char *list_name
send_all(fd, str, str_len, MSG_NOSIGNAL);
memset(&lockspace, 0, sizeof(struct sanlk_lockspace));
- strncpy(lockspace.name, sp->space_name, NAME_ID_SIZE);
+ memcpy(lockspace.name, sp->space_name, NAME_ID_SIZE);
lockspace.host_id = sp->host_id;
memcpy(&lockspace.host_id_disk, &sp->host_id_disk, sizeof(struct sanlk_disk));
@@ -2590,7 +2590,7 @@ void send_state_resource(int fd, struct resource *r, const char *list_name,
st.type = SANLK_STATE_RESOURCE;
st.data32 = pid;
st.data64 = r->leader.lver;
- strncpy(st.name, r->r.name, NAME_ID_SIZE);
+ memcpy(st.name, r->r.name, NAME_ID_SIZE);
str_len = print_state_resource(r, str, list_name, token_id);
diff --git a/src/delta_lease.c b/src/delta_lease.c
index d36d4e0..4ac63ef 100644
--- a/src/delta_lease.c
+++ b/src/delta_lease.c
@@ -900,7 +900,7 @@ int delta_lease_init(struct task *task,
leader.max_hosts = 1;
leader.timestamp = LEASE_FREE;
leader.io_timeout = io_timeout;
- strncpy(leader.space_name, ls->name, NAME_ID_SIZE);
+ memcpy(leader.space_name, ls->name, NAME_ID_SIZE);
leader.checksum = 0; /* set below */
/* make the first record invalid so we can do a single atomic
diff --git a/src/direct.c b/src/direct.c
index f3ea7d1..73861a2 100644
--- a/src/direct.c
+++ b/src/direct.c
@@ -728,8 +728,8 @@ int direct_dump(struct task *task, char *dump_path, int force_mode)
if (!lr->owner_id && !lr->owner_generation)
continue;
- strncpy(sname, lr->space_name, NAME_ID_SIZE);
- strncpy(rname, lr->resource_name, NAME_ID_SIZE);
+ strcpy(sname, lr->space_name);
+ strcpy(rname, lr->resource_name);
printf("%08llu %36s %48s %010llu %04llu %04llu",
(unsigned long long)(start_offset + ((sector_nr + i) * sector_size)),
@@ -752,8 +752,8 @@ int direct_dump(struct task *task, char *dump_path, int force_mode)
leader_record_in(lr_end, &lr_in);
lr = &lr_in;
- strncpy(sname, lr->space_name, NAME_ID_SIZE);
- strncpy(rname, lr->resource_name, NAME_ID_SIZE);
+ strcpy(sname, lr->space_name);
+ strcpy(rname, lr->resource_name);
printf("%08llu %36s %48s %010llu %04llu %04llu %llu",
(unsigned long long)(start_offset + (sector_nr * sector_size)),
@@ -804,7 +804,7 @@ int direct_dump(struct task *task, char *dump_path, int force_mode)
rindex_header_in(rh_end, &rh_in);
rh = &rh_in;
- strncpy(sname, rh->lockspace_name, NAME_ID_SIZE);
+ strcpy(sname, rh->lockspace_name);
printf("%08llu %36s rindex_header 0x%x %d %u %llu\n",
(unsigned long long)(start_offset + (sector_nr * sector_size)),
@@ -872,7 +872,7 @@ int direct_next_free(struct task *task, char *path)
sd.offset = atoll(off_str);
}
- strncpy(sd.path, path, SANLK_PATH_LEN);
+ strncpy(sd.path, path, SANLK_PATH_LEN-1);
sd.fd = -1;
rv = open_disk(&sd);
diff --git a/src/leader.h b/src/leader.h
index 7656299..649bcf8 100644
--- a/src/leader.h
+++ b/src/leader.h
@@ -69,8 +69,8 @@ struct leader_record {
uint64_t owner_id; /* host_id of owner */
uint64_t owner_generation;
uint64_t lver;
- char space_name[NAME_ID_SIZE]; /* lockspace for resource */
- char resource_name[NAME_ID_SIZE]; /* resource being locked */
+ char space_name[NAME_ID_SIZE] __attribute__ ((nonstring)); /* lockspace for resource */
+ char resource_name[NAME_ID_SIZE] __attribute__ ((nonstring)); /* resource being locked */
uint64_t timestamp;
uint64_t unused1;
uint32_t checksum;
diff --git a/src/lockspace.c b/src/lockspace.c
index a874148..da51af0 100644
--- a/src/lockspace.c
+++ b/src/lockspace.c
@@ -449,7 +449,7 @@ void check_other_leases(struct space *sp, char *buf)
(unsigned long long)leader->owner_generation,
(unsigned long long)leader->timestamp,
leader->resource_name);
- strncpy(hs->owner_name, leader->resource_name, NAME_ID_SIZE);
+ memcpy(hs->owner_name, leader->resource_name, NAME_ID_SIZE);
}
if (hs->owner_id == leader->owner_id &&
@@ -469,7 +469,7 @@ void check_other_leases(struct space *sp, char *buf)
if (!hs->lease_bad) {
hs->owner_id = leader->owner_id;
hs->owner_generation = leader->owner_generation;
- strncpy(hs->owner_name, leader->resource_name, NAME_ID_SIZE);
+ memcpy(hs->owner_name, leader->resource_name, NAME_ID_SIZE);
hs->io_timeout = leader->io_timeout;
}
@@ -1057,9 +1057,10 @@ int add_lockspace_start(struct sanlk_lockspace *ls, uint32_t io_timeout, struct
int i;
if (!ls->name[0] || !ls->host_id || !ls->host_id_disk.path[0]) {
- log_error("add_lockspace bad args id %llu name %zu path %zu",
+ log_error("add_lockspace bad args host_id %llu name %s path %s",
(unsigned long long)ls->host_id,
- strlen(ls->name), strlen(ls->host_id_disk.path));
+ ls->name[0] ? "set" : "empty",
+ ls->host_id_disk.path[0] ? "set" : "empty");
return -EINVAL;
}
diff --git a/src/main.c b/src/main.c
index 4e7f3c0..96ad50a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1904,8 +1904,11 @@ static int parse_arg_rentry(char *str)
com.rentry.offset = offnum;
}
- if (name)
- strncpy(com.rentry.name, name, SANLK_NAME_LEN);
+ if (name) {
+ char tmps[SANLK_NAME_LEN+1] = { 0 };
+ strncpy(tmps, name, SANLK_NAME_LEN);
+ memcpy(com.rentry.name, tmps, SANLK_NAME_LEN);
+ }
return 0;
}
@@ -2886,7 +2889,7 @@ static void read_config_file(void)
} else if (!strcmp(str, "our_host_name")) {
memset(str, 0, sizeof(str));
get_val_str(line, str);
- strncpy(com.our_host_name, str, NAME_ID_SIZE);
+ memcpy(com.our_host_name, str, NAME_ID_SIZE);
} else if (!strcmp(str, "renewal_read_extend_sec")) {
/* zero is a valid setting so we need the _set field to say it's set */
@@ -3319,7 +3322,7 @@ static int do_client(void)
if (!res_ls)
break;
memset(res_ls, 0, sizeof(struct sanlk_resource));
- strcpy(res_ls->lockspace_name, com.lockspace.name);
+ memcpy(res_ls->lockspace_name, com.lockspace.name, SANLK_NAME_LEN);
com.res_args[0] = res_ls;
com.res_count = 1;
}
diff --git a/src/paxos_lease.c b/src/paxos_lease.c
index ce265e7..179d8e7 100644
--- a/src/paxos_lease.c
+++ b/src/paxos_lease.c
@@ -2467,8 +2467,8 @@ int paxos_lease_init(struct task *task,
leader.sector_size = sector_size;
leader.num_hosts = num_hosts;
leader.max_hosts = max_hosts;
- strncpy(leader.space_name, token->r.lockspace_name, NAME_ID_SIZE);
- strncpy(leader.resource_name, token->r.name, NAME_ID_SIZE);
+ memcpy(leader.space_name, token->r.lockspace_name, NAME_ID_SIZE);
+ memcpy(leader.resource_name, token->r.name, NAME_ID_SIZE);
leader.checksum = 0; /* set after leader_record_out */
memset(&rr, 0, sizeof(rr));
diff --git a/src/resource.c b/src/resource.c
index 0235b53..c1c49f9 100644
--- a/src/resource.c
+++ b/src/resource.c
@@ -107,9 +107,9 @@ static struct resource *get_free_resource(struct token *token, int *token_matche
/* find a previous r that matches token */
list_for_each_entry(r, &resources_free, list) {
- if (strcmp(r->r.lockspace_name, token->r.lockspace_name))
+ if (memcmp(r->r.lockspace_name, token->r.lockspace_name, SANLK_NAME_LEN))
continue;
- if (strcmp(r->r.name, token->r.name))
+ if (memcmp(r->r.name, token->r.name, SANLK_NAME_LEN))
continue;
if (r->r.num_disks != token->r.num_disks)
continue;
diff --git a/src/rindex.c b/src/rindex.c
index 9ef02da..0ac503e 100644
--- a/src/rindex.c
+++ b/src/rindex.c
@@ -437,7 +437,7 @@ int rindex_format(struct task *task, struct sanlk_rindex *ri)
rh.sector_size = sector_size;
rh.max_resources = max_resources;
rh.rx_offset = rx.disk->offset;
- strncpy(rh.lockspace_name, rx.ri->lockspace_name, NAME_ID_SIZE);
+ memcpy(rh.lockspace_name, rx.ri->lockspace_name, NAME_ID_SIZE);
memset(&rh_end, 0, sizeof(struct rindex_header));
rindex_header_out(&rh, &rh_end);
diff --git a/src/sanlock.h b/src/sanlock.h
index 5999630..978aac7 100644
--- a/src/sanlock.h
+++ b/src/sanlock.h
@@ -96,8 +96,8 @@ struct sanlk_disk {
#define SANLK_RES_SECTOR4K 0x00000200
struct sanlk_resource {
- char lockspace_name[SANLK_NAME_LEN]; /* terminating \0 not required */
- char name[SANLK_NAME_LEN]; /* terminating \0 not required */
+ char lockspace_name[SANLK_NAME_LEN] __attribute__ ((nonstring)); /* terminating \0 not required */
+ char name[SANLK_NAME_LEN] __attribute__ ((nonstring)); /* terminating \0 not required */
uint64_t lver; /* use with SANLK_RES_LVER */
uint64_t data64; /* per-resource command-specific data */
uint32_t data32; /* per-resource command-specific data */
@@ -120,12 +120,12 @@ struct sanlk_rindex {
uint32_t flags; /* SANLK_RIF_ */
uint32_t max_resources; /* the max res structs that will follow rindex */
uint64_t unused;
- char lockspace_name[SANLK_NAME_LEN]; /* terminating \0 not required */
+ char lockspace_name[SANLK_NAME_LEN] __attribute__ ((nonstring)); /* terminating \0 not required */
struct sanlk_disk disk; /* location of rindex */
};
struct sanlk_rentry {
- char name[SANLK_NAME_LEN]; /* terminating \0 not required */
+ char name[SANLK_NAME_LEN] __attribute__ ((nonstring)); /* terminating \0 not required */
uint64_t offset;
uint32_t flags;
uint32_t unused;
@@ -135,7 +135,7 @@ struct sanlk_rentry {
that requires the extra work of segmenting it by resource name) */
struct sanlk_options {
- char owner_name[SANLK_NAME_LEN]; /* optional user friendly name */
+ char owner_name[SANLK_NAME_LEN] __attribute__ ((nonstring)); /* optional user friendly name */
uint32_t flags;
uint32_t len; /* unused and ignored */
/* followed by len bytes (unused and ignored) */
@@ -154,7 +154,7 @@ struct sanlk_options {
#define SANLK_LSF_SECTOR4K 0x00000200
struct sanlk_lockspace {
- char name[SANLK_NAME_LEN];
+ char name[SANLK_NAME_LEN] __attribute__ ((nonstring));
uint64_t host_id;
uint32_t flags; /* SANLK_LSF_ */
struct sanlk_disk host_id_disk;
diff --git a/src/sanlock_internal.h b/src/sanlock_internal.h
index d8c027f..3e06e4f 100644
--- a/src/sanlock_internal.h
+++ b/src/sanlock_internal.h
@@ -179,7 +179,7 @@ struct host_status {
uint64_t set_bit_time;
uint16_t io_timeout;
uint16_t lease_bad;
- char owner_name[NAME_ID_SIZE];
+ char owner_name[NAME_ID_SIZE] __attribute__ ((nonstring));
};
struct renewal_history {
@@ -198,7 +198,7 @@ struct renewal_history {
struct space {
struct list_head list;
- char space_name[NAME_ID_SIZE];
+ char space_name[NAME_ID_SIZE] __attribute__ ((nonstring));
uint32_t space_id; /* used to refer to this space instance in log messages */
uint64_t host_id;
uint64_t host_generation;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 months, 2 weeks
[sanlock] 04/06: sanlock: fix direct_next_free missing init
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit 4a9f303429a01a0dda441a03c1c08fb9ac5dd5da
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Dec 12 13:52:51 2023 -0600
sanlock: fix direct_next_free missing init
---
src/direct.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/direct.c b/src/direct.c
index 7e00c52..f3ea7d1 100644
--- a/src/direct.c
+++ b/src/direct.c
@@ -860,7 +860,7 @@ int direct_next_free(struct task *task, char *path)
struct leader_record lr;
struct sync_disk sd;
uint64_t sector_nr;
- int sector_size, sector_count, datalen, align_size;
+ int sector_size = 0, sector_count, datalen, align_size = 0;
int rv;
memset(&sd, 0, sizeof(struct sync_disk));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 months, 2 weeks
[sanlock] 03/06: sanlock: use product_uuid for host name
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit d98b217dee02f436c1c3fe99e2c87b92a1019d9d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Dec 11 17:16:32 2023 -0600
sanlock: use product_uuid for host name
When there is no host name specified on the command line
or in the config file, use the value from
/sys/devices/virtual/dmi/id/product_uuid instead of
generating a random UUID each time the daemon is started.
If no product_uuid exists, the random UUID will be generated
for the host name.
---
src/main.c | 51 +++++++++++++++++++++++++++++++++++++++------------
src/sanlock.8 | 6 +++---
2 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/src/main.c b/src/main.c
index a9ceee5..4e7f3c0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1473,37 +1473,64 @@ int get_rand(int a, int b)
return a + (int) (((float)(b - a + 1)) * rv / (RAND_MAX+1.0));
}
+static void read_product_uuid(char *buf, size_t buf_size)
+{
+ FILE *fp;
+ size_t len;
+
+ if (!(fp = fopen("/sys/devices/virtual/dmi/id/product_uuid", "r")))
+ return;
+
+ if (!fgets(buf, buf_size, fp))
+ return;
+
+ if ((len = strlen(buf)) && buf[len - 1] == '\n')
+ buf[--len] = '\0';
+
+ fclose(fp);
+}
+
static void setup_host_name(void)
{
- struct utsname name;
+ char product_uuid[SANLK_NAME_LEN+1] = { 0 };
char uuid[37];
+ struct utsname name;
uuid_t uu;
int ret;
- memset(rand_state, 0, sizeof(rand_state));
- initstate(time(NULL), rand_state, sizeof(rand_state));
-
- /* use host name from command line */
+ /*
+ * Get host name value from:
+ * 1. command line
+ * 2. config file
+ * 3. /sys/devices/virtual/dmi/id/product_uuid
+ * 4. generate random uuid that won't collide with another host
+ */
if (com.our_host_name[0]) {
memcpy(our_host_name_global, com.our_host_name, SANLK_NAME_LEN);
return;
}
- /* make up something that's likely to be different among hosts */
-
memset(&our_host_name_global, 0, sizeof(our_host_name_global));
+ memset(product_uuid, 0, sizeof(product_uuid));
memset(&name, 0, sizeof(name));
memset(&uuid, 0, sizeof(uuid));
+ read_product_uuid(product_uuid, sizeof(product_uuid));
uname(&name);
- uuid_generate(uu);
- uuid_unparse_lower(uu, uuid);
- ret = snprintf(our_host_name_global, NAME_ID_SIZE, "%s.", uuid);
+ if (product_uuid[0]) {
+ ret = snprintf(our_host_name_global, SANLK_NAME_LEN, "%s.", product_uuid);
+ } else {
+ memset(rand_state, 0, sizeof(rand_state));
+ initstate(time(NULL), rand_state, sizeof(rand_state));
+ uuid_generate(uu);
+ uuid_unparse_lower(uu, uuid);
+ ret = snprintf(our_host_name_global, SANLK_NAME_LEN, "%s.", uuid);
+ }
- if (ret < NAME_ID_SIZE)
- memcpy(our_host_name_global+ret, name.nodename, NAME_ID_SIZE-ret);
+ if (ret < SANLK_NAME_LEN)
+ memcpy(our_host_name_global+ret, name.nodename, SANLK_NAME_LEN-ret);
}
static void setup_limits(void)
diff --git a/src/sanlock.8 b/src/sanlock.8
index 0776b8f..5295bf5 100644
--- a/src/sanlock.8
+++ b/src/sanlock.8
@@ -120,9 +120,9 @@ delta lease disk sector, reading it back after a delay, and verifying
it is the same.
.IP \[bu]
-If a unique host name is not specified, sanlock generates a uuid to use
-as the host's name. The delta lease algorithm depends on hosts using
-unique names.
+If a unique host name is not specified, sanlock uses the product_uuid
+if one is available, otherwise generates a uuid to use as the host's
+name. The delta lease algorithm depends on hosts using unique names.
.IP \[bu]
The application on each host should be configured with a unique host_id,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 months, 2 weeks
[sanlock] 02/06: sanlock: add comment with timeout example
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit d737809488521c15bc60fac9e34a7b872d2ac94c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Dec 11 16:36:27 2023 -0600
sanlock: add comment with timeout example
---
src/timeouts.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
diff --git a/src/timeouts.h b/src/timeouts.h
index ac9842a..73b02f1 100644
--- a/src/timeouts.h
+++ b/src/timeouts.h
@@ -464,6 +464,83 @@
* watchdog really fires.
*/
+/*
+ * Example of how long it takes to acquire a lease that was held
+ * by a failed host.
+ *
+ * wdmd test interval = 5
+ * watchdog_fire_timeout = 30
+ * io_timeout_seconds = 10
+ * id_renewal_seconds = 20
+ * id_renewal_fail_seconds = 80
+ * host_dead_seconds = 110 (id_renewal_fail_seconds + watchdog_fire_timeout)
+ *
+ * host that was killed
+ * --------------------
+ * sanlock debug output:
+ * 13:31:44 7630 [2157]: s1 delta_renew begin read
+ * 13:31:44 7630 [2157]: s1 delta_renew begin write for new ts 7630
+ * 13:31:44 7630 [2157]: s1 renewed 7630 delta_length 0 interval 20
+ * <host killed>
+ *
+ * wdmd debug output:
+ * 1702323101 keepalive 0
+ * 1702323101 test_interval 5 sleep_seconds 5 poll_timeout 5000
+ * 1702323104 test_live ci 2 renewal 7630 expire 7710
+ * 1702323104 test_interval 5 sleep_seconds 3 poll_timeout 3000
+ * <host killed>
+ *
+ * host_dead_seconds (110) after last successful renewal (13:31:44)
+ * would be 13:33:34 as the earliest another host can take a lease.
+ *
+ * host that was trying to acquire lease held by dead host
+ * -------------------------------------------------------
+ * running: while true; do date; lvchange -ay bb/lvol1; sleep 1; done
+ * Mon Dec 11 13:33:50 CST 2023
+ * LV locked by other host: bb/lvol1
+ * Failed to lock logical volume bb/lvol1.
+ * Mon Dec 11 13:33:51 CST 2023
+ * <success>
+ *
+ * sanlock debug output:
+ * 13:31:40 7584 [2342]: s1 renewed 7584 delta_length 0 interval 20
+ * ...
+ * 13:32:00 7605 [2342]: s1 renewed 7605 delta_length 0 interval 21
+ * ...
+ * in that renewal at 7605, we see the last renewal from the other host,
+ * which is shown above from the other host's logs at "13:31:44 7630".
+ * we record our own current time 7605 as the last live time for the dead host.
+ * our initial attempts to get a lease held by the dead host will fail
+ * as follows until host_dead_seconds has elapased:
+ * paxos_acquire owner 2 2 7431 host_status 2 2 7630 wait_start 7605
+ * paxos_acquire owner 2 2 7431 no wait
+ * acquire_disk rv -247 lver 0 at 0
+ * acquire_token disk error -247
+ * release_token r_flags 8 lver 0
+ * release_token done r_flags 8
+ * cmd_acquire 2,9,2124 acquire_token -247 lease owned by other host
+ *
+ * after retrying for host_dead_seconds, it succeeds:
+ * 13:33:51 7716 [2282]: s1:r5 paxos_acquire begin offset 71303168 0xa 512 1048576
+ * 13:33:51 7716 [2282]: s1:r5 leader 2 owner 2 2 7431 dblocks 1:2002:2002:2:2:7431:2:0,
+ * 13:33:51 7716 [2282]: s1:r5 paxos_acquire leader 2 owner 2 2 7431 max mbal[1] 2002 our_dblock 0 0 0 0 0 0
+ * 13:33:51 7716 [2282]: s1:r5 paxos_acquire owner 2 2 7431 host_status 2 2 7630 wait_start 7605
+ * 13:33:51 7716 [2282]: s1:r5 paxos_acquire owner 2 2 7431 delta 2 2 7630 dead 7716-7605>110
+ * 13:33:51 7716 [2282]: s1:r5 paxos_acquire leader 2 owner 2 2 7431
+ *
+ * This shows that the difference between the current time (7716) and the
+ * time it last saw the dead host alive (7605) is >= host_dead_seconds (110),
+ * so it's allowed to get the lease.
+ *
+ * The host was killed at 13:31:44 and its lease was acquired at 13:33:51.
+ * This is 127 seconds, which includes the 110 host_dead_seconds, plus
+ * 17 extra seconds that elapsed between the time the host was killed
+ * and the time that the other host ran its own renewal and recorded the
+ * final renewal of the dead host.
+ * The host that was killed last renewed at 13:31:44, and the other host's
+ * next renewal after that was at 13:32:00 which is a 16 second difference.
+ */
+
/*
* killing pids
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 months, 2 weeks
[sanlock] 01/06: sanlock: skip short delay in delta lease reacquire
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit a239c898c12a92cb5fb74f0eb74bc5919db45b94
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Dec 8 17:48:02 2023 -0600
sanlock: skip short delay in delta lease reacquire
When a host with the same host name reacquires the
same host_id, the "fast" delta lease reacquire was
still applying the short delay (default 20s) which
should not be necessary. Reduce this further to
just 1 second when the lease is also free.
---
src/delta_lease.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/delta_lease.c b/src/delta_lease.c
index 9d5aafd..d36d4e0 100644
--- a/src/delta_lease.c
+++ b/src/delta_lease.c
@@ -340,6 +340,7 @@ int delta_lease_acquire(struct task *task,
uint32_t checksum;
int other_io_timeout, other_host_dead_seconds, other_id_renewal_seconds;
int i, error, rv, delay, delta_large_delay;
+ int fast_free_delay = 0;
log_space(sp, "delta_acquire begin %.48s:%llu",
sp->space_name, (unsigned long long)host_id);
@@ -361,6 +362,19 @@ int delta_lease_acquire(struct task *task,
leader.io_timeout, sp->io_timeout);
}
+ /*
+ * This delay-free reacquire could probably be used whenever
+ * our_host_name matches the current leader.resource_name,
+ * regardless of wheter the lease is free (i.e. we cleanly
+ * released the lease last time we held it.)
+ */
+ if (!strncmp(leader.resource_name, our_host_name, NAME_ID_SIZE) &&
+ (leader.timestamp == LEASE_FREE)) {
+ log_space(sp, "delta_acquire free fast reacquire");
+ fast_free_delay = 1;
+ goto write_new;
+ }
+
if (leader.timestamp == LEASE_FREE)
goto write_new;
@@ -475,7 +489,10 @@ int delta_lease_acquire(struct task *task,
memcpy(&leader1, &leader, sizeof(struct leader_record));
- delay = 2 * other_io_timeout;
+ if (fast_free_delay)
+ delay = 1;
+ else
+ delay = 2 * other_io_timeout;
log_space(sp, "delta_acquire delta_short_delay %d", delay);
for (i = 0; i < delay; i++) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 months, 2 weeks