]> git.ipfire.org Git - thirdparty/mdadm.git/commit - super1.c
Fix readding of a readwrite drive into a writemostly array
authorDoug Ledford <dledford@redhat.com>
Mon, 19 Sep 2011 03:06:38 +0000 (13:06 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 19 Sep 2011 03:06:38 +0000 (13:06 +1000)
commit16715c01f7ea4410d3b0eb3fe8bd66ab9241f036
tree577cb4f71bc616f53ccd04b3e004bd152d06bae8
parent3f555346fb26b7ee7447b004ecb2c2d57f243867
Fix readding of a readwrite drive into a writemostly array

If you create a two drive raid1 array with one device writemostly, then
fail the readwrite drive, when you add a new device, it will get the
writemostly bit copied out of the remaining device's superblock into
it's own.  You can then remove the new drive and readd it as readwrite,
which will work for the readd, but it leaves the stale WriteMostly1 bit
in devflags resulting in the device going back to writemostly on the
next assembly.

The fix is to make sure that A) when we readd a device and we might have
filled the st->sb info from a running device instead of the device being
readded, then clear/set the WriteMostly1 bit in the super1 struct in
addition to setting the disk state (ditto for super0, but slightly
different mechanism) and B) when adding a clean device to an array (when
we most certainly did copy the superblock info from an existing device),
then clear any writemostly bits.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Manage.c
mdadm.h
super0.c
super1.c