summaryrefslogtreecommitdiffstats
path: root/Incremental.c
Commit message (Collapse)AuthorAgeFilesLines
* Incremental - avoid NULL dereference.NeilBrown2009-04-071-25/+27
| | | | | | | There structure returned by sysfs_read might not have any 'devs', don't assume it does. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: be more relaxed about member arrays not completely assembling.NeilBrown2009-04-071-7/+10
| | | | | | | During incremental assembly, if the member array doesn't assemble properly (yet), that isn't an error. Signed-off-by: NeilBrown <neilb@suse.de>
* wait_for improvement.NeilBrown2009-04-071-3/+3
| | | | | | | | wait not only for the name to appear, but for it to refer to the correct device. Sometimes old symlinks left lying around can be confusing. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental/container: don't create when we should just be opening.NeilBrown2009-03-101-7/+10
| | | | | | | When incr-assembling in a container, if the array already exists, don't try to create it again, just open it. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: fix some handling of trustworthy.NeilBrown2009-03-101-12/+14
| | | | | | | | | | | 1/ if homehost matches, then we need to set trustworthy to 'LOCAL' 2/ if we decide to set trustworthy to 'METADATA' because we have to use the metadata version name, do that *after* we have checked if we are going to assemble within a container, as inside the container there could be different sources of names to use. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: honor --no-degraded to delay assemblyDan Williams2009-02-241-1/+4
| | | | | | | | | | Currently Incremental_container is being called after adding each disk. In the imsm case where spares are not tracked in the raid_disks field we can use --no-degraded to block premature assembly. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Incremental: fix 'name_to_use' in the container caseDan Williams2009-02-241-2/+9
| | | | | | | | | Just like the Assemble case, default to the text_version of the container if another name is not specified. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* Merge branch 'master' into devel-3.0NeilBrown2008-12-181-53/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Assemble.c Incremental.c Kill.c ReadMe.c inventory mapfile.c mdadm.8 mdadm.spec mdassemble.8
| * map: rebuild map if it doesn't exist.NeilBrown2008-12-181-47/+0
| | | | | | | | | | | | | | | | | | It is possible for some arrays to be created e.g. by initrd, and so not get mentioned in /var/run/mdadm/map. As "-I" depends on things being listed in 'map', we create it by scanning all devices if it doesn't exist. Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: close mdfd before returning from assemble_container_contentNeilBrown2008-11-071-1/+0
| | | | | | | | | | | | This makes sure it is consistently closed. Signed-off-by: NeilBrown <neilb@suse.de>
* | Wait for name to appear after create/assemble etc.NeilBrown2008-11-041-0/+2
| | | | | | | | | | | | | | We don't really want mdadm to exit until udev has created the names in /dev. So wait. Signed-off-by: NeilBrown <neilb@suse.de>
* | Incrmental: cope with udev slowness and errors in map file.NeilBrown2008-11-041-3/+10
| | | | | | | | | | | | | | | | | | | | If udev hasn't created the array yet, we might still want to open it. So open directly by major:minor. Also, of array in map file doesn't appear to exist, do use the name associated with it. Signed-off-by: NeilBrown <neilb@suse.de>
* | Assemble: factor out assemble_container_contentDan Williams2008-11-041-56/+5
| | | | | | | | | | | | | | | | | | Factor out, from Incremental_container, the code for assembling an array based on information extracted from a container. We will shortly use this from Assemble too. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | Quiet unitialized variable warningsDan Williams2008-11-041-4/+3
| | | | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | Incremental: lock against multiple concurrent additions to an array.NeilBrown2008-11-041-10/+18
| | | | | | | | | | | | | | In two devices are added via -I to one array at the same time, mdadm can get badly confused. Signed-off-by: NeilBrown <neilb@suse.de>
* | Generate 'change' uevents when arrays change in non-obvious ways.NeilBrown2008-11-041-0/+7
| | | | | | | | | | | | | | | | | | | | | | When a 'container' gets started, we need udev to notice, but the kernel has no way of knowing that a KOBJ_CHANGE event is needed. So send one directly via the 'uevent' sysfs attribute. Also, uevents don't get generated when md arrays are stopped (prior to 2.6.28) so send 'change' events then too. Signed-off-by: NeilBrown <neilb@suse.de>
* | config: Support container=uuid as alternative to container=/dev/name in ↵NeilBrown2008-11-041-5/+27
| | | | | | | | | | | | | | | | | | | | 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>
* | config: Don't require an array to have a device name.NeilBrown2008-11-041-9/+15
| | | | | | | | | | | | | | | | | | | | 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'.
* | Incremental: adjust to the new naming scheme.NeilBrown2008-11-041-180/+50
| | | | | | | | | | --incremental now uses exactly the same create_mddev that other code uses.
* | Rename open_mddev to create_mddevNeilBrown2008-11-041-3/+3
| | | | | | | | | | | | | | This reflect that fact that more often than not it is creating things in /dev, and allows for a new open_mddev which does just that. Signed-off-by: NeilBrown <neilb@suse.de>
* | cleanup an unused call to container2devnameDan Williams2008-11-041-19/+0
| | | | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into scratch-3.0NeilBrown2008-11-031-2/+3
|\|
| * Incremental: change precedence order for autof setting.NeilBrown2008-11-031-3/+4
| | | | | | | | | | | | | | | | | | It doesn't really make sense for the --auto setting to ever over-ride the setting on an ARRAY line. That could cause failure if the ARRAY line has a 'standard' now. So revert to the array line having precedence over command line, then CREATE line last. Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into devel-3.0NeilBrown2008-10-301-13/+30
|\| | | | | | | | | | | | | | | Conflicts: Incremental.c super0.c super1.c
| * Incremental: allow assembly of foreign array.NeilBrown2008-10-301-6/+12
| | | | | | | | | | | | | | | | | | | | | | If a foreign (i.e. not known to be local) array is discovered by --incremental assembly, we now assemble it. However we ignore any name information in the array so as not to potentially create a name that conflict with a 'local' array. Also, foreign arrays are always assembled 'read-auto' to avoid writing anything until the array is actually used. Signed-off-by: NeilBrown <neilb@suse.de>
| * Incremental: fix setting of 'autof' flag.NeilBrown2008-10-301-4/+10
| | | | | | | | | | | | | | When doing auto-assembly, the 'autof' flag from array lines in mdadm.conf was being ignored. Signed-off-by: NeilBrown <neilb@suse.de>
| * Fix --incremental assembly of partitions arrays.NeilBrown2008-10-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If incremental assembly finds an array mentioned in mdadm.conf, with a 'standard partitioned' name like /dev/md_d0 or /dev/md/d0, it will not create a partitioned array like it should. This is because it mishandled the 'devnum' returned by is_standard. That is a devnum that does not have the partition-or-not encoded into it. So we need to check the actual return value of is_standard and encode the partition-or-not info into the devnum. Also fix a couple of comments. Signed-off-by: NeilBrown <neilb@suse.de>
| * Fix NULL pointer oopsDoug Ledford2008-10-301-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | RAID10 is the only raid level that uses the avail char array pointer during the enough() operation, so it was the only one that saw this. The code in incremental assumes unconditionally that count_active will allocate the avail char array, that it might be used by enough, and that it will need to be freed afterward. Once you make count_active actually do that, then the oops goes away. Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | Preliminary -As support for container member arraysDan Williams2008-10-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Don't try to set_array_info when -I find new devices for an array.NeilBrown2008-09-181-2/+10
| | | | | | | | | | | | | | | | | | | | | | When -I get a new device for a container and tries to incrementally assemble the container array, it calls sysfs_set_array to create the array without first checking if it already exists. This produces unpleasant error messages. So check first. Signed-off-by: NeilBrown <neilb@suse.de>
* | Add support for assembling specific subarrays.NeilBrown2008-09-181-3/+46
| | | | | | | | | | This normally isn't needed as --incremental does all the work. But it is needed to recognise member= and container= in mdadm.conf
* | Report uuid in --detail --brief for ddf and intelNeilBrown2008-09-181-2/+2
| | | | | | | | The uuid is slightly fictitious but needed for array matching.
* | Use uuid as /dev name when assembling array of uncertain origin.NeilBrown2008-09-181-18/+38
| | | | | | | | | | If we aren't sure that the array belongs to 'this' host, use the uuid to choose a name to avoid any conflict.
* | Allow metadata handler to report that it doesn't record homehost.NeilBrown2008-09-181-1/+1
| | | | | | | | | | | | | | For now, this means that the lack of a homehost doesn't always prevent assembly. Soon we will allow assembly anyway, but have different messages if homehost isn't supported.
* | Lots of fixes to make incremental assembly of containers work.NeilBrown2008-09-181-56/+93
| | | | | | | | | | | | | | | | So: mdadm -I /dev/whatever will (if appropriate) add whatever to a container, then start any arrays inside the container.
* | Handle incremental assembly of containers.NeilBrown2008-09-181-2/+11
| | | | | | | | | | | | | | | | | | mdadm -I /dev/part-of-container should add that to a container, creating if it needed, and then try to assemble any arrays in the container. Signed-off-by: NeilBrown <neilb@suse.de>
* | Move calls to SET_ARRAY_INFO to common helper.NeilBrown2008-09-181-26/+16
| | | | | | | | | | | | | | | | | | | | When we assemble an array, there are three different approaches depending on whether metadata is internal or external, and on kernel version. Move all this to a common helper instead of duplicating in 3 places. Signed-off-by: NeilBrown <neilb@suse.de>
* | Factor out add-disk codeNeilBrown2008-09-181-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | The variety of approaches to 'add_disk' are factored out into a separate function, and Incremental mode benefits by being closer to supporting the assembly of containers. Also remove the adding-to-array-data-structure out of sysfs_add_disk and into add_disk. And add some tests for --incremental mode to make sure we don't break it. Signed-off-by: NeilBrown <neilb@suse.de>
* | Honor safemode_delay at Create() and Incremental() timeDan Williams2008-09-151-0/+1
| | | | | | | | Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Factor common code into new "start_mdmon".NeilBrown2008-07-181-22/+3
| | | | | | | | Signed-off-by: Neil Brown <neilb@suse.de>
* | mdadm: add an environment variable to prevent auto-launching mdmonDan Williams2008-07-141-1/+1
| | | | | | | | | | | | Useful for attaching gdb to mdmon before any action is taken on the array. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Fix fd comparison in IncrementalNeil Brown2008-07-121-1/+1
| | | | | | | | fd==0 is theoretically possible...
* | Remove 'major' from superswitch.Neil Brown2008-07-121-22/+9
| | | | | | | | It isn't generally meaningful.
* | Use text_version in map_file rather than major.minor.Neil Brown2008-07-121-4/+3
| |
* | Discard st->container_memberNeil Brown2008-05-271-1/+1
| | | | | | | | | | | | 'container_member' isn't really a well defined concept. Each metadata might enumerate members differently, so just let each format /mdX/YYYY as appropriate.
* | Start mdmon during incremental assembly of containerNeil Brown2008-05-271-0/+24
| |
* | allow --incremental to reuse devices that already existNeil Brown2008-05-271-0/+41
| | | | | | | | .. and other fixes.
* | Remove 'fd' arg from sysfs_add_diskNeil Brown2008-05-271-7/+3
| | | | | | | | | | It it never used, and removing means there are several 'open's that can go.
* | Set 'metadata_version' for container_member in Incremental_containerDan Williams2008-05-151-0/+23
| | | | | | | | | | | | From: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | Can now mostly assemble DDF arraysNeil Brown2008-05-151-2/+97
|/