From 81e12e340a1b364df9c7f7fa605cefc9ba36c3cd Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Fri, 1 Apr 2011 12:32:24 -0400 Subject: [PATCH] print errors for more cases of integrity profile mismatch --- drivers/md/dm-table.c | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 5ec4bf5..cb8380c 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -927,10 +927,11 @@ static int dm_table_build_index(struct dm_table *t) } /* - * Get the integrity profile for the table. + * Get a disk whose integrity profile reflects the table's profile. * If %match_all is true, all devices' profiles must match. * If %match_all is false, all devices must at least have an * allocated integrity profile; but uninitialized is ok. + * Returns NULL if integrity support was inconsistent or unavailable. */ static struct gendisk * dm_table_get_integrity_disk(struct dm_table *t, bool match_all) @@ -946,19 +947,19 @@ static struct gendisk * dm_table_get_integrity_disk(struct dm_table *t, if (!match_all && !blk_integrity_is_initialized(template_disk)) continue; /* skip uninitialized profiles */ else if (prev_disk && - blk_integrity_compare(prev_disk, template_disk) < 0) { - DMWARN("%s: integrity not set: %s and %s mismatch", - dm_device_name(t->md), - prev_disk->disk_name, - template_disk->disk_name); + blk_integrity_compare(prev_disk, template_disk) < 0) goto no_integrity; - } prev_disk = template_disk; } return template_disk; no_integrity: + if (prev_disk) + DMWARN("%s: integrity not set: %s and %s profile mismatch", + dm_device_name(t->md), + prev_disk->disk_name, + template_disk->disk_name); return NULL; } @@ -991,8 +992,8 @@ static int dm_table_prealloc_integrity(struct dm_table *t, struct mapped_device */ if (blk_integrity_is_initialized(template_disk) && blk_integrity_compare(dm_disk(md), template_disk) < 0) { - DMWARN("%s: existing integrity conflict: " - "%s mismatch", + DMWARN("%s: conflict with existing integrity profile: " + "%s profile mismatch", dm_device_name(t->md), template_disk->disk_name); return 1; @@ -1157,7 +1158,6 @@ combine_limits: * don't know if all devices (particularly DM devices this device * may be stacked on) have matching profiles. Even if the profiles * don't match we have no way to fail (to resume) at this point. - * FIXME: should the integrity profile be cleared? */ static void dm_table_set_integrity(struct dm_table *t) { @@ -1167,9 +1167,14 @@ static void dm_table_set_integrity(struct dm_table *t) return; template_disk = dm_table_get_integrity_disk(t, true); - if (template_disk) - blk_integrity_register(dm_disk(t->md), - blk_get_integrity(template_disk)); + if (!template_disk && + blk_integrity_is_initialized(dm_disk(t->md))) { + DMWARN("%s: device no longer has a valid integrity profile", + dm_device_name(t->md)); + return; + } + blk_integrity_register(dm_disk(t->md), + blk_get_integrity(template_disk)); } void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, -- 1.7.3.4