diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c index f4047d9d7..058d4b5c9 100644 --- a/lib/locking/lvmlockd.c +++ b/lib/locking/lvmlockd.c @@ -2385,6 +2385,10 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic return 1; } else if (seg_is_cache(lp) || seg_is_cache_pool(lp)) { + /* + * This should not happen because the command defs are + * checked and excluded for shared VGs early in lvcreate. + */ log_error("Use lvconvert for cache with lock type %s", vg->lock_type); return 0; @@ -2440,6 +2444,9 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic /* * Creating a thin pool and a thin lv in it. We could * probably make this work. + * + * This should not happen because the command defs are + * checked and excluded for shared VGs early in lvcreate. */ log_error("Create thin pool and thin LV separately with lock type %s", vg->lock_type); diff --git a/tools/lvcreate.c b/tools/lvcreate.c index d2199f5ce..8aa16f24a 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -1634,8 +1634,18 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name, lp->snapshot ? " as snapshot of " : "", lp->snapshot ? lp->origin_name : "", lp->segtype->name); - if (is_lockd_type(vg->lock_type)) + if (is_lockd_type(vg->lock_type)) { + if (cmd->command->command_enum == lvcreate_thin_vol_and_thinpool_CMD || + cmd->command->command_enum == lvcreate_cachepool_CMD || + cmd->command->command_enum == lvcreate_cache_vol_with_new_origin_CMD || + cmd->command->command_enum == lvcreate_thin_vol_with_thinpool_or_sparse_snapshot_CMD || + cmd->command->command_enum == lvcreate_cache_vol_with_new_origin_or_convert_to_cache_vol_with_cachepool_CMD) { + log_error("Use lvconvert to create thin pools and cache pools in a shared VG."); + goto out; + } + lp->needs_lockd_init = 1; + } if (!lv_create_single(vg, lp)) goto_out;