md: fix loading of out-of-date bitmap.
commit192966f9f34028e04437e29afc0d936be2fc7052
authorNeilBrown <neilb@suse.de>
Thu, 7 May 2009 02:47:19 +0000 (7 12:47 +1000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 18 May 2009 23:34:33 +0000 (18 16:34 -0700)
treedaefba996825771321bf5b84de2e055e5e2e73e9
parent0861795f956793edd5cb4f8316b1c14f3dd4470a
md: fix loading of out-of-date bitmap.

commit b74fd2826c5acce20e6f691437b2d19372bc2057 upstream.

When md is loading a bitmap which it knows is out of date, it fills
each page with 1s and writes it back out again.  However the
write_page call makes used of bitmap->file_pages and
bitmap->last_page_size which haven't been set correctly yet.  So this
can sometimes fail.

Move the setting of file_pages and last_page_size to before the call
to write_page.

This bug can cause the assembly on an array to fail, thus making the
data inaccessible.  Hence I think it is a suitable candidate for
-stable.

Reported-by: Vojtech Pavlik <vojtech@suse.cz>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/bitmap.c