md/bitmap: fix saving of events_cleared and other state.
authorNeilBrown <neilb@suse.de>
Wed, 11 May 2011 04:26:30 +0000 (14:26 +1000)
committerSteve Conklin <sconklin@canonical.com>
Fri, 15 Jul 2011 17:21:03 +0000 (12:21 -0500)
commite881f53f3f7340298b3689f258dda2caa6e3723b
treee8ca552e2af87c526f4aebd9b4a5a2bacaa942a3
parent069a9bdea7f4d3e206b03d1a46f52e2ef05b1d92
md/bitmap: fix saving of events_cleared and other state.

BugLink: http://bugs.launchpad.net/bugs/793702

commit 8258c53208d7a9b7207e7d4dae36d2ea384cb278 upstream.

If a bitmap is found to be 'stale' the events_cleared value
is set to match 'events'.
However if the array is degraded this does not get stored on disk.
This can subsequently lead to incorrect behaviour.

So change bitmap_update_sb to always update events_cleared in the
superblock from the known events_cleared.
For neatness also set ->state from ->flags.
This requires updating ->state whenever we update ->flags, which makes
sense anyway.

This is suitable for any active -stable release.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/md/bitmap.c