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

snapshot: improve checking of merging snapshot

Add runtime detection for 'lvs -o+seg_monitor' and 'vgchange --monitor'.
This fix should avoid unnecessary timeout on systemd shutdown.
This commit is contained in:
Zdenek Kabelac 2018-06-11 22:19:20 +02:00
parent 75fed05d3e
commit 77d5caae90
3 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 3.0.0 Version 3.0.0
============= =============
Fix unmonitoring of merging snapshots.
Cache can uses metadata format 2 with cleaner policy. Cache can uses metadata format 2 with cleaner policy.
Fix check if resized PV can also fit metadata area. Fix check if resized PV can also fit metadata area.
Avoid showing internal error in lvs output or pvmoved LVs. Avoid showing internal error in lvs output or pvmoved LVs.

View File

@ -1735,7 +1735,8 @@ int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume
* In case of a snapshot device, we monitor lv->snapshot->lv, * In case of a snapshot device, we monitor lv->snapshot->lv,
* not the actual LV itself. * not the actual LV itself.
*/ */
if (lv_is_cow(lv) && (laopts->no_merging || !lv_is_merging_cow(lv))) { if (lv_is_cow(lv) && (laopts->no_merging || !lv_is_merging_cow(lv) ||
lv_has_target_type(lv->vg->cmd->mem, lv, NULL, TARGET_NAME_SNAPSHOT))) {
if (!(r = monitor_dev_for_events(cmd, lv->snapshot->lv, NULL, monitor))) if (!(r = monitor_dev_for_events(cmd, lv->snapshot->lv, NULL, monitor)))
stack; stack;
return r; return r;

View File

@ -301,7 +301,8 @@ char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg)
int pending = 0, monitored = 0; int pending = 0, monitored = 0;
struct lv_segment *segm = (struct lv_segment *) seg; struct lv_segment *segm = (struct lv_segment *) seg;
if (lv_is_cow(seg->lv) && !lv_is_merging_cow(seg->lv)) if (lv_is_cow(seg->lv) && (!lv_is_merging_cow(seg->lv) ||
lv_has_target_type(seg->lv->vg->cmd->mem, seg->lv, NULL, TARGET_NAME_SNAPSHOT)))
segm = first_seg(seg->lv->snapshot->lv); segm = first_seg(seg->lv->snapshot->lv);
// log_debug("Query LV:%s mon:%s segm:%s tgtm:%p segmon:%d statusm:%d", seg->lv->name, segm->lv->name, segm->segtype->name, segm->segtype->ops->target_monitored, seg_monitored(segm), (int)(segm->status & PVMOVE)); // log_debug("Query LV:%s mon:%s segm:%s tgtm:%p segmon:%d statusm:%d", seg->lv->name, segm->lv->name, segm->segtype->name, segm->segtype->ops->target_monitored, seg_monitored(segm), (int)(segm->status & PVMOVE));