diff options
author | David Teigland <teigland@redhat.com> | 2015-12-09 11:51:25 -0600 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2015-12-09 11:59:49 -0600 |
commit | bdba4e7a931f1e77f9c7cf6837a6c8b33b35a099 (patch) | |
tree | 8699c19a8acc82ae6704a368499479c1d0d41b3c /tools/lvrename.c | |
parent | dcd946e95a80da1b6b2d2285d9a5f41e87cb153d (diff) | |
download | lvm2-bdba4e7a931f1e77f9c7cf6837a6c8b33b35a099.tar.gz |
lvrename: move the lvmlockd LV lock
The function it was in is used for various
internal renaming of hidden LVs where a lock
from lvmlockd does not apply.
Diffstat (limited to 'tools/lvrename.c')
-rw-r--r-- | tools/lvrename.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/lvrename.c b/tools/lvrename.c index 18b02d265..217ebdc40 100644 --- a/tools/lvrename.c +++ b/tools/lvrename.c @@ -46,6 +46,18 @@ static int _lvrename_single(struct cmd_context *cmd, const char *vg_name, goto bad; } + /* + * The lvmlockd LV lock is only acquired here to ensure the LV is not + * active on another host. This requests a transient LV lock. + * If the LV is active, a persistent LV lock already exists in + * lvmlockd, and the transient lock request does nothing. + * If the LV is not active, then no LV lock exists and the transient + * lock request acquires the LV lock (or fails). The transient lock + * is automatically released when the command exits. + */ + if (!lockd_lv(cmd, lvl->lv, "ex", 0)) + goto_bad; + if (!lv_rename(cmd, lvl->lv, lp->lv_name_new)) goto_bad; |