Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c363c74a251a5745…
Commit: c363c74a251a5745e8ac6e274d1f7a1e32fa1843
Parent: 58734d2538854ef79e6605ba69c57723737d12c2
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Fri Apr 12 11:30:04 2013 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Fri Apr 12 11:30:04 2013 -0500
CLEAN-UP: Better string checking to avoid substring matches
Commit 9fd7ac7d035f0b2f8dcc3cb19935eb181816bd76 introduced a way a
method of avoiding reading from mirrors with a device failure. If
a device was found to be dead, the mapping table was checked for
'handle_errors' or 'block_on_error'. These strings were checked for
in the table string via 'strstr', which could also match on strings
like, 'no_handle_errors' or 'no_block_on_error'. No such strings
exist, but we don't want to have problems in the future if they do.
So, we check for ' <string>{'\0'|' '}'.
---
lib/activate/dev_manager.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 8c06476..00c0126 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -239,7 +239,7 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
dev_t log_dev;
char *images_health, *log_health;
uint64_t s,l;
- char *params, *target_type = NULL;
+ char *p, *params, *target_type = NULL;
void *next = NULL;
struct dm_task *dmt = NULL;
int r = 0;
@@ -306,8 +306,10 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
if (strcmp(target_type, "mirror"))
goto_out;
- if (strstr(params, "block_on_error") ||
- strstr(params, "handle_errors")) {
+ if (((p = strstr(params, " block_on_error")) &&
+ (p[15] == '\0' || p[15] == ' ')) ||
+ ((p = strstr(params, " handle_errors")) &&
+ (p[14] == '\0' || p[14] == ' '))) {
log_debug_activation("%s: I/O blocked to mirror device",
dev_name(dev));
goto out;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=faeea370571b6525…
Commit: faeea370571b6525d9d95d2904aaacbdb9552e00
Parent: ff64e3500f6acf93dce017388445c4828111d06f
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Apr 11 15:57:14 2013 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Thu Apr 11 15:57:14 2013 -0500
RAID: Revert previous commit that allowed identical table loads.
Revert commit 31c24dd9f2ad7b5f7913a18c9f11a00d7b3474a1. This commit
was used to force a RAID device-mapper table to be loaded into the
kernel despite the fact that it was identical to the one already
loaded. The effect allowed a RAID array with a transiently failed
device to refresh and reintegrate the failed device. This operation
is better done in the kernel on a 'resume'. Since,
'lvchange --refresh' already performs a suspend/resume cycle, the
above commit is not needed once the kernel change is made. Reverting
the commit removes an unnecessary (at least for now) change to the
device-mapper interface.
---
lib/raid/raid.c | 15 ---------------
libdm/libdevmapper.h | 3 +--
libdm/libdm-deptree.c | 20 +-------------------
3 files changed, 2 insertions(+), 36 deletions(-)
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 69b6ee3..1e28c73 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -161,7 +161,6 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
uint32_t s;
uint64_t flags = 0;
uint64_t rebuilds = 0;
- char *raid_health = NULL;
if (!seg->area_count) {
log_error(INTERNAL_ERROR "_raid_add_target_line called "
@@ -191,20 +190,6 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)),
if (mirror_in_sync())
flags = DM_NOSYNC;
- /*
- * If the RAID LV is not 'PARTIAL' and the status indicates
- * that the array has failed devices, it means that the
- * failed devices have returned and can be reintegrated.
- *
- * We reload the (potentially identical) table to force the
- * kernel to re-read the RAID superblocks - possibly restoring
- * transiently failed devices.
- */
- if (!(seg->lv->status & PARTIAL_LV) &&
- lv_raid_dev_health(seg->lv, &raid_health) &&
- strchr(raid_health, 'D'))
- dm_tree_node_force_identical_table_reload(node);
-
if (!dm_tree_node_add_raid_target(node, len, _raid_name(seg),
seg->region_size, seg->stripe_size,
rebuilds, flags))
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 2f2c77d..172976f 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -501,14 +501,13 @@ struct dm_tree_node *dm_tree_next_child(void **handle,
uint32_t inverted);
/*
- * Get and set properties of a node.
+ * Get properties of a node.
*/
const char *dm_tree_node_get_name(const struct dm_tree_node *node);
const char *dm_tree_node_get_uuid(const struct dm_tree_node *node);
const struct dm_info *dm_tree_node_get_info(const struct dm_tree_node *node);
void *dm_tree_node_get_context(const struct dm_tree_node *node);
int dm_tree_node_size_changed(const struct dm_tree_node *dnode);
-int dm_tree_node_force_identical_table_reload(struct dm_tree_node *dnode);
/*
* Returns the number of children of the given node (excluding the root node).
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 750f494..9f82174 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -232,16 +232,6 @@ struct load_properties {
/* Send messages for this node in preload */
unsigned send_messages;
-
- /*
- * If a mapping table is replacing an existing identical table,
- * the load is suppressed by default - avoiding the construction
- * of an unnecessary in-kernel table. Sometimes we want to avoid
- * this optimization and load the identical table anyway. This
- * field is used to indicate that we desire identical tables to be
- * loaded and not suppressed.
- */
- unsigned force_identical_table_reload;
};
/* Two of these used to join two nodes with uses and used_by. */
@@ -597,13 +587,6 @@ int dm_tree_node_size_changed(const struct dm_tree_node *dnode)
return dnode->props.size_changed;
}
-int dm_tree_node_force_identical_table_reload(struct dm_tree_node *dnode)
-{
- dnode->props.force_identical_table_reload = 1;
- return 1;
-}
-
-
int dm_tree_node_num_children(const struct dm_tree_node *node, uint32_t inverted)
{
if (inverted) {
@@ -2426,8 +2409,7 @@ static int _load_node(struct dm_tree_node *dnode)
seg, &seg_start))
goto_out;
- if (!dnode->props.force_identical_table_reload &&
- !dm_task_suppress_identical_reload(dmt))
+ if (!dm_task_suppress_identical_reload(dmt))
log_error("Failed to suppress reload of identical tables.");
if ((r = dm_task_run(dmt))) {