summaryrefslogtreecommitdiffstats
path: root/Incremental.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Incremental: Simplify remove logicMariusz Tkaczyk2024-12-161-42/+74
| | | | | | Incremental_remove() does not execute Manage_subdevs() now. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Incremental: Document workaroundMariusz Tkaczyk2024-12-161-6/+22
| | | | | | Keep it documented in code. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Coverity fixes resources leaksNigel Croxon2024-12-161-1/+1
| | | | | | Handle variable going out of scope leaks the handle. Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
* mdadm: remove bitmap file supportYu Kuai2024-12-031-36/+1
| | | | | | | | | | | Because it's marked deprecated for a long time now, and it's not worthy to support it for new bitmap. Now that we don't need to store filename for bitmap, also declare a new enum type bitmap_type to simplify code. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: drop auto= supportMariusz Tkaczyk2024-11-051-18/+3
| | | | | | | | | | | | According to author (and what was described in man): "With mdadm 3.0, device creation is normally left up to udev so this is option is unlikely to be needed" This was a workaround for kernel 2.6 family issues (partitionable and non-partitionable arrays hell) and I believe we are far away from it now. I'm not aware of any usage of it, hence it is removed. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: add xmalloc.hMariusz Tkaczyk2024-09-271-0/+2
| | | | | | | | | | Move memory declaration helpers outside mdadm.h. They seems to be useful so keep them but include separatelly. Rework them to not reffer to Name[] declared internally in mdadm/mdmon. This is first step to start decomplexing mdadm.h. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Incremental: Rename IncrementalRemoveMariusz Tkaczyk2024-09-271-2/+2
| | | | | | | Rename it to Incremental_remove for better readability. No functional changes. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Incremental: support devnode in IncrementalRemove.Mariusz Tkaczyk2024-09-101-21/+39
| | | | | | | | There are no reasons to keep this interface different than others. Allow to use devnode but keep old way for backward compatibility. Method is added to verify that only devnode or kernel name is used. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm/Incremental: fix coverity issues.Xiao Ni2024-08-051-10/+10
| | | | | | | | There are two issues PW.PARAMETER_HIDDEN (declaration hides parameter 'devname') and INTEGER_OVERFLOW. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdstat: Rework mdstat external arrays handlingMariusz Tkaczyk2024-07-301-15/+22
| | | | | | | | | | | | To avoid repeating mdstat_read() in IncrementalRemove(), new function mdstat_find_by_member_name() has been proposed. With that, IncrementalRemove() handles own copy of mdstat content and there is no need to repeat reading for external stop. Additionally, It proposed few helper to avoid repeating mdstat_ent->metadata_version checks across code. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: fix grow segfault for IMSMMariusz Tkaczyk2024-03-221-0/+1
| | | | | | | | | | | If sc is not initialized, there is possibility that sc.pols is not zeroed and it causes segfault. Add missing initialization. Add missing dev_policy_free() in two places. Fixes: f656201188d7 ("mdadm: drop get_required_spare_criteria()") Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Monitor, Incremental: use device policiesMariusz Tkaczyk2024-03-111-1/+1
| | | | | | | | | | | | | spare_criteria is expanded to contain policies which will be generated by handler's get_spare_criteria() function. It provides a way to test device for metadata specific policies earlier than during add_do_super(), when device is already removed from previous array/container for Monitor. For Incremental, it ensures that all criteria are tested when trying spare. It is not tested when device contains valid metadata. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: drop get_required_spare_criteria()Mariusz Tkaczyk2024-03-111-23/+54
| | | | | | | | | | | | | | | | | | | | | Only IMSM implements get_spare_criteria, so load_super() in get_required_spare_criteria() is dead code. It is moved inside metadata handler, because only IMSM implements it. Give possibility to provide devnode to be opened. With that we can hide load_container() used only to fill spare criteria inside handler and simplify implementation in generic code. Add helper function for testing spare criteria in Incremental and error messages. File descriptor in get_spare_criteria_imsm() is always opened on purpose. New functionality added in next patches will require it. For the same reason, function is moved to other place. No functional changes. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: Add functions for spare criteria verificationMariusz Tkaczyk2024-03-111-1/+1
| | | | | | | | | | | | | | | | | It is done similar way in few places. As a result, two almost identical functions (dev_size_from_id() and dev_sector_size_from_id()) are removed. Now, it uses same file descriptor to send two ioctls. Two extern functions are added, in next patches disk_fd_matches_criteria() is used. Next optimization is inline zeroing struct spare_criteria. With that, we don't need to reset values in get_spare_criteria_imsm(). Dedicated boolean field for checking if criteria are filled is added. We don't need to execute the code if it is not set. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Revert "mdadm: remove container_enough logic"Mariusz Tkaczyk2024-02-091-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Mentioned patch changes way of IMSM member arrays assembling, they are updated by every new drive incremental processes. Previously, member arrays were created and filled once, by last drive incremental process. We determined regressions with various impact. Unfortunately, initial testing didn't show them. Regressions are connected to drive appearance order and may not be reproducible on every configuration, there are at least two know issues for now: - sysfs attributes are filled using old metadata if there is outdated drive and it is enumerated first. - rebuild may be aborted and started from beginning after reboot, if drive under rebuild is enumerated as the last one. This reverts commit 4dde420fc3e24077ab926f79674eaae1b71de10b. It fixes checkpatch issues and reworks logic to remove empty "if" branch in Incremental. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Replace "none" with macroMateusz Kusiak2024-01-241-1/+1
| | | | | | | | | | | String "none" is used many times throughout the code. Replace "none" strings with predefined macro. Add str_is_none() for comparing strings with "none". Replace str(n)cmp calls with function. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Define sysfs max buffer sizeMateusz Kusiak2024-01-241-1/+1
| | | | | | | | | | | sysfs_get_str() usages have inconsistant buffer size. This results in wild buffer declarations and redundant memory usage. Define maximum buffer size for sysfs strings. Replace wild sysfs string buffer sizes for globaly defined value. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: remove container_enough logicPawel Piatkowski2023-10-261-11/+0
| | | | | | | | | | | | | | | | Arrays without enough disk count will be assembled but not started. Now RAIDs will be assembled always (even if they are failed). RAID devices in all states will be assembled and exposed to mdstat. This change affects only IMSM (for ddf it wasn't used, container_enough was set to true always). Removed this logic from incremental_container as well with runstop checking because runstop condition is being verified in assemble_container_content function. Signed-off-by: Pawel Piatkowski <pawel.piatkowski@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Incremental: remove obsoleted calls to udisksColy Li2023-10-261-51/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Utility udisks is removed from udev upstream, calling this obsoleted command in run_udisks() doesn't make any sense now. This patch removes the calls chain of udisks, which includes routines run_udisk(), force_remove(), and 2 locations where force_remove() are called. Considering force_remove() is removed with udisks util, it is fair to remove Manage_stop() inside force_remove() as well. In the two modifications where calling force_remove() are removed, the failure from Manage_subdevs() can be safely ignored, because, 1) udisks doesn't exist, no need to check the return value to umount the file system by udisks and remove the component disk again. 2) After the 'I' inremental remove, there is another 'r' hot remove following up. The first incremental remove is a best-try effort. Therefore in this patch, where force_remove() is removed, the return value of calling Manage_subdevs() is not checked too. Signed-off-by: Coly Li <colyli@suse.de> Reviewed-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Cc: Jes Sorensen <jes@trained-monkey.org> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm: define is_devname_ignore()Mariusz Tkaczyk2023-05-081-4/+2
| | | | | | | Use function instead of direct checks across code. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm: define DEV_MD_DIRMariusz Tkaczyk2023-05-081-2/+2
| | | | | | | | It is used many times. Additionally define _LEN to avoid repeated strlen() calls when length is needed. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Fix null pointer for incremental in mdadmmiaoguanqin2023-04-101-0/+3
| | | | | | | | | | | | | | | | | | | | when we excute mdadm --assemble, udev-md-raid-assembly.rules is triggered. Then we stop array, we found an coredump for mdadm --incremental.func stack are as follows: #0 enough (level=10, raid_disks=4, layout=258, clean=1, avail=avail@entry=0x0) at util.c:555 #1 0x0000562170c26965 in Incremental (devlist=<optimized out>, c=<optimized out>, st=0x5621729b6dc0) at Incremental.c:514 #2 0x0000562170bfb6ff in main (argc=<optimized out>, argv=<optimized out>) at mdadm.c:1762 func enough() use array avail,avail allocate space in func count_active, it may not alloc space, causing a coredump.We fix this coredump. Signed-off-by: Guanqin Miao <miaoguanqin@huawei.com> Signed-off-by: lixiaokeng <lixiaokeng@huawei.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* incremental, manage: do not verify if remove is safeKinga Tanska2023-01-051-1/+1
| | | | | | | | | | | Function is_remove_safe() was introduced to verify if removing member device won't cause failed state of the array. This verification should be used only with set-faulty command. Add special mode indicating that Incremental removal was executed. If this mode is used do not execute is_remove_safe() routine. Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Manage&Incremental: code refactor, string to enumMateusz Kusiak2023-01-041-4/+4
| | | | | | | | | Prepare Manage and Incremental for later changing context->update to enum. Change update from string to enum in multiple functions and pass enum where already possible. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm: replace container level checking with inlineKinga Tanska2022-09-291-2/+2
| | | | | | | | | To unify all containers checks in code, is_container() function is added and propagated. Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Acked-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: Fix possible memory and resource leaksMateusz Grzonka2022-06-141-9/+23
| | | | | | | | | map allocated through map_by_uuid() is not freed if mdfd is invalid. In addition mdfd is not closed, and mdinfo list is not freed too. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Change-Id: I25e726f0e2502cf7e8ce80c2bd7944b3b1e2b9dc Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Correct checking if file descriptors are validMateusz Grzonka2021-11-241-2/+2
| | | | | | | | In some cases file descriptors equal to 0 are treated as invalid. Fix it. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: Close unclosed mdfd in IncrementalScan()Mateusz Grzonka2021-11-241-5/+6
| | | | | | | | In addition to closing mdfd, propagate helpers to manage file descriptors across IncrementalScan(). Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: add verbose flag to compare_superMariusz Tkaczyk2021-03-081-1/+1
| | | | | | | | | | | IMSM does more than comparing metadata and errors reported directly from compare_super_imsm can be useful. Add verbose flag to compare_super method and make all not critical error printing configurable. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: Remove redundant spare movement logicMariusz Tkaczyk2020-12-201-62/+0
| | | | | | | | | | | If policy is set then mdmonitor is responsible for moving spares. This logic is reduntant and potentialy dangerus, spare could be moved at initrd stage depending on drives appearance order. Remove it. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm: Unify forks behaviourMariusz Tkaczyk2020-11-261-0/+1
| | | | | | | | | | | | | | If mdadm is run by udev or systemd, it gets a pipe as each stream. Forks in the background may run after an event or service has been processed when udev is detached from pipe. As a result process fails quietly if any message is written. To prevent from it, each fork has to close all parent streams. Leave stderr and stdout opened only for debug purposes. Unify it across all forks. Introduce other descriptors detection by scanning /proc/self/fd directory. Add generic method for managing systemd services. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
* mdadm: load default sysfs attributes after assemblationMariusz Dabrowski2019-07-101-0/+1
| | | | | | | | | | | | Added new type of line to mdadm.conf which allows to specify values of sysfs attributes for MD devices that should be loaded after the array is assembled. Each line is interpreted as list of structures containing sysname of MD device (md126 etc.) and list of sysfs attributes and their values. Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com> Signed-off-by: Krzysztof Smolinski <krzysztof.smolinski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* policy: support devices with multiple paths.NeilBrown2018-12-061-1/+4
| | | | | | | | | | | | | | | As new releases of Linux some time change the name of a path, some distros keep "legacy" names as well. This is useful, but confuses mdadm which assumes each device has precisely one path. So change this assumption: allow a disk to have several paths, and allow any to match when looking for a policy which matches a disk. Reported-and-tested-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: remove external arrays and devices correctlyMariusz Tkaczyk2018-08-031-26/+52
| | | | | | | | | | | | | | | | | | | | Kernel returns EBUSY when device fail invokes array fail. In external metadata if kernel returns it, mdadm doesn't stop member arrays but it will try to stop container directly. It fails because container still has working arrays, so udev remove is triggered. Try to set faulty state on device in member arrays first. If kernel returns EBUSY, stop this array. After that remove the device from container. In external metadata mdmon has to remove faulty devices from degraded arrays, just remove device from container. Raid5 array doesn't return EBUSY, it allows to remove every device. Mdadm shouldn't block it. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Free map to avoid resource leak issuesGuoqing Jiang2018-06-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | 1. There are some places which didn't free map as discovered by coverity. CID 289661 (#1 of 1): Resource leak (RESOURCE_LEAK)12. leaked_storage: Variable mapl going out of scope leaks the storage it points to. CID 289619 (#3 of 3): Resource leak (RESOURCE_LEAK)63. leaked_storage: Variable map going out of scope leaks the storage it points to. CID 289618 (#1 of 1): Resource leak (RESOURCE_LEAK)26. leaked_storage: Variable map going out of scope leaks the storage it points to. CID 289607 (#1 of 1): Resource leak (RESOURCE_LEAK)41. leaked_storage: Variable map going out of scope leaks the storage it points to. 2. If we call map_by_* inside a loop, then map_free should be called in the same loop, and it is better to set map to NULL after free. 3. And map_unlock is always called with map_lock, if we don't call map_remove before map_unlock, then the memory (allocated by map_lock -> map_read -> map_add -> xmalloc) could be leaked. So we need to free it in map_unlock as well. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: Use ->validate_geometry instead of ->avail_sizeNeilBrown2017-11-011-6/+9
| | | | | | | | | | | | | | | | | | | | Since mdadm 3.3 is has not been correct to call ->avail_size if metadata hasn't been read from the device. ->validate_geometry should be used instead. Unfortunately array_try_spare() didn't get the memo, and it can crash when adding a spare with no metdata. So change it to use ->validate_geometry(). Only one place remains that uses ->avail_size(), and that is safe. Also fix a comment with a typo. Reported-and-tested-by: Bjørnar Ness <bjornar.ness@gmail.com> Fixes: 641da7459192 ("super1: separate to version of _avail_space1().") Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm: set journal_clean after scanning all disksSong Liu2017-09-011-2/+6
| | | | | | | | | | | | | | | | | Summary: In Incremental.c:count_active(), max_events is tracked to show to which devices are up to date. If a device has events==max_events+1, getinfo_super() is called to reload the superblock from this device. getinfo_super1() blindly set journal_clean to 0, which is wrong. This patch fixes this by tracking max_journal_events for all the disks. After scanning all disks, journal_clean is set if max_journal_events >= max_events-1. Signed-off-by: Song Liu <songliubraving@fb.com> Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Get failed disk count from array stateTomasz Majchrzak2017-06-051-10/+4
| | | | | | | | | | | | | | | | | | | | Recent commit has changed the way failed disks are counted. It breaks recovery for external metadata arrays as failed disks are not part of the array and have no corresponding entries is sysfs (they are only reported for containers) so degraded arrays show no failed disks. Recent commit overwrites GET_DEGRADED result prior to GET_STATE and it is not set again if GET_STATE has not been requested. As GET_STATE provides the same information as GET_DEGRADED, the latter is not needed anymore. Remove GET_DEGRADED option and replace it with GET_STATE option. Don't count number of failed disks looking at sysfs entries but calculate it at the end. Do it only for arrays as containers report no disks, just spares. Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Add sector size as spare selection criterionAlexey Obitotskiy2017-05-091-2/+2
| | | | | | | | | | | Add sector size as new spare selection criterion. Assume that 0 means there is no requirement for the sector size in the array. Skip disks with unsuitable sector size when looking for a spare to move across containers. Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com> Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Allow more spare selection criteriaAlexey Obitotskiy2017-05-091-7/+11
| | | | | | | | | | | | | | Disks can be moved across containers in order to be used as a spare drive for reubild. At the moment the only requirement checked for such disk is its size (if it matches donor expectations). In order to introduce more criteria rename corresponding superswitch method to more generic name and move function parameter to a structure. This change is a big edit but it doesn't introduce any changes in code logic, it just updates function naming and parameters. Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com> Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* IncrementalScan: Use md_array_active() instead of md_get_array_info()Jes Sorensen2017-05-051-2/+1
| | | | | | | This eliminates yet another case where GET_ARRAY_INFO was used to indicate whether the array was active. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* container_members_max_degradation: Switch to using syfs for disk infoJes Sorensen2017-05-051-14/+14
| | | | | | | | | With sysfs now providing the necessary active_disks info, switch to sysfs and eliminate one more use of md_get_array_info(). We can do this unconditionally since we wouldn't get here witout sysfs being available. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: return is not a functionJes Sorensen2017-05-051-1/+1
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/util: unify stat checking blkdev into functionZhilong Liu2017-05-051-17/+4
| | | | | | | | | | | | declare function stat_is_blkdev() to integrate repeated stat checking blkdev operations, it returns 'true/1' when it is a block device, and returns 'false/0' when it isn't. The devname is necessary parameter, *rdev is optional, parse the pointer of dev_t *rdev, if valid, assigned device number to dev_t *rdev, if NULL, ignores. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/util: unify fstat checking blkdev into functionZhilong Liu2017-05-051-21/+12
| | | | | | | | | | | | declare function fstat_is_blkdev() to integrate repeated fstat checking block device operations, it returns true/1 when it is a block device, and returns false/0 when it isn't. The fd and devname are necessary parameters, *rdev is optional, parse the pointer of dev_t *rdev, if valid, assigned the device number to dev_t *rdev, if NULL, ignores. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: Use md_array_active() to determine state of arrayJes Sorensen2017-05-021-2/+1
| | | | | | One less call to md_get_array_info() Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Create: tell udev md device is not ready when first created.NeilBrown2017-05-021-2/+2
| | | | | | | | | | | | | | | | | | | | | When an array is created the content is not initialized, so it could have remnants of an old filesystem or md array etc on it. udev will see this and might try to activate it, which is almost certainly not what is wanted. So create a mechanism for mdadm to communicate with udev to tell it that the device isn't ready. This mechanism is the existance of a file /run/mdadm/created-mdXXX where mdXXX is the md device name. When creating an array, mdadm will create the file. A new udev rule file, 01-md-raid-creating.rules, will detect the precense of thst file and set ENV{SYSTEMD_READY}="0". This is fairly uniformly used to suppress actions based on the contents of the device. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: Cleanup some if() statement spaghettiJes Sorensen2017-04-251-29/+21
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Incremental: Use md_array_active() where applicableJes Sorensen2017-04-251-3/+2
| | | | | | | md_get_array_info() == 0 implies an array is active, however this is more correct. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* sysfs: Make sysfs_init() return an error codeJes Sorensen2017-03-301-2/+10
| | | | | | | | Rather than have the caller inspect the returned content, return an error code from sysfs_init(). In addition make all callers actually check it. Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>