summaryrefslogtreecommitdiffstats
path: root/mapfile.c
Commit message (Collapse)AuthorAgeFilesLines
* Only signal a udev change event if we actually write a mapfile in RebuildMapDoug Ledford2010-03-241-6/+8
| | | | Signed-off-by: Doug Ledford <dledford@redhat.com>
* mapfile: if we putting the mapfile in a custom location via ALT_RUN, allowDoug Ledford2010-03-241-1/+1
| | | | | | a custom filename too. Signed-off-by: Doug Ledford <dledford@redhat.com>
* Create directory to contain mapfile (Assuming parent exists andDoug Ledford2010-03-241-4/+13
| | | | | | | | filesystem is writable). This particularly keeps udev happy if VAR_RUN is set to /dev/md. Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mapfile: use ALT_RUN as alternate place to store mapfileNeilBrown2010-02-081-4/+4
| | | | | | This gives better consistency and fewer hidden '.' files. Signed-off-by: NeilBrown <neilb@suse.de>
* mapfile: fix locking.NeilBrown2010-01-291-2/+5
| | | | | | | | | | | The current locking uses lockf, and is completely broken. When you hold a lockf lock, any close of any fd on that file will release the lock. So map_read() call which is made as soon as we get the lock, will immediately drop the lock. So change to flock locking which isn't so badly designed. Signed-off-by: NeilBrown <neilb@suse.de>
* Fix null-dereference in set_member_infoNeilBrown2009-10-011-6/+9
| | | | | | | set_member_info would try to dereference ->metadata_version, without checking that it isn't NULL. Signed-off-by: NeilBrown <neilb@suse.de>
* fix RebuildMap() to retrieve 'subarray' infoDan Williams2009-07-311-1/+31
| | | | | | | | | | | | | | | | | | RebuildMap falsely returns container info for member arrays. Retrieving the subarray and container_dev details prior to ->load_super() changes the result from: md127 imsm 082c6371:74b5ce03:64972e41:6b0860d5 /dev/md/imsm md126 imsm 082c6371:74b5ce03:64972e41:6b0860d5 /dev/md/vol0 ...to: md126 /md127/0 3e03aee2:78c3c593:1e8ecaf0:eefb53ed /dev/md/vol0 md127 imsm 082c6371:74b5ce03:64972e41:6b0860d5 /dev/md/imsm Reported-by: Ignacy Kasperowicz <ignacy.kasperowicz@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* mapfile - when rebuilding, choose an appropriate name is none is found.NeilBrown2009-05-111-1/+84
| | | | | | | | When rebuilding the mapfile (mdadm -Ir), if not appropriate name is found in /dev/md/, try to find an appropriate name, either by looking in mdadm.conf or by using the name in the metadata. Signed-off-by: NeilBrown <neilb@suse.de>
* mapfile - Fix off-by-one error in RebuildMapNeilBrown2009-05-111-1/+1
| | | | | | | "mdadm -Ir" would get the path for md0 wrong because it went looking for mdp(-1) by mistake. Signed-off-by NeilBrown <neilb@suse.de>
* mapfile: allow the path name to the device to be empty.NeilBrown2009-05-111-5/+8
| | | | | | | Allowing an empty name and coping with it is less confusing than seeing "/empty" appear. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' of git://github.com/djbw/mdadm into devel-3.0NeilBrown2009-04-141-1/+4
|\ | | | | | | | | | | | | | | | | Conflicts: Grow.c mdadm.h sysfs.c Due to independent fixes for the "mdadm hangs if reshape finishes too quickly" problem.
| * RebuildMap: handle missing disksDan Williams2009-04-121-1/+4
| | | | | | | | | | | | | | | | | | When rebuilding the map file tolerate missing/offline disks, otherwise we will segfault on the NULL return from sysfs_read. Reported-by: Jacek Danecki <jacek.danecki@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
* | mapfile: optionally store map file in /devNeilBrown2009-04-141-44/+51
|/ | | | | | | | | | | During early boot, /var/run may not exist or be writable. If that happens, sore the mapfile (which is very important for incremental assembly) in /dev (which should exist for udev). Thanks to Doug Ledford <dledford@redhat.com> for identify this problem and suggesting a solution. Signed-off-by: NeilBrown <neilb@suse.de>
* Merge branch 'master' into scratch-3.0NeilBrown2009-01-081-0/+1
|\ | | | | | | | | | | | | Conflicts: Assemble.c config.c
| * Free mdstat data structures properly.NeilBrown2009-01-081-0/+1
| | | | | | | | | | | | | | In one case we called 'free' instead of 'mdstat_free'. In others we didn't free at all. Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into devel-3.0NeilBrown2008-12-181-0/+59
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+53
| | | | | | | | | | | | | | | | | | 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>
* | mapfile: validate entries before they are returned.NeilBrown2008-11-041-10/+29
| | | | | | | | | | | | | | It is possible for the mapfile to become wrong, and that gets very confusing. So validate entries before returning them. Signed-off-by: NeilBrown <neilb@suse.de>
* | mdopen: use small sequence number for uniquifying array names.NeilBrown2008-11-041-0/+15
| | | | | | | | | | | | | | | | | | Rather than appending the md minor number, we now append a small sequence number to make sure name in /dev/md/ that aren't LOCAL are unique. As the map file is locked while we do this, we are sure of no losing any races. Signed-off-by: NeilBrown <neilb@suse.de>
* | Incremental: lock against multiple concurrent additions to an array.NeilBrown2008-11-041-0/+37
| | | | | | | | | | | | | | 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>
* | Manage: when stopping an array, delete all names from /dev.NeilBrown2008-11-041-0/+11
| | | | | | | | | | | | | | | | | | This only applies if udev isn't installed or is disabled by MDADM_NO_UDEV We try to remove partitions too. We find names to remove by looking in /var/run/mdadm/map Signed-off-by: NeilBrown <neilb@suse.de>
* | Always update mdadm/map when starting an array.NeilBrown2008-11-041-1/+2
| | | | | | | | | | | | | | | | We previously only updated /var/run/mdadm/map when starting an array with --incremental. However we now make more use of that file (to pass the dev name to udev) so always update it. Signed-off-by: NeilBrown <neilb@suse.de>
* | Merge branch 'master' into scratch-3.0NeilBrown2008-11-031-1/+1
|\|
| * mapfile: fix bug in testing for /var/run/mdadm/NeilBrown2008-11-031-1/+1
| | | | | | | | | | | | | | | | There was a bug. If /var/run/mdadm/ did not exist as a directory, the map file should have been created in /var/run/mdadm.map, but due to bug it would never get created. Signed-off-by: NeilBrown <neilb@suse.de>
* | Lots of fixes to make incremental assembly of containers work.NeilBrown2008-09-181-3/+5
| | | | | | | | | | | | | | | | So: mdadm -I /dev/whatever will (if appropriate) add whatever to a container, then start any arrays inside the container.
* | Use text_version in map_file rather than major.minor.Neil Brown2008-07-121-14/+13
|/
* Add new mode: --incrementalNeil Brown2006-12-211-0/+197
--incremental allows arrays to be assembled one device at a time. This is expected to be used with udev.