master - lvmlockd: enable creation of cache pool with lvcreate
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=403c87c1aa7b759c95c0d3e86eb919229b4fc242 Commit: 403c87c1aa7b759c95c0d3e86eb919229b4fc242 Parent: 948f2d997990048ad6759bfb25f042a4ddbb6a83 Author: David Teigland <[email protected]> AuthorDate: Fri May 25 13:26:16 2018 -0500 Committer: David Teigland <[email protected]> CommitterDate: Wed May 30 09:25:45 2018 -0500
lvmlockd: enable creation of cache pool with lvcreate
Previously, cache pools needed to be created with lvconvert.
--- lib/locking/lvmlockd.c | 16 +++++++++++----- tools/lvcreate.c | 3 +-- 2 files changed, 12 insertions(+), 7 deletions(-)
lib/locking/lvmlockd.c +11 -5
@@ -2416,10 +2416,6 @@ int lockd_init_lv_args(struct cmd_context *cmd, struct volume_group *vg,* an LV with no lock_args will do nothing (unless the LV type causes the lock * request to be directed to another LV with a lock, e.g. to the thin pool LV * for thin LVs.) -* -* Current limitations: -* - cache-type LV's in a lockd VG must be created with lvconvert. -* - creating a thin pool and thin lv in one command is not allowed. */ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logical_volume *lv,
@@ -2448,7 +2444,17 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic/* needs_lock_init is set for LVs that need a lockd lock. */ return 1 ; - }else if (seg_is_cache (lp) ||seg_is_cache_pool (lp)) { + }else if (seg_is_cache_pool (lp)) { +/* +* A cache pool does not use a lockd lock because it cannot be +* used by itself. When a cache pool is attached to an actual +* LV, the lockd lock for that LV covers the LV and the cache +* pool attached to it. +*/ + lv->lock_args =NULL ; +return 1 ; + + }else if (seg_is_cache (lp)) {/* * This should not happen because the command defs are * checked and excluded for shared VGs early in lvcreate.
tools/lvcreate.c +1 -2
@@ -1638,8 +1638,7 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name, lp->snapshot ? lp->origin_name : "", lp->segtype->name);if (is_lockd_type (vg->lock_type)) { -if (cmd->command->command_enum == lvcreate_cachepool_CMD || - cmd->command->command_enum == lvcreate_cache_vol_with_new_origin_CMD || +if (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." );