]> git.hungrycats.org Git - linux/commitdiff
md/bitmap: don't pass -1 to bitmap_storage_alloc.
authorNeilBrown <neilb@suse.com>
Thu, 1 Oct 2015 06:03:38 +0000 (16:03 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Oct 2015 21:43:26 +0000 (14:43 -0700)
commit da6fb7a9e5bd6f04f7e15070f630bdf1ea502841 upstream.

Passing -1 to bitmap_storage_alloc() causes page->index to be set to
-1, which is quite problematic.

So only pass ->cluster_slot if mddev_is_clustered().

Fixes: b97e92574c0b ("Use separate bitmaps for each nodes in the cluster")
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/bitmap.c

index c90118e907081c808cc634f1f5cddfb2f50f510b..a7621a2589365d26f1805cfc4c06167ac2c4f6f5 100644 (file)
@@ -2000,7 +2000,8 @@ int bitmap_resize(struct bitmap *bitmap, sector_t blocks,
        if (bitmap->mddev->bitmap_info.offset || bitmap->mddev->bitmap_info.file)
                ret = bitmap_storage_alloc(&store, chunks,
                                           !bitmap->mddev->bitmap_info.external,
-                                          bitmap->cluster_slot);
+                                          mddev_is_clustered(bitmap->mddev)
+                                          ? bitmap->cluster_slot : 0);
        if (ret)
                goto err;