mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
metadata: Fix unlock on VG recovery error path.
If lock conversion failed it tried to unlock VG that was no longer locked.
This commit is contained in:
parent
177ece01a9
commit
17e304e0ac
@ -1,5 +1,6 @@
|
||||
Version 2.02.107 -
|
||||
==================================
|
||||
Fix _recover_vg() error path when lock conversion fails.
|
||||
Use X for LV attributes that are unknown when activation disabled.
|
||||
Only output lvdisplay 'LV Status' field when activation is enabled.
|
||||
Use lvmetad_used() in pvscan instead of config_tree.
|
||||
|
@ -4105,6 +4105,9 @@ int vg_check_status(const struct volume_group *vg, uint64_t status)
|
||||
return !_vg_bad_status_bits(vg, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* VG is left unlocked on failure
|
||||
*/
|
||||
static struct volume_group *_recover_vg(struct cmd_context *cmd,
|
||||
const char *vg_name, const char *vgid)
|
||||
{
|
||||
@ -4118,11 +4121,14 @@ static struct volume_group *_recover_vg(struct cmd_context *cmd,
|
||||
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE, NULL))
|
||||
return_NULL;
|
||||
|
||||
if (!(vg = vg_read_internal(cmd, vg_name, vgid, 1, &consistent)))
|
||||
if (!(vg = vg_read_internal(cmd, vg_name, vgid, 1, &consistent))) {
|
||||
unlock_vg(cmd, vg_name);
|
||||
return_NULL;
|
||||
}
|
||||
|
||||
if (!consistent) {
|
||||
release_vg(vg);
|
||||
unlock_vg(cmd, vg_name);
|
||||
return_NULL;
|
||||
}
|
||||
|
||||
@ -4202,7 +4208,7 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
|
||||
log_error("Recovery of volume group \"%s\" failed.",
|
||||
vg_name);
|
||||
failure |= FAILED_INCONSISTENT;
|
||||
goto bad;
|
||||
goto bad_no_unlock;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4237,6 +4243,7 @@ bad:
|
||||
if (!already_locked && !(misc_flags & READ_WITHOUT_LOCK))
|
||||
unlock_vg(cmd, vg_name);
|
||||
|
||||
bad_no_unlock:
|
||||
return _vg_make_handle(cmd, vg, failure);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user