This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch test-sched
in repository sanlock.
commit 5142d99184a301dbc37870e93e8ffa07b41c3495
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/sanlock.8 | 7 +++++++
src/sanlock.conf | 3 +++
src/sanlock_internal.h | 2 ++
7 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/src/cmd.c b/src/cmd.c
index 5c91181..cdeac7a 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -2267,6 +2267,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 "
@@ -2295,6 +2296,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 4afd4db..75c792d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2819,6 +2819,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;
@@ -3865,6 +3870,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/sanlock.8 b/src/sanlock.8
index 0ee8d95..0328b17 100644
--- a/src/sanlock.8
+++ b/src/sanlock.8
@@ -1378,6 +1378,13 @@ sched_warn_renew_sec = <seconds>
Log a warning if the intended delay between lockspace renewals
is this many seconds later than intended. Set to 0 to disable.
+.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 5d47ad1..71eee41 100644
--- a/src/sanlock.conf
+++ b/src/sanlock.conf
@@ -69,3 +69,6 @@
#
# sched_warn_renew_sec = <seconds>
# 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 b103209..22507c3 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.