1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-02 13:47:42 +03:00

Fix free_vg order

As now the FID management is more complex, the code inside free_vg needs
to access some parts of memory pools which were not needed before.

For this - makes the order of unlock_and_free_vg() unconditional.
Keek using unlock_and_free_vg() API function.

For properly working VG locking mechanism only the alphabeting locking
orderer needs to be preserved.

TODO: there could be few more code parts simplified when we 'officially'
support of referencies between different memory pools.
This commit is contained in:
Zdenek Kabelac 2011-03-30 14:35:00 +00:00
parent f00b069236
commit 3b0651049b
2 changed files with 14 additions and 14 deletions

View File

@ -151,13 +151,13 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
vg_from->name, vg_to->name);
r = ECMD_PROCESSED;
bad:
if (lock_vg_from_first) {
unlock_and_free_vg(cmd, vg_to, vg_name_to);
unlock_and_free_vg(cmd, vg_from, vg_name_from);
} else {
unlock_and_free_vg(cmd, vg_from, vg_name_from);
unlock_and_free_vg(cmd, vg_to, vg_name_to);
}
/*
* Note: as vg_to is referencing moved elements from vg_from
* the order of free_vg calls is mandatory.
*/
unlock_and_free_vg(cmd, vg_to, vg_name_to);
unlock_and_free_vg(cmd, vg_from, vg_name_from);
return r;
}

View File

@ -487,12 +487,12 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
r = ECMD_PROCESSED;
bad:
if (lock_vg_from_first) {
unlock_and_free_vg(cmd, vg_to, vg_name_to);
unlock_and_free_vg(cmd, vg_from, vg_name_from);
} else {
unlock_and_free_vg(cmd, vg_from, vg_name_from);
unlock_and_free_vg(cmd, vg_to, vg_name_to);
}
/*
* Note: as vg_to is referencing moved elements from vg_from
* the order of free_vg calls is mandatory.
*/
unlock_and_free_vg(cmd, vg_to, vg_name_to);
unlock_and_free_vg(cmd, vg_from, vg_name_from);
return r;
}