diff options
author | David Teigland <teigland@redhat.com> | 2019-01-16 10:41:43 -0600 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2019-01-16 10:49:04 -0600 |
commit | e158835a05963c8cb4166100c9d01e7ff3991c82 (patch) | |
tree | 82e82da1605ccc9027daeaafa20853c79aadfa8a /tools/vgchange.c | |
parent | 7b5abc3fb19c7569ad86107cfbf30f39ca261fed (diff) | |
download | lvm2-e158835a05963c8cb4166100c9d01e7ff3991c82.tar.gz |
lvmlockd: make lockstart wait for existing start
If there are two independent scripts doing:
vgchange --lockstart vg
lvchange -ay vg/lv
The first vgchange to do the lockstart will wait for
the lockstart to complete before returning.
The second vgchange to do the lockstart will see that
the start is already in progress (from the first) and
will do nothing. This means the second does not wait
for any lockstart to complete, and moves on to the
lvchange which may find the lockspace still starting
and fail.
To fix this, make the vgchange lockstart command
wait for any lockstart's in progress to complete.
Diffstat (limited to 'tools/vgchange.c')
-rw-r--r-- | tools/vgchange.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/vgchange.c b/tools/vgchange.c index bbdf2e4eb..f831fd907 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -560,6 +560,7 @@ static int _vgchange_lock_start(struct cmd_context *cmd, struct volume_group *vg { const char *start_opt = arg_str_value(cmd, lockopt_ARG, NULL); int auto_opt = 0; + int exists = 0; int r; if (!vg_is_shared(vg)) @@ -586,10 +587,12 @@ static int _vgchange_lock_start(struct cmd_context *cmd, struct volume_group *vg } do_start: - r = lockd_start_vg(cmd, vg, 0); + r = lockd_start_vg(cmd, vg, 0, &exists); if (r) vp->lock_start_count++; + else if (exists) + vp->lock_start_count++; if (!strcmp(vg->lock_type, "sanlock")) vp->lock_start_sanlock = 1; |