1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lv_update_and_reload: use proper lock holder

When requesting to reload an LV imrove this API to
automatically reload its lock holding LV as in cluster
only top-level LVs are addressable with lock.
This commit is contained in:
Zdenek Kabelac 2014-09-22 13:57:47 +02:00
parent 9776979b02
commit fa6482344c
2 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
Improve lv_update_and_reload() to find out proper lock holding LV.
Improve search of LV in lv_ondisk().
Do not scan sysfs in lv_check_not_in_use() when device is closed.
Backup final metadata after resync of mirror/raid.

View File

@ -5701,16 +5701,17 @@ static int _lv_update_and_reload(struct logical_volume *lv, int origin_only)
{
struct volume_group *vg = lv->vg;
int do_backup = 0, r = 0;
const struct logical_volume *lock_lv = lv_lock_holder(lv);
log_very_verbose("Updating logical volume %s on disk(s).",
display_lvname(lv));
display_lvname(lock_lv));
if (!vg_write(vg))
return_0;
if (!(origin_only ? suspend_lv_origin(vg->cmd, lv) : suspend_lv(vg->cmd, lv))) {
if (!(origin_only ? suspend_lv_origin(vg->cmd, lock_lv) : suspend_lv(vg->cmd, lock_lv))) {
log_error("Failed to lock logical volume %s.",
display_lvname(lv));
display_lvname(lock_lv));
vg_revert(vg);
} else if (!(r = vg_commit(vg)))
stack; /* !vg_commit() has implict vg_revert() */
@ -5718,11 +5719,11 @@ static int _lv_update_and_reload(struct logical_volume *lv, int origin_only)
do_backup = 1;
log_very_verbose("Updating logical volume %s in kernel.",
display_lvname(lv));
display_lvname(lock_lv));
if (!(origin_only ? resume_lv_origin(vg->cmd, lv) : resume_lv(vg->cmd, lv))) {
if (!(origin_only ? resume_lv_origin(vg->cmd, lock_lv) : resume_lv(vg->cmd, lock_lv))) {
log_error("Problem reactivating logical volume %s.",
display_lvname(lv));
display_lvname(lock_lv));
r = 0;
}