summaryrefslogtreecommitdiffstats
path: root/Create.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mdadm: Create.c fix coverity issuesNigel Croxon2024-07-051-3/+3
| | | | | | | | | | | | * Event negative_returns: "fd" is passed to a parameter that cannot be negative. Which is set to -1 to start. * Event open_fn: Returning handle opened by "open_dev_excl". * Event var_assign: Assigning: "container_fd" = handle returned from "open_dev_excl(st->container_devnm)" * Event leaked_handle: Handle variable "container_fd" going out of scope leaks the handle Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
* mdadm: Fix socket connection failure when mdmon runs in foreground mode.Shminderjit Singh2024-07-021-2/+4
| | | | | | | | | | | | | | | | | | | | While creating an IMSM RAID, mdadm will wait for the mdmon main process to finish if mdmon runs in forking mode. This is because with "Type=forking" in the mdmon service unit file, "systemctl start service" will block until the main process of mdmon exits. At that moment, mdmon has already created the socket, so the subsequent socket connect from mdadm will succeed. However, when mdmon runs in foreground mode (without "Type=forking" in the service unit file), "systemctl start service" will return once the mdmon process starts. This causes mdadm and mdmon to run in parallel, which may lead to a socket connection failure since mdmon has not yet initialized the socket when mdadm tries to connect. If the next instruction/command is to access this device and try to write to it, a permission error will occur since mdmon has not yet set the array to RW mode. Signed-off-by: Shminderjit Singh <shminderjit.singh@oracle.com>
* mdadm: Block SIGCHLD processes before starting childrenLogan Gunthorpe2024-06-131-0/+1
| | | | | | | | | | | | | | | There is a small race condition noticed during code review, but never actully hit in practice, with the write_zero feature. If a write zeros fork finishes quickly before wait_for_zero_forks() gets called, then the SIGCHLD will be delivered before the signalfd is setup. While this is only theoretical, fix this by blocking the SIGCHLD signal before forking any children. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: Fix hang race condition in wait_for_zero_forks()Logan Gunthorpe2024-06-131-13/+15
| | | | | | | | | | | | | | | | | | Running a create operation with --write-zeros can randomly hang forever waiting for child processes. This happens roughly on in ten runs with when running with small (20MB) loop devices. The bug is caused by the fact that signals can be coallesced into one if they are not read by signalfd quick enough. So if two children finish at exactly the same time, only one SIGCHLD will be received by the parent. To fix this, wait on all processes with WNOHANG every time a SIGCHLD is received and exit when all processes have been waited on. Reported-by: Xiao Ni <xni@redhat.com> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* imsm: support RAID 10 with more than 4 drivesMateusz Kusiak2024-05-071-1/+8
| | | | | | | | | | | | | | | | | VROC UEFI driver does not support RAID 10 with more than 4 drives. Add user prompts if such layout is being created and for R0->R10 reshapes. Refactor ask() function: - simplify the code, - remove dialog reattempts, - do no pass '?' sign on function calls, - highlight default option on output. This patch completes adding support for R10D4+ to IMSM. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Create.c: fix uclibc buildFabrice Fontaine2024-04-151-0/+4
| | | | | | | | | | | | | | | | | Define FALLOC_FL_ZERO_RANGE if needed as FALLOC_FL_ZERO_RANGE is only defined for aarch64 on uclibc-ng resulting in the following or1k build failure since commit 577fd10486d8d1472a6b559066f344ac30a3a391: Create.c: In function 'write_zeroes_fork': Create.c:155:35: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function) 155 | if (fallocate(fd, FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE, | ^~~~~~~~~~~~~~~~~~~~ Fixes: - http://autobuild.buildroot.org/results/0e04bcdb591ca5642053e1f7e31384f06581e989 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Create: Use device policiesMariusz Tkaczyk2024-03-111-6/+25
| | | | | | | | | | | Generate and compare policies, abort if policies do not match. It is tested for both create modes, with container and disk list specified directly. It is used if supertype supports it. For a case when disk list is specified, container may contain more devices, so additional check on container is done to analyze all disks. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm: introduce sysfs_get_container_devnm()Mariusz Tkaczyk2024-03-111-11/+10
| | | | | | | | There at least two places where it is done directly, so replace them with function. Print message about creating external array, add "/dev/" prefix to refer directly to devnode. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Create: add_disk_to_super() fix resource leakMateusz Kusiak2024-02-231-1/+5
| | | | | | | Fixes resource leak in add_disk_to_super(). Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> 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>
* udev: Move udev_block() and udev_unblock() into udev.cMateusz Grzonka2023-11-211-0/+1
| | | | | | | | Add kernel style comments and better error handling. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Kinga Tanska <kinga.tanska@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm: set ident.devname if applicableMariusz Tkaczyk2023-10-261-19/+16
| | | | | | | | | | | | | | | This patch tries to propagate the usage of struct mddev_ident for cmdline where it is applicable. To avoid regression, this value is derived from devlist->devname for applicable modes only. As a result, the whole structure is passed to some functions. It produces some changes for Build, Create and Assemble. No functional changes intended. The goal of the change is to unify devname validation which is done in next patches. 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-4/+3
| | | | | | | | 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>
* Bump minimum kernel version to 2.6.32Jes Sorensen2023-04-101-5/+0
| | | | | | | Summary: At this point it probably is reasonable to drop support for anything prior to 3.10. Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Create: Fix checking for container in update_metadataMateusz Grzonka2023-03-231-1/+1
| | | | | | | | | | | | | | | | The commit 8a4ce2c05386 ("Create: Factor out add_disks() helpers") introduced a regression that caused timeouts and udev failing to create links. Steps to reproduce the issue were as following: $ mdadm -CR imsm -e imsm -n4 /dev/nvme[0-3]n1 $ mdadm -CR vol -l5 -n4 /dev/nvme[0-3]n1 --assume-clean I found the check for container was wrong because negation was missing. Fixes: 8a4ce2c05386 ("Create: Factor out add_disks() helpers") Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm: Add --write-zeros option for CreateLogan Gunthorpe2023-03-131-2/+174
| | | | | | | | | | | | | | | | | | | | | Add the --write-zeros option for Create which will send a write zeros request to all the disks before assembling the array. After zeroing the array, the disks will be in a known clean state and the initial sync may be skipped. Writing zeroes is best used when there is a hardware offload method to zero the data. But even still, zeroing can take several minutes on a large device. Because of this, all disks are zeroed in parallel using their own forked process and a message is printed to the user. The main process will proceed only after all the zeroing processes have completed successfully. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Acked-by: Kinga Tanska <kinga.tanska@linux.intel.com> Reviewed-by: Xiao Ni <xni@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Acked-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm: Introduce pr_info()Logan Gunthorpe2023-03-131-3/+4
| | | | | | | | | | | | | | | | | | | | | Feedback was given to avoid informational pr_err() calls that print to stderr, even though that's done all through out the code. Using printf() directly doesn't maintain the same format (an "mdadm" prefix on every line. So introduce pr_info() which prints to stdout with the same format and use it for a couple informational pr_err() calls in Create(). Future work can make this call used in more cases. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Acked-by: Kinga Tanska <kinga.tanska@linux.intel.com> Reviewed-by: Xiao Ni <xni@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Acked-by: Coly Li <colyli@suse.de> Acked-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Create: Factor out add_disks() helpersLogan Gunthorpe2023-03-131-169/+213
| | | | | | | | | | | | | | | | | | | | | The Create function is massive with a very large number of variables. Reading and understanding the function is almost impossible. To help with this, factor out the two pass loop that adds the disks to the array. This moves about 160 lines into three new helper functions and removes a bunch of local variables from the main Create function. The main new helper function add_disks() does the two pass loop and calls into add_disk_to_super() and update_metadata(). Factoring out the latter two helpers also helps to reduce a ton of indentation. No functional changes intended. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Acked-by: Kinga Tanska <kinga.tanska@linux.intel.com> Reviewed-by: Xiao Ni <xni@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Acked-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Create: remove safe_mode_delay local variableLogan Gunthorpe2023-03-131-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | All .getinfo_super() call sets the info.safe_mode_delay variables to a constant value, so no matter what the current state is that function will always set it to the same value. Create() calls .getinfo_super() multiple times while creating the array. The value is stored in a local variable for every disk in the loop to add disks (so the last disc call takes precedence). The local variable is then used in the call to sysfs_set_safemode(). This can be simplified by using info.safe_mode_delay directly. The info variable had .getinfo_super() called on it early in the function so, by the reasoning above, it will have the same value as the local variable which can thus be removed. Doing this allows for factoring out code from Create() in a subsequent patch. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Acked-by: Kinga Tanska <kinga.tanska@linux.intel.com> Reviewed-by: Xiao Ni <xni@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Acked-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* Create: goto abort_locked instead of return 1 in error pathLogan Gunthorpe2023-03-131-1/+1
| | | | | | | | | | | | | The return 1 after the fstat_is_blkdev() check should be replaced with an error return that goes through the error path to unlock resources locked by this function. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Acked-by: Kinga Tanska <kinga.tanska@linux.intel.com> Reviewed-by: Xiao Ni <xni@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Acked-by: Coly Li <colyli@suse.de> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm: replace container level checking with inlineKinga Tanska2022-09-291-3/+3
| | | | | | | | | 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>
* mdadm: move data_offset to struct shapeMariusz Tkaczyk2022-08-231-8/+8
| | | | | | | | Data offset is a shape property so move it there to remove additional parameter from some functions. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm: add map_num_s()Mariusz Tkaczyk2022-04-051-1/+1
| | | | | | | | | | | | | | map_num() returns NULL if key is not defined. This patch adds alternative, non NULL version for cases where NULL is not expected. There are many printf() calls where map_num() is called on variable without NULL verification. It works, even if NULL is passed because gcc is able to ignore NULL argument quietly but the behavior is undefined. For safety reasons such usages will use map_num_s() now. It is a potential point of regression. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Create, Build: use default_layout()Mariusz Tkaczyk2022-04-051-26/+41
| | | | | | | | | | | This code is duplicated for Build mode so make default_layout() extern and use it. Simplify the function structure. It introduced change for Build mode, now for raid0 RAID0_ORIG_LAYOUT will be returned same as for Create. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* disallow create or grow clustered bitmap with writemostly setNigel Croxon2021-10-081-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Do not support creating an MD array on a clustered system (--bitmap=clustered) and disks with the write mostly (--write-mostly) flag set. Or do not grow an MD array on a non-clustered bitmap to a clustered bitmap with disks having the write mostly flag set. The actual results is the MD array is created successfully. But the expected results should be a failure with an error message stating: Can not set --write-mostly with a clustered bitmap. and disks marked write-mostly are not supported with clustered bitmap. V2: Added the device name in the error message during creation: mdadm -CR /dev/md0 -l1 --raid-devices=2 /dev/sda --write-mostly /dev/sdb --bitmap=clustered mdadm: Can not set /dev/sdb --write-mostly with a clustered bitmap. Added the array name in the error message when growing: mdadm --grow /dev/md0 --bitmap=clustered mdadm: /dev/md0 disks marked write-mostly are not supported with clustered bitmap Signed-off-by: Nigel Croxon <ncroxon@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Fix error message when creating raid 4, 5 and 10Mateusz Grzonka2021-10-081-1/+1
| | | | | | | | Change inappropriate error message "at least 2 raid-devices needed for level 4 or 5" to only mention relevant raid level. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Add error handling for chunk size in RAID1Mateusz Grzonka2021-07-161-3/+2
| | | | | | | Print error if chunk size is set as it is not supported. Signed-off-by: Mateusz Grzonka <mateusz.grzonka@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Create: Block automatic enabling bitmap for external metadataJakub Radtke2021-03-091-0/+1
| | | | | | | | | | | For external metadata, bitmap should be added only when explicitly set by the administrator. They could be additional requirements to consider before enabling the external metadata's functionality (e.g., kernel support). Signed-off-by: Jakub Radtke <jakub.radtke@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Enable bitmap support for external metadataJakub Radtke2021-03-091-0/+12
| | | | | | | | | | | The patch enables the implementation of a write-intent bitmap for external metadata. Configuration of the internal bitmaps for non-native metadata requires the extension in superswitch to perform an additional sysfs setup before the array is activated. Signed-off-by: Jakub Radtke <jakub.radtke@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Create.c: close mdfd and generate ueventMariusz Tkaczyk2020-11-261-5/+2
| | | | | | | | | During mdfd closing change event is not generated because open() is called before start watching mddevice by udev. Device is ready at this stage. Unblock device, close fd and generate event to give a chance next layers to work. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* Don't create bitmap for raid5 with journal diskXiao Ni2020-10-141-0/+1
| | | | | | | | Journal disk and bitmap can't exist at the same time. It needs to check if the raid has a journal disk when creating bitmap. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Create: add support for RAID0 layouts.NeilBrown2019-12-021-0/+11
| | | | | | | | | | | | | | Since Linux 5.4 a layout is needed for RAID0 arrays with varying device sizes. This patch makes the layout of an array visible (via --examine) and sets the layout on newly created arrays. --layout=dangerous can be used to avoid setting a layout so that they array can be used on older kernels. Tested-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Create: Block rounding size to maxMariusz Tkaczyk2019-04-101-3/+20
| | | | | | | | | When passed size is smaller than chunk, mdadm rounds it to 0 but 0 there means max available space. Block it for every metadata. Remove the same check from imsm routine. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Fix spelling typos.Dimitri John Ledkov2019-02-111-1/+1
| | | | | Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: Allow create RAID volume with link to containerMichal Zylowski2018-04-101-1/+1
| | | | | | | | | | | | | After 1db03765("Subdevs can't be all missing when create raid device") raid volume can't be created with link to container. This feature should not be blocked in Create function. IMSM code forbids creation of container with missing disk, so case like all dev's missing is already handled. Permit IMSM volume creation when devices are given as link to container. Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Subdevs can't be all missing when create raid deviceXiao Ni2018-01-261-0/+4
| | | | | Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/util: unify fstat checking blkdev into functionZhilong Liu2017-05-051-13/+10
| | | | | | | | | | | | 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>
* Create: tell udev md device is not ready when first created.NeilBrown2017-05-021-1/+8
| | | | | | | | | | | | | | | | | | | | | 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>
* Create: Remove all attemps to handle md driver older than 0.90.03Jes Sorensen2017-04-051-25/+5
| | | | | | More legacy code moved to the bit-bucket. Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Create: Fixup various whitespace issuesJes Sorensen2017-04-051-26/+24
| | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Create: Fixup bad placement of logical || && in multi-line if statementsJes Sorensen2017-04-051-17/+11
| | | | | | These always go at the end of the line, never at the front Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* mdadm/Create: declaring an existing struct within same functionZhilong Liu2017-04-051-6/+6
| | | | | | | | | Create:declaring 'struct stat stb' twice within the same function, rename stb as stb2 when declares 'struct stat' at the second time. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* sysfs: Make sysfs_init() return an error codeJes Sorensen2017-03-301-2/+8
| | | | | | | | 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>
* util: Introduce md_get_array_info()Jes Sorensen2017-03-291-3/+2
| | | | | | | | | | | Remove most direct ioctl calls for GET_ARRAY_INFO, except for one, which will be addressed in the next patch. This is the start of the effort to clean up the use of ioctl calls and introduce a more structured API, which will use sysfs and fall back to ioctl for backup. Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* super1: PPL supportArtur Paszkiewicz2017-03-291-0/+2
| | | | | | | | | | | | | | | | Enable creating and assembling raid5 arrays with PPL for 1.x metadata. When creating, reserve enough space for PPL and store its size and location in the superblock and set MD_FEATURE_PPL bit. Write an initial empty header in the PPL area on each device. PPL is stored in the metadata region reserved for internal write-intent bitmap, so don't allow using bitmap and PPL together. While at it, fix two endianness issues in write_empty_r5l_meta_block() and write_init_super1(). Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Generic support for --consistency-policy and PPLArtur Paszkiewicz2017-03-291-4/+14
| | | | | | | | | | | | | Add a new parameter to mdadm: --consistency-policy=. It determines how the array maintains consistency in case of unexpected shutdown. This maps to the md sysfs attribute 'consistency_policy'. It can be used to create a raid5 array using PPL. Add the necessary plumbing to pass this option to metadata handlers. The write journal and bitmap functionalities are treated as different policies, which are implicitly selected when using --write-journal or --bitmap options. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* Introduce enum flag_mode for setting and clearing flags.NeilBrown2016-11-291-2/+2
| | | | | | | | | | | | | | We currently use '1' to indicate that a flag (writemostly or failfast) needs to be set, and '2' to indicate that it needs to be cleared. Using magic number like this is not a best-practice. So replaced them with values from a enum. No functional change. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* Add failfast support.NeilBrown2016-11-281-0/+2
| | | | | | | | | | | | | Allow per-device "failfast" flag to be set when creating an array or adding devices to an array. When re-adding a device which had the failfast flag, it can be removed using --nofailfast. failfast status is printed in --detail and --examine output. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* mdadm: Make add_internal_bitmap() return 0 on successJes Sorensen2016-05-121-3/+3
| | | | | | | | add_internal_bitmap() returned 1 on success and 0 on error which is inconsistent. This changes it to return 0 on success and use more reasonable error codes on error. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* Create: check the node nums when create clustered raidGuoqing Jiang2016-05-091-1/+6
| | | | | | | | | It doesn't make sense to create a clustered raid with only 1 node. Reported-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>