This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit 364ea39aa4a9cac676fb5f65e52121c77cd951da
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 8 16:22:04 2020 -0500
sanlock: write_init_io_timeout
Add a new io timeout used when initializing ondisk structures for
a lockspace or resource. This is independent of the standard
io timeout used as part of the lockspace or resource algorithm.
This write_init_io_timeout will generally be larger, can be set
in sanlock.conf, and if zero the code will fall back to using
the standard io_timeout as has been used before.
---
src/cmd.c | 2 ++
src/delta_lease.c | 16 ++++++++++++++--
src/main.c | 6 ++++++
src/paxos_lease.c | 13 ++++++++++++-
src/rindex.c | 8 +++++++-
src/sanlock.8 | 7 +++++++
src/sanlock.conf | 3 +++
src/sanlock_internal.h | 2 ++
8 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/src/cmd.c b/src/cmd.c
index 23522ba..a5fa30f 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -2265,6 +2265,7 @@ static int print_state_daemon(char *str)
"max_sectors_kb_ignore=%d "
"max_sectors_kb_align=%d "
"max_sectors_kb_num=%d "
+ "write_init_io_timeout=%u "
"use_aio=%d "
"kill_grace_seconds=%d "
"helper_pid=%d "
@@ -2291,6 +2292,7 @@ static int print_state_daemon(char *str)
com.max_sectors_kb_ignore,
com.max_sectors_kb_align,
com.max_sectors_kb_num,
+ com.write_init_io_timeout,
main_task.use_aio,
kill_grace_seconds,
helper_pid,
diff --git a/src/delta_lease.c b/src/delta_lease.c
index 5616432..9a8fc22 100644
--- a/src/delta_lease.c
+++ b/src/delta_lease.c
@@ -844,6 +844,7 @@ int delta_lease_init(struct task *task,
int sector_size = 0;
int align_size = 0;
int max_hosts = 0;
+ int write_io_timeout;
int i, rv;
uint32_t checksum;
@@ -903,8 +904,19 @@ int delta_lease_init(struct task *task,
memcpy(iobuf + (i * sector_size), &leader_end, sizeof(struct leader_record));
}
+
+ /*
+ * The io_timeout arg is a part of the lockspace logic, and
+ * determines how the lockspace times out. The process of
+ * initializing the lease on disk can to use a longer timeout
+ * than the algorithm uses.
+ */
+ if (com.write_init_io_timeout)
+ write_io_timeout = com.write_init_io_timeout;
+ else
+ write_io_timeout = io_timeout;
- rv = write_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, io_timeout, NULL);
+ rv = write_iobuf(disk->fd, disk->offset, iobuf, iobuf_len, task, write_io_timeout, NULL);
if (rv < 0)
goto out;
@@ -924,7 +936,7 @@ int delta_lease_init(struct task *task,
memcpy(iobuf, &leader_end, sizeof(struct leader_record));
- rv = write_iobuf(disk->fd, disk->offset, iobuf, sector_size, task, io_timeout, NULL);
+ rv = write_iobuf(disk->fd, disk->offset, iobuf, sector_size, task, write_io_timeout, NULL);
out:
if (rv != SANLK_AIO_TIMEOUT)
free(iobuf);
diff --git a/src/main.c b/src/main.c
index 998ee58..e2901f3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2815,6 +2815,11 @@ static void read_config_file(void)
com.renewal_read_extend_sec_set = 1;
com.renewal_read_extend_sec = val;
+ } else if (!strcmp(str, "write_init_io_timeout")) {
+ get_val_int(line, &val);
+ if (val > 0)
+ com.write_init_io_timeout = val;
+
} else if (!strcmp(str, "renewal_history_size")) {
get_val_int(line, &val);
com.renewal_history_size = val;
@@ -3857,6 +3862,7 @@ int main(int argc, char *argv[])
com.names_log_priority = LOG_WARNING;
com.max_worker_threads = DEFAULT_MAX_WORKER_THREADS;
com.io_timeout_arg = DEFAULT_IO_TIMEOUT;
+ com.write_init_io_timeout = DEFAULT_WRITE_INIT_IO_TIMEOUT;
com.aio_arg = DEFAULT_USE_AIO;
com.pid = -1;
com.sh_retries = DEFAULT_SH_RETRIES;
diff --git a/src/paxos_lease.c b/src/paxos_lease.c
index 259cd15..4850347 100644
--- a/src/paxos_lease.c
+++ b/src/paxos_lease.c
@@ -2422,6 +2422,7 @@ int paxos_lease_init(struct task *task,
int align_size = 0;
int max_hosts = 0;
int aio_timeout = 0;
+ int write_io_timeout = 0;
int rv, d;
rv = sizes_from_flags(token->r.flags, §or_size, &align_size, &max_hosts, "RES");
@@ -2488,9 +2489,19 @@ int paxos_lease_init(struct task *task,
memcpy(iobuf, &leader_end, sizeof(struct leader_record));
memcpy(iobuf + sector_size, &rr_end, sizeof(struct request_record));
+ /*
+ * The process of initializing the lease on disk can use a
+ * longer timeout than the algorithm uses.
+ */
+ if (com.write_init_io_timeout)
+ write_io_timeout = com.write_init_io_timeout;
+
for (d = 0; d < token->r.num_disks; d++) {
+ if (!write_io_timeout)
+ write_io_timeout = token->io_timeout;
+
rv = write_iobuf(token->disks[d].fd, token->disks[d].offset,
- iobuf, iobuf_len, task, token->io_timeout, NULL);
+ iobuf, iobuf_len, task, write_io_timeout, NULL);
if (rv == SANLK_AIO_TIMEOUT)
aio_timeout = 1;
diff --git a/src/rindex.c b/src/rindex.c
index 4b16835..7ee4e54 100644
--- a/src/rindex.c
+++ b/src/rindex.c
@@ -377,6 +377,7 @@ int rindex_format(struct task *task, struct sanlk_rindex *ri)
char **p_iobuf;
uint32_t max_resources;
uint32_t max_resources_limit;
+ int write_io_timeout;
int sector_size = 0;
int align_size = 0;
int max_hosts = 0;
@@ -443,7 +444,12 @@ int rindex_format(struct task *task, struct sanlk_rindex *ri)
memcpy(iobuf, &rh_end, sizeof(struct rindex_header));
- rv = write_iobuf(rx.disk->fd, rx.disk->offset, iobuf, iobuf_len, task, DEFAULT_IO_TIMEOUT, NULL);
+ if (com.write_init_io_timeout)
+ write_io_timeout = com.write_init_io_timeout;
+ else
+ write_io_timeout = DEFAULT_IO_TIMEOUT;
+
+ rv = write_iobuf(rx.disk->fd, rx.disk->offset, iobuf, iobuf_len, task, write_io_timeout, NULL);
if (rv < 0) {
log_error("rindex_format write failed %d %s", rv, rx.disk->path);
goto out_iobuf;
diff --git a/src/sanlock.8 b/src/sanlock.8
index d75211d..d77f24c 100644
--- a/src/sanlock.8
+++ b/src/sanlock.8
@@ -1365,6 +1365,13 @@ for that command. Special values +all and -all can be used to
enable or disable all commands, and can be used before or after other
debug_cmd lines.
+.IP \[bu] 2
+write_init_io_timeout = <seconds>
+.br
+The io timeout to use when initializing ondisk lease structures
+for a lockspace or resource. This timeout is not used as a part
+of either lease algorithm (as the standard io_timeout is.)
+
.SH SEE ALSO
.BR wdmd (8)
diff --git a/src/sanlock.conf b/src/sanlock.conf
index e52da2b..9b78e5c 100644
--- a/src/sanlock.conf
+++ b/src/sanlock.conf
@@ -63,3 +63,6 @@
# debug_cmd = -<name>
# ...
# command line: n/a
+#
+# write_init_io_timeout = <seconds>
+# command line: n/a
diff --git a/src/sanlock_internal.h b/src/sanlock_internal.h
index cd4d23a..4e04fa8 100644
--- a/src/sanlock_internal.h
+++ b/src/sanlock_internal.h
@@ -329,6 +329,7 @@ EXTERN struct client *client;
#define DEFAULT_SH_RETRIES 8
#define DEFAULT_QUIET_FAIL 1
#define DEFAULT_RENEWAL_HISTORY_SIZE 180 /* about 1 hour with 20 sec renewal interval */
+#define DEFAULT_WRITE_INIT_IO_TIMEOUT 60
#define DEFAULT_MAX_SECTORS_KB_IGNORE 0 /* don't change it */
#define DEFAULT_MAX_SECTORS_KB_ALIGN 0 /* set it to align size */
@@ -357,6 +358,7 @@ struct command_line {
int max_worker_threads;
int aio_arg;
int io_timeout_arg;
+ int write_init_io_timeout;
int set_bitmap_seconds;
int persistent;
int orphan_set;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.