summaryrefslogtreecommitdiffstats
path: root/Incremental.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Incremental: Remove redundant call for GET_ARRAY_INFOJes Sorensen2017-03-291-8/+6
| | | | | | | | | | | | The code above just called md_get_array_info() and only reached this point if it returned an error that isn't ENODEV, so it's pointless to check this again here. In addition it was incorrectly retrieving ioctl data into a mdu_bitmap_file_t instead of mdu_array_info_t. Fixes: ("8382f19 Add new mode: --incremental") Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
* util: Introduce md_get_array_info()Jes Sorensen2017-03-291-6/+5
| | | | | | | | | | | 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/+3
| | | | | | | | | | | | | | | | 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>
* 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/+1
| | | | | | | | | | | | | 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>
* Incremental: don't try to load_container() for a subarrayArtur Paszkiewicz2016-08-091-1/+5
| | | | | | | | mdadm -IRs would exit with a non-zero status because of this. Reported-by: Xiao Ni <xni@redhat.com> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* Incremental: Remove unnecesary NULL pointer checks when calling sysfs_free()Jes Sorensen2016-03-081-6/+3
| | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
* Merge branch 'fix-unlikely-potential-overflows' of https://github.com/sjvs/mdadmNeilBrown2015-12-211-4/+4
|\
| * avoid confusion with parameter 'devname' with same name, ensure buffer is ↵Bas van Schaik2015-12-031-3/+3
| | | | | | | | large enough for two ints plus extras
| * ensure buffer is large enough for two ints and some extrasBas van Schaik2015-12-031-1/+1
| |
* | mdadm: let cluster raid could also add disk within incremental modeGuoqing Jiang2015-12-161-0/+4
|/ | | | | | | | | For cluster raid, the disc.state need to be changed accordingly under incremental mode. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
* mdadm: refactor write journal code in Assemble and IncrementalSong Liu2015-10-221-18/+7
| | | | | | | | | | | | | | | | | | As discussed, standalone require_journal() in struct superswitch is not a very good idea. Instead, journal related information fits well in struct mdinfo. This patch simplifies journal support code in Assemble and Incremental as: - Add journal_device_required and journal_clean to struct mdinfo; - Remove function require_journal from struct superswitch; - Update Assemble and Incremental to use journal_device_required and journal_clean from struct mdinfo (instead of separate var). Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Check write journal in incrementalSong Liu2015-10-191-4/+27
| | | | | | | | | | | | | | | | | | | | | | If journal device is missing, do not start the array, and shows: ./mdadm -I /dev/sdf mdadm: journal device is missing, not safe to start yet. The array will be started when the journal device is attached with -I ./mdadm -I /dev/sdb1 mdadm: /dev/sdb1 attached to /dev/md/0_0, which has been started. To force start without journal device: ./mdadm -I /dev/sdf --run mdadm: Trying to run with missing journal device mdadm: /dev/sdf attached to /dev/md/0_0, which has been started. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* Fix --incremental handling on cluster array.Goldwyn Rodrigues2015-09-281-5/+6
| | | | | | | | | | | Commit 06bd679317a2 ("Skip clustered devices in incremental") disabled incremental completely on clustered arrays. What we really want is that mdadm should not start or create a clustered array but still be able to add or readd to an existing device. This would enable udev scripts to automatically add or re-add a device after transient errors. Signed-off-by: NeilBrown <neilb@suse.com>
* Merge branch 'mdadm-3.3.x'NeilBrown2015-08-031-1/+1
|\
| * Assemble: really don't assemble IMSM array without OROM.NeilBrown2015-08-031-1/+1
| | | | | | | | | | | | | | | | | | Previous patch missed on case. Also print more useful information when rejecting a device with IMSM metadata. Signed-off-by: NeilBrown <neilb@suse.com>
| * Assemble: don't assemble IMSM array without OROM.NeilBrown2015-08-031-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If someone has an IMSM array, and disables RAID in the BIOS and uses the devices for some other purpose, then they really don't want mdadm to start syncing the array. So don't assemble if OROM doesn't confirm it is OK. There can still be problems for crash-dump not being able to find the OROM. Some explicit work-around might be needed for that rather than a more general workaround that can corrupt data. Signed-off-by: NeilBrown <neilb@suse.com>
* | Assemble: don't assemble IMSM array without OROM.NeilBrown2015-07-291-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If someone has an IMSM array, and disables RAID in the BIOS and uses the devices for some other purpose, then they really don't want mdadm to start syncing the array. So don't assemble if OROM doesn't confirm it is OK. There can still be problems for crash-dump not being able to find the OROM. Some explicit work-around might be needed for that rather than a more general workaround that can corrupt data. Signed-off-by: NeilBrown <neilb@suse.com>
* | Merge branch 'cluster'NeilBrown2015-07-271-0/+5
|\ \ | |/ |/| | | | | | | Now that 3.3.3 is out, it is time to include the cluster-support code. Signed-off-by: NeilBrown <neilb@suse.com>
| * Skip clustered devices in incrementalGuoqing Jiang2015-06-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | We want the clustered devices to be started exclusively by a cluster resource-agent. So, avoid starting using the incremental option. This also skips a clustered md from starting during boot in inactive mode. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
* | mdstat: discard 'dev' field, just use 'devnm'NeilBrown2015-07-021-6/+6
|/ | | | | | | | These both have the same value, and have done since the 'devnm' concept was introduced. So discard the pointless duplicate. Signed-off-by: NeilBrown <neilb@suse.de>
* IncRemove: Set "auto-read" only after successful excl open.Pawel Baldysiak2015-03-041-6/+10
| | | | | | | | | | | | | "mdadm -If" - triggered from udev rules when disk is removed from OS - tries to set array in auto-read-only mode. This can interrupt rebuild process which is started automatically, e.g. if array is mounted and spare disk is available (I/O error is detected faster than removing failed disk by mdadm). This patch prevents "mdadm -If" from setting array into "auto-read-only", by requiring exclusive open to succeed. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* IncrementalScan(): Make sure 'st' is valid before dereferencing itJes Sorensen2015-03-041-1/+1
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Don't break long strings onto multiple lines.NeilBrown2015-02-121-29/+14
| | | | | | | | | | | | | | | | | It is best to keep strings all together so that they are easier to search for in the source code. If a string is so long that it looks ugly one line, them maybe it should be broken into multiple lines for display too. Only strings which contain a newline can be broken into multiple lines: "It is OK to\n" "break this string\n" Signed-off-by: NeilBrown <neilb@suse.de>
* Consistently print program Name and __func__ in debug messages.NeilBrown2015-02-121-2/+2
| | | | | | | | | | | | make dprintf() print program name and __func__, so that this messaging is consistent. Also remove all __func__ messages from pr_err(). We shouldn't leak that internal data in error message. If we really want function name there, we new pr_XXX might be wanted. Signed-off-by: NeilBrown <neilb@suse.de>
* Change way of printing name of a processPawel Baldysiak2015-02-121-2/+2
| | | | | | | | | | | | | Sometimes mdadm prints messages with wrong name "mdmon", and vice versa. This patch solves this problem by changing method of determining process name. Now "Name" will be set in const at start of a program, previously was hardcoded as #define. 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>
* Incremental: don't be distracted by partition table when calling try_spare.NeilBrown2014-11-051-2/+2
| | | | | | | | | | | | Currently a partition table on a device makes "mdadm -I" think the array has a particular metadata type and so will only add it to an array of that (partition table) type .. which doesn't make any sense. So tell guess_super to only look for 'array' metadata. Reported-by: Caspar Smit <c.smit@truebit.nl> Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble/Incremental: don't hold O_EXCL on mddev after assembly.NeilBrown2013-12-051-3/+7
| | | | | | | 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-031-2/+16
| | | | | | | | | | | | | | | | | --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-281-8/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Incremental: don't abort container if one member explicitly disabled.NeilBrown2013-11-281-1/+1
| | | | | | | If a member of a container is explicitly disabled, others may not be so we should continue. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: remove test that can never succeed.NeilBrown2013-11-281-5/+0
| | | | | | | | Incremental_container never returns 1, so this test is pointless. It is a holdover from when we called "Incremental()" rather than "Incremental_container()" at this point. Signed-off-by: NeilBrown <neilb@suse.de>
* Make -IRs and --run work properly for containers.NeilBrown2013-09-131-8/+45
| | | | | | | | 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>
* Release mdadm-3.3mdadm-3.3NeilBrown2013-09-031-1/+1
| | | | | | (and various cosmetic fixes) Signed-off-by: NeilBrown <neilb@suse.de>
* Change "mdadm --run" to use the same code as "mdadm --IRs".NeilBrown2013-08-261-2/+6
| | | | | | | | | | | 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>
* Manage: split Manage_runstop into Manage_run and Manage_stopNeilBrown2013-06-191-2/+1
| | | | | | | The two branches have virtually nothing in common, so it is simpler if they are separate. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble/Incr: Don't include spares with too-high event count.NeilBrown2013-06-171-0/+8
| | | | | | | | | | | Some failure scenarios can leave a spare with a higher event count than an in-sync device. Assembling an array like this will confuse the kernel. So detect spares with event counts higher than the best non-spare event count and exclude them from the array. Reported-by: Alexander Lyakas <alex.bolshoy@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: allow --quiet to silence from errors from "-If"NeilBrown2013-05-291-3/+5
| | | | | | | -q is currently ineffective on "mdadm -If". Messages that are not usage errors should be suppressed. Signed-off-by: NeilBrown <neilb@suse.de>
* Change some "fprintf(stderr,"s to pr_err.NeilBrown2013-05-211-4/+3
| | | | | | They just keep slipping in.. Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: remove partitions when assembling.NeilBrown2013-05-141-0/+2
| | | | | | | | We remove partitions for --create and --assemble, but not for --incrmental. So fix that ommision. Signed-off-by: NeilBrown <neilb@suse.de>
* Incrmental: tell udevs to unmount when array looks to have disappeared.NeilBrown2013-05-131-1/+22
| | | | | | | | | | If a device is removed which appears to be busy in an md array, then it is very like the array cannot be used. We currently try to stop it, but that could fail if udisks had automatically mounted it. So tell udisks to unmount it, but ignore any error. Signed-off-by: NeilBrown <neilb@suse.de>
* Enhance incremental removal.NeilBrown2013-03-041-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | When asked to incrementally-remove a device, try marking the array read-auto first. That will delay recording the failure in the metadata until it is really relevant. This way, if the device are just unplugged when the array is not really in use, the metadata will remain clean. If marking the default as faulty fails because it is EBUSY, that implies that the array would be failed without the device. As the device has (presumably gone) - that means the array is dead. So try to stop it. If that fails because it is in use, send a uevent to report that it is gone. Hopefully whoever mounted it will now let go. This means that if you plug in some devices and they are auto-assembled, then unplugging them will auto-deassemble relatively cleanly. To be complete, we really need the kernel to disassemble the array after the last close somehow. Maybe if a REMOVE has failed and a STOP has failed and nothing else much has happened, it could safely stop the array on last close. Signed-off-by: NeilBrown <neilb@suse.de>
* Discard devnum in favour of devnmNeilBrown2013-02-211-29/+28
| | | | | | | | | | | | | | 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>
* Incremental: allow recently removed device to be added as a spare.NeilBrown2012-11-201-2/+14
| | | | | | | | | | | | | Currently, action=force-spare isn't effective at all as I'm not sure what is really sensible. This patch allows a device that was part of an array, but has been removed, to be added as a spare of passed to --incremental while force-spare is active. If it is can be re-added, that done first. If it fails, we add it as a spare. Signed-off-by: NeilBrown <neilb@suse.de>
* IMSM - allow assembling any imsm array even without OROM.NeilBrown2012-11-201-0/+3
| | | | | | | | | | | | | | | | 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>
* Incremental: support replacement devices.NeilBrown2012-10-241-2/+4
| | | | | | These need to be counted in the number of 'active' devices. Signed-off-by: NeilBrown <neilb@suse.de>
* Fix up interactions between --assemble and --incrementalNeilBrown2012-10-101-1/+17
| | | | | | | | | | | | | | If --incremental has partly assembled an array and --assemble is asked to assemble it, the just finds remaining devices and makes a new array. Not good. So: 1/ modify locking policy so that assemble can be sure that no --incremental is running once it locks the map file 2/ Assemble() checks the map file for a duplicate and adds to that array instead of creating a new one. Signed-off-by: NeilBrown <neilb@suse.de>
* New RESHAPE_NO_BACKUP flag to track when backup action is needed.NeilBrown2012-10-041-0/+11
| | | | | | | | | | | | 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>
* Add data_offset arg to ->avail_sizeNeilBrown2012-10-041-1/+5
| | | | | | | 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>
* Minor cosmetic fixes in various files.NeilBrown2012-08-131-10/+9
| | | | Signed-off-by: NeilBrown <neilb@suse.de>