summaryrefslogtreecommitdiff
path: root/super-intel.c
Commit message (Collapse)AuthorAge
* IMSM: move "validate_container_imsm" to be included in mdassemblePawel Baldysiak2014-07-21
| | | | | | | | | Commit 0c21b485e4beb7bcfe631412a231f7c1ea1067bc added new function in imsm superswitch. This function should be included in mdassemble. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM: validate metadata_update size before using it.NeilBrown2014-07-10
| | | | | | | | Every case in prepare_update check that the size message size is sufficient, so process_update doesn't need to check anything. Reported-by: Vincent Berg <vberg@ioactive.com> 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>
* IMSM: use strcpy rather than pointless strncpy.NeilBrown2014-07-03
| | | | | | | | | | As strncpy doesn't guarantee to nul-terminate, some static analysers get upset that it is followed by a 'strncat'. So just use a 'strcpy' - strlen(disk_by_path) is constant and definitely less than PATH_MAX. Link: https://github.com/neilbrown/mdadm/issues/4 Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: retry load_and_parse_mpb if we suspect mdmon has made modificationsArtur Paszkiewicz2014-06-03
| | | | | | | | | | If the checksum verification fails in mdadm and mdmon is running, retry the load to get a consistent snapshot of the mpb. Based on db575f3b Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM: don't crash when creating an array with missing devices.NeilBrown2014-01-21
| | | | | | | 'missing' devices are in a different list so when collection the serial numbers of all devices we need to check both lists. Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM metadata really should be ignored when found on partitions.NeilBrown2013-11-20
| | | | | | | | | | | | | | | | | | | | commit b31df43682216d1c65813eae49ebdd8253db8907 changed load_super_imsm to not insist on finding a partition if ignore_hw_compat was set. Unfortunately this is set for '--assemble' so arrays could get assembled badly. The comment says this was to allow e.g. --examine of image files. A better fixes for this is to change test_partitions to not report a regular file as being a partition. The errors from the BLKPG ioctl are: ENOTTY : not a block device. EINVAL : not a whole device (probably a partition) ENXIO : partition doesn't exist (so not a partition) Reported-by: "David F." <df7729@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: exit background thread cleanly on SIGTERM.NeilBrown2013-08-01
| | | | | | | | | | | | If the mdadm thread that monitors a reshape gets SIGTERM it should exit cleanly and clear the 'suspended' region of the array. However it mustn't clear 'sync_max' as that would allow the reshape to continue unmonitored. If the thread ever does get killed, the array should really be shutdown soon after if possible. Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: remove call to validate_geometry.NeilBrown2013-07-30
| | | | | | | | | | | | | | This call to validate_geometry is really rather gratuitous. It is purely about the fact that super0 cannot use more than 4TB. So just make it an explicit test - less confusing that way. With this, validate_geometry is only called from Create, which makes it easier to reason about. Also validate_geometry is now never passed NULL for the 'chunk' parameter, so we can remove those annoying tests for NULL. Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM: fix wait_for_reshape_imsmNeilBrown2013-07-11
| | | | | | | | | | | | This was waiting on "reshape_position" which doesn't get update events. Before sysfs_wait was introduced, the code to wait didn't wait at all, so it spun. With sysfs_wait, it would wait forever. Change to wait in sync_completed which does get events. 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>
* More conversion to pr_errNeilBrown2013-05-21
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change some fprintf(stderrs to cont_err()NeilBrown2013-05-21
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change some "fprintf(stderr,"s to pr_err.NeilBrown2013-05-21
| | | | | | They just keep slipping in.. 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>
* intel,ddf: don't require partitions when ignore_hw_compat is set.NeilBrown2013-05-16
| | | | | | | | Partitions are a hw-compat issue. This allows e.g "--examine" to be used on image files. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: monitor: do not finish migration if there are no failed disksPrzemyslaw Czarnowski2013-04-22
| | | | | | | | | | | | Transition from "degraded" to "recovery" made in OROM is slightly different than the same transision in mdadm. Missing disk is not removed from list of raid devices, but just from map. Therefore mdadm should not end migration basing on existence of list of missing disks but should rely on count of failed disks. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com> Tested-by: Pawel Baldysiak <pawel.baldysiak@intel.com> 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>
* platform-intel - cache 'intel_devices' for a few seconds.NeilBrown2013-01-07
| | | | | | | | | find_intel_devices() has take a little while to run as it scans some directory tree, and the result isn't likely to change often. So cache the value and only discard it after 10 seconds. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Forbid spanning between multiple controllers.Marcin Tomczak2012-11-20
| | | | | | | | | | Attaching disks to multiple controllers of the same type has been allowed so far. Now spanning between multiple controllers is disallowed at all by IMSM metadata. Signed-off-by: Marcin Tomczak <marcin.tomczak@intel.com> Reviewed-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM - allow assembling any imsm array even without OROM.NeilBrown2012-11-20
| | | | | | | | | | | | | | | | It is important to check for compatibility with 'platform' or Option ROM when creating or changing and array. However there is no real need when simply assembling the array. On some systems there are situations where the platform information is not available. e.g. on some UEFI systems, UEFI is not available during 'kdump' handling. This makes it impossible to assemble an IMSM array to receive the dump. So remove the requirements that the platform be visible to assemble an IMSM array. Signed-off-by: NeilBrown <neilb@suse.de>
* Replace a lot of leading spaces with tabs.NeilBrown2012-10-10
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: allow --assume-clean to work.NeilBrown2012-10-04
| | | | | | | We must avoid setting IMSM_T_STATE_UNINITIALIZED if the array was declared to be clean due to --assume-clean. 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>
* 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>
* 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>
* imsm: Add --export option for --detail-platformMaciej Naruszewicz2012-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This option will provide most of information we can get via mdadm --detail-platform [-e format] in the key=value format. Example output: $ 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 --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 Signed-off-by: Maciej Naruszewicz <maciej.naruszewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: imsm: do not accept too small sizesLukasz Dorau2012-09-20
| | | | | | | | | Inappriopriate error messages (e.g. mdadm: platform does not support raid5 with 0 disk) have been displayed when too small size was given. This patch fixes it. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: imsm: re-enable size expansion to the max valueLukasz Dorau2012-09-20
| | | | | | | | | | | | | Size expansion to the 'max' value has been broken since the following patch: commit d04f65f48c93e7e57cc3c1d70dd07d094dece717 Change the values for "max size" from -1 to 1. This patch re-enables it. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Change the values for "max size" from -1 to 1.NeilBrown2012-07-09
| | | | | | | | Both are impossible, and '1' allows size to be unsigned, which is neater. Also #define MAX_SIZE to be '1' to make it all more explicit. Signed-off-by: NeilBrown <neilb@suse.de>
* Convert 'quiet' to 'not verbose' in various places.NeilBrown2012-07-09
| | | | | | | | If we change some functions to accept 'verbose', where <0 means to be quiet, in place of 'quiet', then we will be able to merge 'quiet' and 'verbose' together for simplicity. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove scattered checks for malloc success.NeilBrown2012-07-09
| | | | | | | | | | | | | | malloc should never fail, and if it does it is unlikely that anything else useful can be done. Best approach is to abort and let some super-daemon restart. So define xmalloc, xcalloc, xrealloc, xstrdup which don't fail but just print a message and exit. Then use those removing all the tests for failure. Also replace all "malloc;memset" sequences with 'xcalloc'. Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce pr_err for printing error messages.NeilBrown2012-07-09
| | | | | | | 'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": ' cont_err() is also available. Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: correct checking volume's degradationLukasz Dorau2012-05-29
| | | | | | | | | | | | | | | | | | | | We do not check the return value of sysfs_get_ll() now. It is wrong. If reading of the sysfs "degraded" key does not succeed, the "new_degraded" variable will not be initiated and accidentally it can have the value of "degraded" variable. In that case the change of degradation will not be checked. It happens if mdadm is compiled with gcc's "-fstack-protector" option when one tries to stop a volume under reshape (e.g. OLCE). Reshape seems to be finished then (metadata is in normal/clean state) but it is not finished, it is broken and data are corrupted. Now we always check the return value of sysfs_get_ll(). Even if reading of the sysfs "degraded" key does not succeed (rv == -1) the change of degradation will be checked. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: check if size of expansion is not larger than maximumLukasz Dorau2012-05-18
| | | | | | | | | | | | | We do not check if requested size of expansion is larger than maximum available size now. If it is larger the output message is a bit misleading, for example: mdadm: Cannot set size on array members. mdadm: Cannot set device size for /dev/md/vol: Device or resource busy Now we check if requested size of expansion is larger than maximum available size and the appropriate output message was added. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix a typo in fprintf messageLukasz Dorau2012-05-18
| | | | | Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* super-intel.c: Fix resource leak from opendir()Jes Sorensen2012-05-07
| | | | | | | | Use closedir() on dirp from opendir() to avoid resource leaking. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* super-intel.c: Don't try to close negative fdJes Sorensen2012-05-07
| | | | | | | | | This should be harmless, but lets be consistent and not try to close a negative file descripter. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: thunderdome may drop 2tb attributeCzarnowska, Anna2012-04-30
| | | | | | | | | | | | Spare superblock doesn't depend on other spares in container. When loading container metadata thunderdome may pick a small disk for the champion. This will result in incorrect interpretation of sizes of other disks in container when joint superblock is returned. If any disk in container has the 2TB attribute set, the result must have it set too. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: fix: rebuild does not continue after rebootLukasz Dorau2012-04-23
| | | | | | | | | | | | | | | | | | If system is rebooted during rebuild, md driver changes sync_action from 'recover' to 'idle' (during stopping all md devices). If mdmon is still running then, it detects the change of sync_action state, finishes rebuild and writes metadata to disks. After computer's restart the RAID volume is in Normal state in OROM and rebuild seems to be finished. After system's start-up RAID volume is in auto-read-only state and metadata is in Dirty state. Rebuild seems to be finished but it is not. Data is inconsistent (out-of-sync). When mdmon detects the change of sync_action from 'recover' to 'idle', it has to check if rebuild is really finished. Appropriate test was added. Now mdmon examines each volume's member if it is being rebuilt. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: resolve make everything compilation errorLukasz Dorau2012-04-17
| | | | | | | | | | When mdadm is compiled using e.g. 'everything' option, mdassemble compilation is broken. Change code to enable mdassemble compilation. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: Component size alignment checkAdam Kwolek2012-04-17
| | | | | | | | | Put currently existing code for alignment correction in to function imsm_component_size_aligment_check() and use it for align component size to chunk size during volume size expansion operation. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Support setting max size for size change operationAdam Kwolek2012-04-17
| | | | | | | | Add support for setting max size for size change operation using imsm_get_free_size() function for computing maximum available space. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: Add function imsm_get_free_size()Adam Kwolek2012-04-17
| | | | | | | | Add function imsm_imsm_get_free_size() using part of code from function reserve_space(). Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: Support metadata changes rollbackAdam Kwolek2012-04-17
| | | | | | | | | Add metadata rollback specific code for imsm. Let reshape_super() ability to differentiate metadata apply and rollback actions. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Support metadata changes rollbackAdam Kwolek2012-04-17
| | | | | | | | | | | | | | Function reshape_super() guards metadata changes. It is used to apply changes rollback in error case also. As change (apply and rollback) can be not bi-directional reshape_super() has to know if current action is metadata change that should be guarded using metadata restrictions, or this is metadata rollback change executed due to error occurrence. In second case change has to be unconditional. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>