summaryrefslogtreecommitdiff
path: root/mdadm.h
Commit message (Collapse)AuthorAge
* util: split get_maj_min() out from dev_open()NeilBrown2014-08-11
| | | | | | This allows other code to parse "8:3" style device names. Signed-off-by: NeilBrown <neilb@suse.de>
* config: new option to suppress adding bad block lists.NeilBrown2014-08-07
| | | | | | | | | | | | | | CREATE bbl=no in mdadm.conf will cause any devices added to an array to not have a bad block list. By default they do for 1.x metadata. This is useful if you are suspicious of the bad-block-list implementation. Reported-by: Ethan Wilson <ethan.wilson@shiftmail.org> Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: allow prepare_update to report failure.NeilBrown2014-07-10
| | | | | | | | | If 'prepare_update' fails for some reason there is little point continuing on to 'process_update'. For now only malloc failures are caught, but other failures will be considered in future. Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM: Add warning message when assemble spanned containerPawel Baldysiak2014-07-08
| | | | | | | | | | | Due to several changes in code assemble with disks spanned between different controllers can be obtained in some cases. After IMSM container will be assembled, check HBA of disks, and print proper warning if mismatch is detected. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* MISC: add --action option to set or abort check/repair.NeilBrown2014-05-22
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: fix resent grow_continue breakage.NeilBrown2014-05-22
| | | | | | | | | | | | | | | | | Commit 5e76dce1acd906e8fc8af04973c3a129cdc77fd6 changed Grow_continue to assume a fork had already happened, so that mdadm --grow --continue didn't fork. This is good, but it means that if Grow_continue is run from Assemble, then mdadm --assemble .... can misbehave if the array was in the middle of a reshape. So introduce finer control. Grow_continue only assumes it has already forked if run from "mdadm --grow --continue". Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: store a link to current backup file in /run/mdadm or similar.NeilBrown2014-05-15
| | | | | | | | | | | | | | Subsequent patch will allow the background part of "mdadm --grow" to be run from systemd. This can require the passing of a backup file name. To do this, store that name as a symlink in /run/mdadm (or MAP_DIR) and look for it when appropriate. It might be useful to also store the name across reboot, but that would be a different patch. We would need to use the uuid to identify it, and store it in stable storage. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: Fix assorted typos and do some reformatting.NeilBrown2014-04-01
| | | | | | ..because it is more fun when new patches are harder to apply to old version :-) Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble/Incremental: don't hold O_EXCL on mddev after assembly.NeilBrown2013-12-05
| | | | | | | As soon as the array is assembled, udev or systemd might run fsck and mount it. So we need to drop O_EXCL promptly. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: improve support for "DEVICE" based restriction in mdadm.confNeilBrown2013-12-03
| | | | | | | | | | | | | | | | | --incremental currently fails if the device name passed does not textually match the names permitted by the DEVICE line in mdadm.conf. This is problematic when "mdadm -I" is run by udev as the name given can be a temp name. This patch makes two improvements: 1/ We generate a list of all existing devices that match the names in mdadm.conf, and allow rdev based matching 2/ We allows extra aliases to be provided on the command line, and perform textual matching on those. This is particularly suitable for udev usages as ${DEVLINKS} can be provided even though the links make not yet be created. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: add --export handling.NeilBrown2013-11-28
| | | | | | | | | | | | | | | | | | | | | | | | | | If --export is given with --incremental, then MD_DEVNAME is output which gives the name of the device (in /dev/md) that is the array (or container) that the device would be added to. Also MD_STARTED is set to one of no unsafe yes nothing to indicate if the array was started. IF MD_STARTED=unsafe then it may be appropriate to run mdadm -R /dev/md/$MD_DEVNAME after a timeout to ensure newly degraded array are started. If MD_FOREIGN=yes it might be appropriate to suppress this as the array is probably not critical. Signed-off-by: NeilBrown <neilb@suse.de>
* Add support for --add-spareNeilBrown2013-10-31
| | | | | | | | | | --add-spare is like --add, but a --re-add is never attempted. So it is equivalent to two separate commands: --zero-metadata --add Signed-off-by: NeilBrown <neilb@suse.de>
* Be consistent in return types from byteswap macrosJes Sorensen2013-10-16
| | | | | | | | | The bswap_*() macros return int values. Make sure we return the equivalent types in same byteorder pass-through functions to avoid problems with the original type leaking through to printf() etc. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Make -IRs and --run work properly for containers.NeilBrown2013-09-13
| | | | | | | | We really need to make sure assemble_container_content() gets called to finished the assembly of these. Reported-by: Francis Moreau <francis.moro@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Move ARRAY_SIZE macro to common include file.NeilBrown2013-09-10
| | | | | | That was super-ddf can use it. Signed-off-by: NeilBrown <neilb@suse.de>
* Change "mdadm --run" to use the same code as "mdadm --IRs".NeilBrown2013-08-26
| | | | | | | | | | | Current "mdadm --run /dev/mdX" will not handle external metadata properly. mdmon won't be started etc. So use the code from "mdadm -IRs" instead - that already does all the right things. Reported-by: Francis Moreau <francis.moro@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: don't lie to systemd.NeilBrown2013-08-01
| | | | | | | | | | | | | | Now that mdmon responds fairly well to SIGTERM, stop lying to systemd about being started on the initrd. Note that if mdmon is rerun (--takeover) for some reason, and systemd chooses to kill processes before remounting / readonly, then the unmount will hang. If systemd ever lets us tell it that we don't want to be killed until root is readonly, then we should do that. Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce devid2kname - slightly different to devid2devnm.NeilBrown2013-08-01
| | | | | | | | | | | | | The purpose od devid2devnm is to return a kernel name of an md device, whether that device is a whole device or a partition, we want the whole device. md4, never md4p2. In one place I was using devid2devnm where I really wanted the partition if there was one ... and wasn't really interested in it being an md device. So introduce a new 'devid2kname' for that case. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: simplify setting of array size.NeilBrown2013-07-30
| | | | | | | | | | | | | | | | | | Currently the extra space to leave before the data in the array is calculated in two separate places, and they can be inconsistent. Instead, do it all in validate_geometry. This records the 'data_offset' chosen which all other devices then use. 'write_init_super' now just uses the value rather than doing all the calculations again. This results in more consistent numbers. Also, load_super sets st->data_offset so that it is used by "--add", so the new device has a data offset matching a pre-existing device. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: use mdstat_wait to wait for delayed reshape.NeilBrown2013-07-10
| | | | | | | | | | Having a fix time for a wait is clumsy and can make us wait much too long. So use mdstat_wait and keep the mdstat_fd open. This requires an 'mdstat_close' so it doesn't stay open forever. Signed-off-by: NeilBrown <neilb@suse.de>
* Config: use better device names for "DEVICES container"NeilBrown2013-07-02
| | | | | | | | | | When "containers" appears on the "DEVICES" line (which is does by default), use names from the mdadm map file instead of kernel names, when possible. This mean that the name will be more likely to appear in mdadm.conf and so more likely to match "container=" tags. Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: check alignment when stopping an array undergoing reshape.NeilBrown2013-07-01
| | | | | | | | | | | | | To be able to revert-reshape of raid4/5/6 which is changing the number of devices, the reshape must has been stopped on a multiple of the old and new stripe sizes. The kernel only enforces the new stripe size multiple. So we enforce the old-stripe-size multiple by careful use of "sync_max" and monitoring "reshape_position". Signed-off-by: NeilBrown <neilb@suse.de>
* New function: sysfs_waitNeilBrown2013-07-01
| | | | | | | We have several places that wait for activity on a sysfs file. Combine most of these into a single 'sysfs_wait' function. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove lots of unnecessary white space.NeilBrown2013-06-19
| | | | | | | Now that I am using white-space mode in Emacs I can see all of this, and I don't like it :-) Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: split Manage_runstop into Manage_run and Manage_stopNeilBrown2013-06-19
| | | | | | | The two branches have virtually nothing in common, so it is simpler if they are separate. Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm.h: add little bits of doco for 'struct superswitch'.NeilBrown2013-06-17
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Make sure NOFILE resource limit is big enough.NeilBrown2013-05-30
| | | | | | | | | | Some people want to create truely enormous arrays. As we sometimes need to hold one file descriptor for each device, this can hit the NOFILE limit. So raise the limit if it ever looks like it might be a problem. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: allow --update=revert-reshapeNeilBrown2013-05-28
| | | | This will cause a reshape to start going backwards.
* Assemble: --update=metadata converts v0.90 to v1.0NeilBrown2013-05-28
| | | | | | | | | | This allows the smooth conversion of legacy 0.90 arrays to 1.0 metadata. Old metadata is likely to remain but will be ignored. It can be removed with mdadm --zero-superblock --metadata=0.90 /dev/whatever Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: introduce min_offset_change to struct reshape.NeilBrown2013-05-22
| | | | | | | | | raid10 currently uses the 'backup_blocks' field to store something else: a minimum offset change. This is bad practice, we will shortly need to have both for RAID5/6, so make a separate field. Signed-off-by: NeilBrown <neilb@suse.de>
* Add --dump / --restore functionality.NeilBrown2013-05-16
| | | | | | | | This allows the metadata on a device to be saved and later restored. This can be useful before experimenting on an array that is misbehaving. Suggested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* create_mddev: add support for /dev/md_XXX non-numeric names.NeilBrown2013-05-15
| | | | | | | | | | With the 'devnm' infrastructure fixed, it is quite easy to support names like "md_home" for md arrays. The currently defaults to "off" and can be enabled in mdadm.conf with CREATE names=yes This is incase other tools get confused by the new names. Signed-off-by: NeilBrown <neilb@suse.de>
* Discard devnum in favour of devnmNeilBrown2013-02-21
| | | | | | | | | | | | | | We widely use a "devnum" which is 0 or +ve for md%d devices and -ve for md_d%d devices. But I want to be able to use md_%s device names. So get rid of devnum (a number) and use devnm (a 32char string). eg. md0 md_d2 md_home Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm.h: fix ugly glibc specific ifdefferyJohn Spencer2013-02-10
| | | | | | | | the code that was exposed on anything else than dietlibc and klibc is entirely glibc specific and broke the build on musl libc. Signed-off-by: John Spencer <maillist-mdadm@barfooze.de> Signed-off-by: NeilBrown <neilb@suse.de>
* Remove --offroot argument and default to always setting argv[0] to @Jes Sorensen2013-02-05
| | | | | | | | | | | We still allow --offroot to be given - for compatibility with scripts - but ignore it. The whole point of --offroot is to get systemd to not auto-kill mdmon, and we always want that. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* conditionally remove map_dev from find_free_devnumNeilBrown2013-01-07
| | | | | | | | | map_dev can be slow so it is best to not call it when not necessary. The final test in "find_free_devnum" is not relevant when udev is being used, so remove the test in that case. Signed-off-by: NeilBrown <neilb@suse.de>
* MISC: Add --examine-badblocks optionNeilBrown2012-12-05
| | | | | | This will list the contents of the bad-blocks log, if one is present. Signed-off-by: NeilBrown <neilb@suse.de>
* Add support for --replace and --withNeilBrown2012-10-23
| | | | | | | | | --replace can be used to replace a device without completely failing it. Once the replacement completes the device will be failed. --with can indicate which of several spares to use. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove get_one_diskNeilBrown2012-10-22
| | | | | | | It has never been used, and there isn't really any place that could usefully use it. Signed-off-by: NeilBrown <neilb@suse.de>
* Allow data-offset to be specified per-device for createNeilBrown2012-10-04
| | | | | | | | | mdadm --create /dev/md0 .... /dev/sda1:1024 /dev/sdb1:2048 ... The size is in K unless a suffix: K M G is given. The suffix 's' means sectors. Signed-off-by: NeilBrown <neilb@suse.de>
* New RESHAPE_NO_BACKUP flag to track when backup action is needed.NeilBrown2012-10-04
| | | | | | | | | | | | Some arrays (raid10) never need a backup file, so during assembly we can avoid the whole Grow_continue check in that case. Achieve this using a flag set by the metadata handler. Also get "mdadm -I" to fail if a backup process would be needed. It currently does fail as the kernel rejects things, but it is nicer to have this explicit. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: set new_data_offset if appropriateNeilBrown2012-10-04
|
* Add space_before/space_after fields to mdinfoNeilBrown2012-10-04
| | | | | | | These will be needed to guide changes to data_offset during reshape. Only set them for super1 for now. Signed-off-by: NeilBrown <neilb@suse.de>
* Add --data-offset flag for Create and GrowNeilBrown2012-10-04
| | | | | | | | | | This can be used to over-ride the automatic assignment of data offset. For --create, it is useful to re-create old arrays where different defaults applied. For --grow it may be able to force a reshape in the reverse direction. Signed-off-by: NeilBrown <neilb@suse.de>
* Add data_offset arg to ->init_super and use it in super1.cNeilBrown2012-10-04
| | | | | | | So if ->data_offset is already set, use that rather than computing one. Signed-off-by: NeilBrown <neilb@suse.de>
* Add data_offset arg to ->validate_geometry.NeilBrown2012-10-04
| | | | | | | This is needed to return correct available size. It isn't really used yet. Signed-off-by: NeilBrown <neilb@suse.de>
* Add data_offset arg to ->avail_sizeNeilBrown2012-10-04
| | | | | | | This is currently only useful for 1.x metadata and will allow an explicit --data-offset request on command line. Signed-off-by: NeilBrown <neilb@suse.de>
* Allow parse_size to return 0.NeilBrown2012-10-04
| | | | | | | | | | | We will shortly introduce --data-offset= which is allowed to be zero. We will want to use parse_size() so it needs to be able to return '0' without it being an error. So define INVALID_SECTORS to be an impossible value (currently '1') and return and test for it consistently. Signed-off-by: NeilBrown <neilb@suse.de>
* Handles spaces in array names better.NeilBrown2012-10-04
| | | | | | | | | | | | 1/ When printing the "name=" entry for --brief output, enclose name in quotes if it contains spaces etc. Quotes are already supported for reading mdadm.conf 2/ When a name is used as a device name, translate spaces and tabs to '_', as well as the current translation of '/' to '-'. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Allow to specify controller for --detail-platform.Maciej Naruszewicz2012-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usually, 'mdadm --detail-platform -e imsm' scans all the controllers looking for IMSM capabilities. This patch provides the possibility to specify a controller to scan, enabling custom usage by other processes - especially with the --export switch. $ mdadm --detail-platform Platform : Intel(R) Matrix Storage Manager Version : 9.5.0.1037 RAID Levels : raid0 raid1 raid10 raid5 Chunk Sizes : 4k 8k 16k 32k 64k 128k 2TB volumes : supported 2TB disks : not supported Max Disks : 7 Max Volumes : 2 per array, 4 per controller I/O Controller : /sys/devices/pci0000:00/0000:00:1f.2 (SATA) $ mdadm --detail-platform /sys/devices/pci0000:00/0000:00:1f.2 Platform : Intel(R) Matrix Storage Manager Version : 9.5.0.1037 RAID Levels : raid0 raid1 raid10 raid5 Chunk Sizes : 4k 8k 16k 32k 64k 128k 2TB volumes : supported 2TB disks : not supported Max Disks : 7 Max Volumes : 2 per array, 4 per controller I/O Controller : /sys/devices/pci0000:00/0000:00:1f.2 (SATA) $ mdadm --detail-platform /sys/devices/pci0000:00/0000:00:1f.2 --export MD_FIRMWARE_TYPE=imsm IMSM_VERSION=9.5.0.1037 IMSM_SUPPORTED_RAID_LEVELS=raid0 raid1 raid10 raid5 IMSM_SUPPORTED_CHUNK_SIZES=4k 8k 16k 32k 64k 128k IMSM_2TB_VOLUMES=yes IMSM_2TB_DISKS=no IMSM_MAX_DISKS=7 IMSM_MAX_VOLUMES_PER_ARRAY=2 IMSM_MAX_VOLUMES_PER_CONTROLLER=4 $ mdadm --detail-platform /sys/devices/pci0000:00/0000:00:1f.0 # This isn't an IMSM-capable controller mdadm: no active Intel(R) RAID controller found under /sys/devices/pci0000:00/0000:00:1f.0 Signed-off-by: Maciej Naruszewicz <maciej.naruszewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>