aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bitmap.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.com>2015-07-22 13:09:17 -0400
committerNeilBrown <neilb@suse.com>2015-07-22 19:22:00 -0400
commitd3b178adb3a3adf54ecf77758138b654c3ee7f09 (patch)
tree018d2ba212c10f10a6e3bbfcd3d2197918805017 /drivers/md/bitmap.c
parentee5d004fd0591536a061451eba2b187092e9127c (diff)
md: Skip cluster setup for dm-raid
There is a bug that the bitmap superblock isn't initialised properly for dm-raid, so a new field can have garbage in new fields. (dm-raid does initialisation in the kernel - md initialised the superblock in mdadm). This means that for dm-raid we cannot currently trust the new ->nodes field. So: - use __GFP_ZERO to initialise the superblock properly for all new arrays - initialise all fields in bitmap_info in bitmap_new_disk_sb - ignore ->nodes for dm arrays (yes, this is a hack) This bug exposes dm-raid to bug in the (still experimental) md-cluster code, so it is suitable for -stable. It does cause crashes. References: https://bugzilla.kernel.org/show_bug.cgi?id=100491 Cc: stable@vger.kernel.org (v4.1) Signed-off-By: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r--drivers/md/bitmap.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 135a0907e9de..c90118e90708 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -494,7 +494,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap)
494 bitmap_super_t *sb; 494 bitmap_super_t *sb;
495 unsigned long chunksize, daemon_sleep, write_behind; 495 unsigned long chunksize, daemon_sleep, write_behind;
496 496
497 bitmap->storage.sb_page = alloc_page(GFP_KERNEL); 497 bitmap->storage.sb_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
498 if (bitmap->storage.sb_page == NULL) 498 if (bitmap->storage.sb_page == NULL)
499 return -ENOMEM; 499 return -ENOMEM;
500 bitmap->storage.sb_page->index = 0; 500 bitmap->storage.sb_page->index = 0;
@@ -541,6 +541,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap)
541 sb->state = cpu_to_le32(bitmap->flags); 541 sb->state = cpu_to_le32(bitmap->flags);
542 bitmap->events_cleared = bitmap->mddev->events; 542 bitmap->events_cleared = bitmap->mddev->events;
543 sb->events_cleared = cpu_to_le64(bitmap->mddev->events); 543 sb->events_cleared = cpu_to_le64(bitmap->mddev->events);
544 bitmap->mddev->bitmap_info.nodes = 0;
544 545
545 kunmap_atomic(sb); 546 kunmap_atomic(sb);
546 547
@@ -611,8 +612,16 @@ re_read:
611 daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ; 612 daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ;
612 write_behind = le32_to_cpu(sb->write_behind); 613 write_behind = le32_to_cpu(sb->write_behind);
613 sectors_reserved = le32_to_cpu(sb->sectors_reserved); 614 sectors_reserved = le32_to_cpu(sb->sectors_reserved);
614 nodes = le32_to_cpu(sb->nodes); 615 /* XXX: This is a hack to ensure that we don't use clustering
615 strlcpy(bitmap->mddev->bitmap_info.cluster_name, sb->cluster_name, 64); 616 * in case:
617 * - dm-raid is in use and
618 * - the nodes written in bitmap_sb is erroneous.
619 */
620 if (!bitmap->mddev->sync_super) {
621 nodes = le32_to_cpu(sb->nodes);
622 strlcpy(bitmap->mddev->bitmap_info.cluster_name,
623 sb->cluster_name, 64);
624 }
616 625
617 /* verify that the bitmap-specific fields are valid */ 626 /* verify that the bitmap-specific fields are valid */
618 if (sb->magic != cpu_to_le32(BITMAP_MAGIC)) 627 if (sb->magic != cpu_to_le32(BITMAP_MAGIC))