summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2015-07-01 15:22:21 -0500
committerDavid Teigland <teigland@redhat.com>2015-07-01 15:22:21 -0500
commitfebcdf11f660ac44fd044cc1e82fa699fe598a54 (patch)
tree08947cf75b11c353418e95d7ef3015729b06857c
parenta31294f8cd89b7249a2c35ea6ab1cb5f8f2be291 (diff)
downloadlvm2-febcdf11f660ac44fd044cc1e82fa699fe598a54.tar.gz
lvmlockd: allow sanlock io timeout to be specified
sanlock uses 10 sec io timeout by default, but there can be times when you want to lower that to speed up sanlock operations, including in the test suite.
-rw-r--r--daemons/lvmlockd/lvmlockd-core.c8
-rw-r--r--daemons/lvmlockd/lvmlockd-internal.h1
-rw-r--r--daemons/lvmlockd/lvmlockd-sanlock.c8
3 files changed, 12 insertions, 5 deletions
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 98b637bc6..1efd4b845 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -5565,6 +5565,8 @@ static void usage(char *prog, FILE *file)
fprintf(file, " Set the local sanlock host id.\n");
fprintf(file, " --host-id-file | -F <path>\n");
fprintf(file, " A file containing the local sanlock host_id.\n");
+ fprintf(file, " --sanlock-timeout | -o <seconds>\n");
+ fprintf(file, " Set the sanlock lockspace I/O timeout.\n");
fprintf(file, " --adopt | -A 0|1\n");
fprintf(file, " Adopt locks from a previous instance of lvmlockd.\n");
}
@@ -5595,6 +5597,7 @@ int main(int argc, char *argv[])
{"host-id-file", required_argument, 0, 'F' },
{"adopt", required_argument, 0, 'A' },
{"syslog-priority", required_argument, 0, 'S' },
+ {"sanlock-timeout", required_argument, 0, 'o' },
{0, 0, 0, 0 }
};
@@ -5603,7 +5606,7 @@ int main(int argc, char *argv[])
int lm;
int option_index = 0;
- c = getopt_long(argc, argv, "hVTfDp:s:l:g:S:I:A:",
+ c = getopt_long(argc, argv, "hVTfDp:s:l:g:S:I:A:o:",
long_options, &option_index);
if (c == -1)
break;
@@ -5650,6 +5653,9 @@ int main(int argc, char *argv[])
case 'F':
daemon_host_id_file = strdup(optarg);
break;
+ case 'o':
+ sanlock_io_timeout = atoi(optarg);
+ break;
case 'A':
adopt_opt = atoi(optarg);
break;
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index b6f4056f6..e4a825bb1 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -362,6 +362,7 @@ EXTERN int daemon_test; /* run as much as possible without a live lock manager *
EXTERN int daemon_debug;
EXTERN int daemon_host_id;
EXTERN const char *daemon_host_id_file;
+EXTERN int sanlock_io_timeout;
void log_level(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
#define log_debug(fmt, args...) log_level(LOG_DEBUG, fmt, ##args)
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index 85a52c880..8f3ecffb5 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -321,7 +321,7 @@ int lm_init_vg_sanlock(char *ls_name, char *vg_name, uint32_t flags, char *vg_ar
memcpy(ss.host_id_disk.path, disk.path, SANLK_PATH_LEN);
ss.host_id_disk.offset = LS_BEGIN * align_size;
- rv = sanlock_write_lockspace(&ss, 0, 0, 0);
+ rv = sanlock_write_lockspace(&ss, 0, 0, sanlock_io_timeout);
if (rv < 0) {
log_error("S %s init_vg_san write_lockspace error %d %s",
ls_name, rv, ss.host_id_disk.path);
@@ -590,7 +590,7 @@ int lm_rename_vg_sanlock(char *ls_name, char *vg_name, uint32_t flags, char *vg_
strncpy(ss.name, ls_name, SANLK_NAME_LEN);
- rv = sanlock_write_lockspace(&ss, 0, 0, 0);
+ rv = sanlock_write_lockspace(&ss, 0, 0, sanlock_io_timeout);
if (rv < 0) {
log_error("S %s rename_vg_san write_lockspace error %d %s",
ls_name, rv, ss.host_id_disk.path);
@@ -1113,7 +1113,7 @@ int lm_add_lockspace_sanlock(struct lockspace *ls, int adopt)
struct lm_sanlock *lms = (struct lm_sanlock *)ls->lm_data;
int rv;
- rv = sanlock_add_lockspace(&lms->ss, 0);
+ rv = sanlock_add_lockspace_timeout(&lms->ss, 0, sanlock_io_timeout);
if (rv == -EEXIST && adopt) {
/* We could alternatively just skip the sanlock call for adopt. */
log_debug("S %s add_lockspace_san adopt found ls", ls->name);
@@ -1174,7 +1174,7 @@ int lm_rem_lockspace_sanlock(struct lockspace *ls, int free_vg)
*/
strncpy(lms->ss.name, "#unused", SANLK_NAME_LEN);
- rv = sanlock_write_lockspace(&lms->ss, 0, 0, 0);
+ rv = sanlock_write_lockspace(&lms->ss, 0, 0, sanlock_io_timeout);
if (rv < 0) {
log_error("S %s rem_lockspace free_vg write_lockspace error %d %s",
ls->name, rv, lms->ss.host_id_disk.path);