mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmlockd: let lockd_init_lv_args set lock_args
Set the lock_args string in addition to doing initialization. lvconvert calls lockd_init_lv_args() directly, skipping the normal lockd_init_lv() which usually sets lock_args.
This commit is contained in:
parent
096196281e
commit
696ee52ffd
@ -2946,8 +2946,13 @@ int lockd_init_lv_args(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
struct logical_volume *lv,
|
struct logical_volume *lv,
|
||||||
const char *lock_type, const char **lock_args)
|
const char *lock_type, const char **lock_args)
|
||||||
{
|
{
|
||||||
/* sanlock is the only lock type that sets per-LV lock_args. */
|
if (!lock_type)
|
||||||
if (!strcmp(lock_type, "sanlock"))
|
return 1;
|
||||||
|
if (!strcmp(lock_type, "dlm"))
|
||||||
|
*lock_args = "dlm";
|
||||||
|
else if (!strcmp(lock_type, "idm"))
|
||||||
|
*lock_args = "idm";
|
||||||
|
else if (!strcmp(lock_type, "sanlock"))
|
||||||
return _init_lv_sanlock(cmd, vg, lv->name, &lv->lvid.id[1], lock_args);
|
return _init_lv_sanlock(cmd, vg, lv->name, &lv->lvid.id[1], lock_args);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -3454,19 +3454,10 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
|||||||
metadata_lv->lock_args = NULL;
|
metadata_lv->lock_args = NULL;
|
||||||
|
|
||||||
if (!to_cachepool) {
|
if (!to_cachepool) {
|
||||||
if (!strcmp(vg->lock_type, "sanlock")) {
|
if (!lockd_init_lv_args(cmd, vg, pool_lv, vg->lock_type, &pool_lv->lock_args)) {
|
||||||
if (!lockd_init_lv_args(cmd, vg, pool_lv,
|
log_error("Cannot allocate lock for new pool LV.");
|
||||||
vg->lock_type, &pool_lv->lock_args)) {
|
goto_bad;
|
||||||
log_error("Cannot allocate lock for new pool LV.");
|
|
||||||
goto_bad;
|
|
||||||
}
|
|
||||||
pool_lv->new_lock_args = 1; /* tells vg_revert to lockd_free_lv */
|
|
||||||
} else if (!strcmp(vg->lock_type, "dlm")) {
|
|
||||||
pool_lv->lock_args = "dlm";
|
|
||||||
} else if (!strcmp(vg->lock_type, "idm")) {
|
|
||||||
pool_lv->lock_args = "idm";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lock_active_pool) {
|
if (lock_active_pool) {
|
||||||
if (!lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
|
if (!lockd_lv(cmd, pool_lv, "ex", LDLV_PERSISTENT)) {
|
||||||
log_error("Failed to lock new pool LV %s.", display_lvname(pool_lv));
|
log_error("Failed to lock new pool LV %s.", display_lvname(pool_lv));
|
||||||
|
Loading…
Reference in New Issue
Block a user