Handle failures of mirror devices while under snapshot origin (bug 613829)
PATCH 1/1 Handle failures of mirror devices while under snapshot origin (bug 613829)
This patch makes it possible to monitor mirrors which may be under a snapshot origin.
lib/activate/activate.c +2 -1
@@ -772,7 +772,8 @@ int monitor_dev_for_events(struct cmd_coif (!monitor_dev_for_events (cmd,dm_list_struct_base (snh, struct lv_segment, origin_list)->cow, monitor)) r =0 ; -return r; +if (!lv_is_mirrored (lv)) +return r; }/*
lib/mirror/mirrored.c +4 -6
@@ -631,18 +631,16 @@ static int _target_set_events(struct lv_ int evmask __attribute__((unused)), int set) {char *dso, *uuid; -struct logical_volume *lv; -struct volume_group *vg; +struct logical_volume *lv = seg->lv; +struct volume_group *vg = lv->vg; +char *suffix =lv_is_origin (lv) ?"real" :NULL ;struct dm_event_handler *dmevh;int r; - lv = seg->lv; - vg = lv->vg; -if (!_get_mirror_dso_path (vg->cmd, &dso)) return_0; -if (!(uuid =build_dm_uuid (vg->cmd->mem, lv->lvid.s,NULL ))) +if (!(uuid =build_dm_uuid (vg->cmd->mem, lv->lvid.s, suffix))) return_0;if (!(dmevh =_create_dm_event_handler (uuid, dso,DM_EVENT_ALL_ERRORS )))
PATCH 1/1 Handle failures of mirror devices while under snapshot origin (bug 613829)
lib/activate/activate.c int monitor_dev_for_events(struct cmd_co · line 777
Quoted 12 lines · Jon Brassow
Index:
LVM2/lib/activate/activate.c
===================================================================lib/activate/activate.c +2
-1@@ -772,7 +772,8 @@ int monitor_dev_for_events(struct cmd_coif (!monitor_dev_for_events (cmd,dm_list_struct_base (snh, struct lv_segment, origin_list)->cow, monitor)) r =0 ; -return r; +if (!lv_is_mirrored (lv)) +return r; }
Please update the comment above this function too.
lib/mirror/mirrored.c static int _target_set_events(struct lv_ · line 634
Quoted 10 lines
Index:
LVM2/lib/mirror/mirrored.c
===================================================================lib/mirror/mirrored.c +1
-1@@ -631,18 +631,16 @@ static int _target_set_events(struct lv_ int evmask __attribute__((unused)), int set) -if (!(uuid =build_dm_uuid (vg->cmd->mem, lv->lvid.s,NULL ))) +if (!(uuid =build_dm_uuid (vg->cmd->mem, lv->lvid.s, suffix))) return_0;
Does the other instance of build_dm_uuid() in _target_monitored() need a similar change?
Alasdair
PATCH 1/1 Handle failures of mirror devices while under snapshot origin (bug 613829)
Quoted 15 lines · Alasdair G Kergon
lib/activate/activate.c int monitor_dev_for_events(struct cmd_co · line 777
Quoted 12 lines · Jon Brassow
Index:
LVM2/lib/activate/activate.c
===================================================================lib/activate/activate.c +2
-1@@ -772,7 +772,8 @@ int monitor_dev_for_events(struct cmd_coif (!monitor_dev_for_events (cmd,dm_list_struct_base (snh, struct lv_segment, origin_list)->cow, monitor)) r =0 ; -return r; +if (!lv_is_mirrored (lv)) +return r; }Please update the comment above this function too.
done
Quoted 8 lines
Quoted 7 lines
Index:
LVM2/lib/mirror/mirrored.c
===================================================================lib/mirror/mirrored.c +0
-0@@ -631,18 +631,16 @@ static int _target_set_events(struct lv_ int evmask __attribute__((unused)), int set)
Quoted 6 lines
lib/mirror/mirrored.c static int _target_set_events(struct lv_ · line 644
Quoted 3 lines
lib/mirror/mirrored.c +1
-1-if (!(uuid =build_dm_uuid (vg->cmd->mem, lv->lvid.s,NULL ))) +if (!(uuid =build_dm_uuid (vg->cmd->mem, lv->lvid.s, suffix))) return_0;Does the other instance of
build_dm_uuid()in_target_monitored()need a similar change?
yes, I think you are right.
I'll send updated patch for this.
brassow