]> git.baikalelectronics.ru Git - kernel.git/commit
md/bitmap: disable bitmap_resize for file-backed bitmaps.
authorNeilBrown <neilb@suse.com>
Thu, 31 Aug 2017 00:23:25 +0000 (10:23 +1000)
committerShaohua Li <shli@fb.com>
Fri, 1 Sep 2017 05:57:03 +0000 (22:57 -0700)
commit1394d596c154781bfa700b1081f4e9d9fd260ba6
treec5cb1e121dccf6ce94396fa89af3ac605e0c807d
parent691552ae5ec32a86eafcc4f6fa61b58b454e9517
md/bitmap: disable bitmap_resize for file-backed bitmaps.

bitmap_resize() does not work for file-backed bitmaps.
The buffer_heads are allocated and initialized when
the bitmap is read from the file, but resize doesn't
read from the file, it loads from the internal bitmap.
When it comes time to write the new bitmap, the bh is
non-existent and we crash.

The common case when growing an array involves making the array larger,
and that normally means making the bitmap larger.  Doing
that inside the kernel is possible, but would need more code.
It is probably easier to require people who use file-backed
bitmaps to remove them and re-add after a reshape.

So this patch disables the resizing of arrays which have
file-backed bitmaps.  This is better than crashing.

Reported-by: Zhilong Liu <zlliu@suse.com>
Fixes: 25bc4aa1619c ("md/bitmap: add bitmap_resize function to allow bitmap resizing.")
Cc: stable@vger.kernel.org (v3.5+).
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/bitmap.c