Commit Graph

112 Commits

Author SHA1 Message Date
NeilBrown aa7c284c06 Fix tests on ->container and ->member
For container= and member= to be effective in an mdadm.conf line
they must both be present.  So when checking for their absence we
need container != NULL || member != NULL.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:18:25 +10:00
NeilBrown 31015d5798 conf/assemble: new config line "auto".
The line 'auto' in mdadm.conf can be used to disable assembly
of specific metadata types, or of all arrays.

This does not affect assembly of arrays listed in mdadm.conf
or on command line.

 auto -all

will disable all auto-assembly.

 auto -ddf

will cause mdadm to ignore ddf arrays that are not explicitly
mentioned, and auto assemble anything else it finds.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:17:33 +10:00
NeilBrown 112cace627 config: support "ARRAY <ignore> ..." lines in mdadm.conf
Sometimes we want to ensure particular arrays are never
assembled automatically.  This might include an array made of
devices that are shared between hosts.

To support this, allow ARRAY lines in mdadm.conf to use the word
"ignore" rather than a device name.  Arrays which match such lines
are never automatically assembled (though they can still be assembled
by explicitly giving identification information on the mdadm command
line.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:17:05 +10:00
NeilBrown b1b12d5819 config: treat "container=" and "member=" and providing the required identity information.
Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-06 16:09:52 +10:00
NeilBrown 78fbcc1031 Merge branch 'master' into scratch-3.0
Conflicts:

	Assemble.c
	config.c
2009-01-08 09:31:28 +11:00
Dustin Kirkland 1a0ee0baf0 Fail overtly when asprintf fails to allocate memory
.. rather that causing a less-obvious violation of segments.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-01-08 09:25:33 +11:00
NeilBrown 9008ed1c96 Assemble: allow members of containers to be assembled and auto-assembled.
Try to treat members of containers much like other arrays for
assembly.
We still look through the list of devices for a match (it will be
the container), then find the relevant 'info' and try to assemble
the array.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:51:12 +11:00
Dan Williams f8f84cd5b9 config: add containers to the default search list
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:50:39 +11:00
Dan Williams f64165f757 config: add 'containers' as a DEVICE keyword
Add anything that looks like a container in /proc/mdstat to the devlist

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:50:39 +11:00
NeilBrown 1771a6e214 config: Support container=uuid as alternative to container=/dev/name in mdadm.conf
When mdadm.conf is automatically generated, we might not know a
suitable /dev/name.  But we do know the uuid of the container.
So allow that as an option.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:50:38 +11:00
NeilBrown fe056d1fb0 config: Don't require an array to have a device name.
i.e. in mdadm.conf you can have a line like

   ARRAY uuid=whatever

and it will use auto-name-generation to give a name to the array at
assemble-time.  The is different from blind auto-assembly in that the
array will be treated as 'local'.
2008-11-04 20:50:38 +11:00
Dan Williams 71d60c480a Preliminary -As support for container member arrays
Given an mdadm.conf like the following allow /dev/imsm and /dev/md/r1 to be
created by "mdadm -As".

DEVICES partitions 
ARRAY /dev/imsm metadata=imsm auto=md UUID=b98f5dbe-aa859e7b-0e369b89-a80986d4 
ARRAY /dev/md/r1 container=/dev/imsm member=0 auto=mdp UUID=3538e39c-b397c2e9-1aa031f9-2bc0eca4 
   spares=1

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-28 10:55:31 -07:00
Dan Williams 3d2c4fc7b6 trivial warn_unused_result squashing
Made the mistake of recompiling the F9 mdadm rpm which has a patch to
remove -Werror and add "-Wp,-D_FORTIFY_SOURCE -O2" which turns on lots
of errors:

config.c:568: warning: ignoring return value of asprintf
Assemble.c:411: warning: ignoring return value of asprintf
Assemble.c:413: warning: ignoring return value of asprintf
super0.c:549: warning: ignoring return value of posix_memalign
super0.c:742: warning: ignoring return value of posix_memalign
super0.c:812: warning: ignoring return value of posix_memalign
super1.c:692: warning: ignoring return value of posix_memalign
super1.c:1039: warning: ignoring return value of posix_memalign
super1.c:1155: warning: ignoring return value of posix_memalign
super-ddf.c:508: warning: ignoring return value of posix_memalign
super-ddf.c:645: warning: ignoring return value of posix_memalign
super-ddf.c:696: warning: ignoring return value of posix_memalign
super-ddf.c:715: warning: ignoring return value of posix_memalign
super-ddf.c:1476: warning: ignoring return value of posix_memalign
super-ddf.c:1603: warning: ignoring return value of posix_memalign
super-ddf.c:1614: warning: ignoring return value of posix_memalign
super-ddf.c:1842: warning: ignoring return value of posix_memalign
super-ddf.c:2013: warning: ignoring return value of posix_memalign
super-ddf.c:2140: warning: ignoring return value of write
super-ddf.c:2143: warning: ignoring return value of write
super-ddf.c:2147: warning: ignoring return value of write
super-ddf.c:2150: warning: ignoring return value of write
super-ddf.c:2162: warning: ignoring return value of write
super-ddf.c:2169: warning: ignoring return value of write
super-ddf.c:2172: warning: ignoring return value of write
super-ddf.c:2176: warning: ignoring return value of write
super-ddf.c:2181: warning: ignoring return value of write
super-ddf.c:2686: warning: ignoring return value of posix_memalign
super-ddf.c:2690: warning: ignoring return value of write
super-ddf.c:3070: warning: ignoring return value of posix_memalign
super-ddf.c:3254: warning: ignoring return value of posix_memalign
bitmap.c:128: warning: ignoring return value of posix_memalign
mdmon.c:94: warning: ignoring return value of write
mdmon.c:221: warning: ignoring return value of pipe
mdmon.c:327: warning: ignoring return value of write
mdmon.c:330: warning: ignoring return value of chdir
mdmon.c:335: warning: ignoring return value of dup
monitor.c:415: warning: rv may be used uninitialized in this function

...some of these like the write() ones are not so trivial so save those
fixes for the next patch.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-10-15 14:15:52 -07:00
NeilBrown dbb44303d7 Add support for assembling specific subarrays.
This normally isn't needed as --incremental does all the work.
But it is needed to recognise member= and container= in mdadm.conf
2008-09-18 16:21:08 +10:00
Neil Brown 2cdb64897d Fix for segfault when reading /proc/mdstat
Some kernel versions don't put a space between 'active' and '(auto-read-only)'
in /proc/mdstat.  This causes a parsing problem leaving 'level' set to
NULL which causes a crash.

So synthesise a space there if it is missing, and check for 'level' to
be NULL and don't de-ref if it is.
2008-04-28 16:29:12 +10:00
Neil Brown aba69144fd Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
maximilian attems ff7f2ebbe9 config.c include dirent.h instead sys/dir.h
sys/dir.h is an old BSD'ism, include dirent directly.
small step for better klibc support.

compile tested against glibc.

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Neil Brown <neilb@suse.de>
2007-09-24 13:21:38 +10:00
Neil Brown 8382f19bdc Add new mode: --incremental
--incremental allows arrays to be assembled one device at a time.
This is expected to be used with udev.
2006-12-21 17:10:52 +11:00
Neil Brown 7572344665 Default to --auto=yes
so the array devices with 'standard' names
get created automatically, as this is almost always what is wanted.
2006-12-14 17:31:10 +11:00
Neil Brown d87d0978e2 Strdup the bitmap file name found in the config file
Otherwise we quickly lose it...
2006-11-09 09:37:10 +11:00
Neil Brown 6ba83b5f5e Allow a number after --auto=yes
So if the device name is /dev/md/d0, then the number of
partitions is as given.  This is useful in 'CREATE' in
mdadm.conf
2006-10-13 08:23:16 +10:00
Neil Brown 38098016ca Allow symlink creation to be disabled from command line or mdadm.conf 2006-08-11 18:00:05 +10:00
Neil Brown 8aec876d2e More consistent honoring of --configfile
Never use /etc/mdadm.conf if --config file is given (previously
some code used one, some used the other).
2006-06-26 15:11:01 +10:00
Neil Brown e81cdd9f37 Stop map_dev from returning [0:0]
We sometimes need the NULL when major==minor==0.
So make sure all callers of map_dev can cope with NULL.
2006-06-20 10:01:43 +10:00
Neil Brown 058574b1da Allow default metadata to be specified in mdadm.conf
CREATE metadata=1
in mdadm.conf will cause version-1 superblocks to be the default.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-06-02 05:33:40 +00:00
Neil Brown c97be4db86 Improve compiling for static binaries.
Have "#ifdef STATIC" in config.c, and the 'rmconf' target
was a mess.
Instead, create 'pwgr.c' with stub routines for those unavailable
when statically compiled, and include that in STATICOBJ

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-29 04:09:21 +00:00
Neil Brown da6b5ca9bd Initial implementation of auto-assembly
This basically works, but needs various improvements and some tests.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-26 00:50:15 +00:00
Neil Brown 997aed5dee Allow homehost to be set on command line or in config file
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-19 05:50:08 +00:00
Neil Brown 8fe9db0ffe Improve code for recognising config lines.
No more magic numbers.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-19 05:33:05 +00:00
Neil Brown 4f589ad0c5 Just updaqte copyright dates and email address
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-19 05:25:11 +00:00
Neil Brown f1ae21c411 Arrange the 'auto' setting in mdadm.conf can choose default type.
So when you say auto=md or auto=part in mdadm.conf, it give a preference
for type of array, but standard name will override.

But --auto=md is more insistant.

FIXME  I'm not at all happy about handling of names that already exist.
  I don't think that should be removed if the device is active.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-16 07:35:06 +00:00
Neil Brown 5bbb48424b Allow default creation info to to be stored in mdadm.conf
Default owner, group, mode and 'auto' flag can be given in a 'CREATE' line.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-15 06:02:41 +00:00
Neil Brown a99d6b669c Assume "DEVICE partitions" if no DEVICE line present.
This means the output of "mdadm -Es" can be used as a complete
mdadm.conf file .... if you really want to do that.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-15 01:58:47 +00:00
Neil Brown 4948b8f72e Support 'mailfrom' line in mdadm.conf so the From: line in alert emails can be explicitly set.
Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-15 01:27:04 +00:00
Neil Brown 4ccdb95600 Use O_DIRECT to read bitmap files.
A pending patch to the kernel causes bitmap file updates
to not go through the page cache, so O_DIRECT is needed to
ensure that we read current data.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-05-15 00:56:02 +00:00
Neil Brown 7ef02d0143 Support 'bitmap=' in mdadm.conf for auto-assembling arrays with write-intent bitmaps in separate files.
Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-29 02:57:48 +00:00
Neil Brown 16c6fa807c Create missing /dev files where needed.
Whenever we need a device file to open, if one cannot be found in /dev,
create a temporary one.

Signed-off-by: Neil Brown <neilb@suse.de>
2006-03-28 06:26:53 +00:00
Neil Brown ce4fafd637 Allow /etc/mdadm/mdadm.conf as an alternate to /etc/mdadm.conf
This provide compatability with Debian.

Signed-off-by: Neil Brown <neilb@suse.de>
2005-12-09 05:01:22 +00:00
Neil Brown 8b0dabea07 Allow scanning of devices listed in /proc/partitions independant of /dev
If a device found in /proc/partitions isn't listed in /dev, then
mknod a temporary name and open that.

Signed-off-by: Neil Brown <neilb@suse.de>
2005-12-05 05:52:50 +00:00
Neil Brown 947fd4ddb5 Support nameing of version-1 arrays.
--name is recognised in --create and --assemble
name= is recognised in config file.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-09 05:23:20 +00:00
Neil Brown f277ce3671 Assorted Fixes for multiple bugs.
Assemble would crash, or just not work.
A few other problem found by a new test-suite.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-08-04 04:41:12 +00:00
Neil Brown 1337546dc1 Allow --auto to still be meaningful when --scan is given
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-14 06:33:02 +00:00
Neil Brown 92919398cc Initialise mis.next to NULL
Probably not needed, but safer.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-06-14 06:32:52 +00:00
Neil Brown 82d9eba687 super1
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Fix raid5 creation with new code.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-05-03 23:44:40 +00:00
Neil Brown f9ce90ba50 Add a 'super-switch' so that different format superblocks can be used.
This includes:
  adding --metadata= option to choose metadata format
  adding metadata= word to config file.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-05-03 23:44:32 +00:00
Neil Brown b568741513 Fix "--config=partitions" which was broken.
"devline" wants a list of words, not a whole line...

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-04-04 05:44:43 +00:00
Neil Brown 057bd352c2 Reread partitions file for each array being assembled.
This makes assembling arrays from other arrays work better.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
2005-04-04 05:16:22 +00:00
Neil Brown e5329c3747 mdadm-1.7.0 2004-08-11 02:16:01 +00:00
Neil Brown dd0781e505 mdadm-1.6.0 2004-06-04 12:03:19 +00:00
Neil Brown 98c6faba80 mdadm-1.5.0 2004-01-22 02:10:29 +00:00
Neil Brown feb716e9c3 mdadm-1.4.0 2003-10-28 23:20:01 +00:00
Neil Brown d013a55e94 mdadm-1.1.0 2003-03-02 23:11:38 +00:00
Neil Brown 5787fa4906 mdadm-1.0.9 2003-02-12 00:17:26 +00:00
Neil Brown b83d95f362 mdadm-0.8.2 2002-04-11 01:36:14 +00:00
Neil Brown e0d1903663 mdadm-0.8 2002-04-04 01:58:32 +00:00
Neil Brown 11a3e71da4 mdadm-0.7.2 2002-03-20 22:39:50 +00:00
Neil Brown 9a9dab3670 mdadm-0.7 2002-03-08 00:03:52 +00:00
Neil Brown cd29a5c835 mdctl-0.6 2002-03-06 23:17:40 +00:00
Neil Brown 5282684628 mdctl-0.5 2001-08-23 02:33:20 +00:00
Neil Brown 0db17fcbde mdctl-v0.4.2 2001-07-26 20:47:22 +00:00
Neil Brown 82b27616de mdctl-v0.4 2001-07-26 07:00:09 +00:00
Neil Brown 64c4757e27 mdctl-v0.2 2001-06-08 02:36:23 +00:00