]> git.baikalelectronics.ru Git - kernel.git/commit
md: set and test the ->persistent flag for md devices more consistently
authorNeilBrown <neilb@suse.de>
Wed, 6 Feb 2008 09:39:53 +0000 (01:39 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 6 Feb 2008 18:41:18 +0000 (10:41 -0800)
commit4435580470b7786b87e8b9c8f06c28d6dfc7f695
treead88e997edf7b13843a1a3991811dc5e44a4166a
parent43063d4e3ba86170096cbc2dfbc4a0e7e4a0a3cb
md: set and test the ->persistent flag for md devices more consistently

If you try to start an array for which the number of raid disks is listed as
zero, md will currently try to read metadata off any devices that have been
given.  This was done because the value of raid_disks is used to signal
whether array details have been provided by userspace (raid_disks > 0) or must
be read from the devices (raid_disks == 0).

However for an array without persistent metadata (or with externally managed
metadata) this is the wrong thing to do.  So we add a test in do_md_run to
give an error if raid_disks is zero for non-persistent arrays.

This requires that mddev->persistent is set corrently at this point, which it
currently isn't for in-kernel autodetected arrays.

So set ->persistent for autodetect arrays, and remove the settign in
super_*_validate which is now redundant.

Also clear ->persistent when stopping an array so it is consistently zero when
starting an array.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/md.c