1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-29 06:50:38 +03:00

thin: improve swapping of identifiers

Since we may want to swap names when LVs are complex types, we cannot
avoid doing full renames on both LV stacks.
Temporarily use 'pvmove_tmeta' as unused name to prevent validation troubles.
This commit is contained in:
Zdenek Kabelac 2015-09-11 20:56:53 +02:00
parent 280a6275ce
commit fda853b573
3 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.131 -
=====================================
Swapping of LV identifiers handles more complex LVs.
Use passed list of PVS when allocating space in lvconvert --thinpool.
Disallow usage of --stripe and --stripesize when creating cache pool.
Warn user when caching raid or thin pool data LV.

View File

@ -2489,14 +2489,14 @@ deactivate_pmslv:
if (!detach_pool_metadata_lv(first_seg(pool_lv), &mlv))
return_0;
/* Swap _pmspare and _tmeta name */
if (!swap_lv_identifiers(cmd, mlv, pmslv))
return_0;
/* Used _pmspare will become _tmeta */
if (!attach_pool_metadata_lv(first_seg(pool_lv), pmslv))
return_0;
/* Used _tmeta will become visible _meta%d */
/* Used _tmeta (now _pmspare) becomes _meta%d */
if (!lv_rename_update(cmd, mlv, pms_path, 0))
return_0;

View File

@ -44,15 +44,20 @@ int swap_lv_identifiers(struct cmd_context *cmd,
struct logical_volume *a, struct logical_volume *b)
{
union lvid lvid;
const char *name;
const char *aname = a->name, *bname = b->name;
lvid = a->lvid;
a->lvid = b->lvid;
b->lvid = lvid;
name = a->name;
a->name = b->name;
if (!lv_rename_update(cmd, b, name, 0))
/* rename temporarily to 'unused' name */
if (!lv_rename_update(cmd, a, "pmove_tmeta", 0))
return_0;
/* name rename 'b' to unused name of 'a' */
if (!lv_rename_update(cmd, b, aname, 0))
return_0;
/* finish name swapping */
if (!lv_rename_update(cmd, a, bname, 0))
return_0;
return 1;