summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* mdadm: Uninitialized variable rdevJames Puthukattukaran2017-05-161-1/+1
| | | | | | | rdev is not initialized properly causing compiler complaint. Signed-off-by: James Puthukattukaran <joejames70@gmail.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: Fixup a pile of whitespace issuesJes Sorensen2017-05-111-55/+55
| | | | | | No code was hurt in this event Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: mailfrom is initialized correctlyJes Sorensen2017-05-111-1/+1
| | | | | | Remove gratituous variable initialization. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: Not much point declaring mdlist in both forks of the if() statementJes Sorensen2017-05-111-2/+3
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* retire the APIs that driver no longer supportsZhilong Liu2017-05-112-8/+0
| | | | | | | | | | refer to commit: e6e5f8f1267d ("Build: Stop bothering about supporting md driver ...") continue to retire the APIs that md driver wasn't supported for very long period of time. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* IMSM: Correct --examine output for 4k disksMaksymilian Kunt2017-05-111-2/+5
| | | | | | | | | | | | "Array Size" and "Per Dev Size" are incorrect for disks with sector size different than 512B. Calculate "Array Size" and "Per Dev Size" based on sector size. Additionally print "Sector Size". Signed-off-by: Maksymilian Kunt <maksymilian.kunt@intel.com> Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor/check_array: Use working_disks from sysfsJes Sorensen2017-05-091-2/+2
| | | | | | sysfs now provides working_disks information, so lets use it too. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* sysfs/sysfs_read: Count working_disksJes Sorensen2017-05-091-6/+9
| | | | | | | This counts working_disks the same way as get_array_info counts it in the kernel. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor/check_array: Get nr_disks, active_disks and spare_disks from sysfsJes Sorensen2017-05-091-7/+7
| | | | | | | This leaves working_disks and utime missing before we can eliminate check_array()'s call to md_get_array_info() Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor/check_array: Get array_disks from sysfsJes Sorensen2017-05-091-2/+2
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor/check_array: Get 'failed_disks' from sysfsJes Sorensen2017-05-091-3/+4
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor/check_array: Obtain RAID level from syfsJes Sorensen2017-05-091-3/+3
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor/check_array: Read sysfs entry earlierJes Sorensen2017-05-091-6/+10
| | | | | | | This will allow us to pull additional info from sysfs, such as level and device info. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor/check_array: Declate mdinfo instance globallyJes Sorensen2017-05-091-2/+2
| | | | | | We can pull in more information from sysfs earlier, so move sra to the top. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor/check_array: Reduce duplicated error handlingJes Sorensen2017-05-091-24/+15
| | | | | | | Avoid closing fd in multiple places, and duplicating the error message for when a device disappeared. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor/check_array: Centralize exit pathJes Sorensen2017-05-091-10/+14
| | | | | | | Improve exit handling to make it easier to share error handling and free sysfs entries later. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Add sector size as spare selection criterionAlexey Obitotskiy2017-05-095-3/+45
| | | | | | | | | | | 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-095-41/+62
| | | | | | | | | | | | | | 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>
* imsm: don't allow disks with different sector size in one arrayAlexey Obitotskiy2017-05-091-0/+24
| | | | | | | | | | | As there is no support in IMSM for arrays including disks with different sector sizes, don't allow to create such configuration. Also skip the disk with unsuitable sector size when looking for spares in the same container. 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>
* imsm: allocate buffer to support maximum sector sizeAlexey Obitotskiy2017-05-091-10/+11
| | | | | | | | | | | | Allocate migration record buffer to support maximum sector size. Disk with non-matching sector size is not going to be included in the array, however some preparation/cleanup actions still take place on it and they would cause a crash. Clear migration record using sector size of the disk (not array) as they might not match. 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>
* imsm: allow drives in a container regardless of sector sizeAlexey Obitotskiy2017-05-091-6/+0
| | | | | | | | | | | | | | | | IMSM doesn't allow to create arrays including drives with different sector sizes. The initial idea was not to permit to combine drives with different sector size in the same container. The problem is it only worked for array creation. On array assemble there are no calls to metadata handlers to see if drive is suitable for a container (e.g. as a spare) and it leads to wrong configuration. Revert the change and allow adding drives with different sector size to the container. 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>
* mdadm/md.4: set page-length as 1000 to avoid warnings from grottyZhilong Liu2017-05-091-0/+1
| | | | | | | | | | | | | | "nroff" ("man") or ("tbl") needs a long page to avoid warnings from "grotty", set 'pl' as 1000 to fix the following issue. This command invokes by Makefile rule. linux-tjrh:~/mdadm # man -l md.4 > test grotty:<standard input> (<standard input>):5967: character above first line discarded ... ... Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: Code is 80 characters per lineJes Sorensen2017-05-081-34/+27
| | | | | | | Fix up some lines that are too long for no reason, and some that have silly line breaks. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: Use md_array_active() instead of manually fiddling in sysfsJes Sorensen2017-05-081-28/+11
| | | | | | | This removes a pile of clutter that can easily behandled with a simple check of array_state. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Mention "endian" in documentation for --update=byte-orderNeilBrown2017-05-081-1/+2
| | | | | | | | This makes it easier to find as "endian" is a commonly used term. Reported-by: Trevor Cordes <trevor@tecnopolis.ca> Signed-off-by: NeilBrown <neilb@suse.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>
* sysfs/sysfs_read: Count active_disks and failed_disksJes Sorensen2017-05-051-2/+8
| | | | | | | Cound active_disks as drives mark 'in_sync' and failed_disks as disks marked 'faulty', in the same way ioctl(GET_ARRAY_INFO) does. 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>
* Fix typo in new udev rule.NeilBrown2017-05-052-2/+2
| | | | | | | | | | | | As pointed out by Peter Rajnoha, the correct usage in udev is TEST=="file", not TEST="file". Also improve a related comment which was a bit informal. Reported-by: Peter Rajnoha <prajnoha@redhat.com> Fixes: cd6cbb08c458 ("Create: tell udev md device is not ready when first created.") Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/util: unify stat checking blkdev into functionZhilong Liu2017-05-059-77/+41
| | | | | | | | | | | | 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-0510-74/+62
| | | | | | | | | | | | 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>
* mdassemble: Kill off the last remainsJes Sorensen2017-05-042-70/+4
| | | | | | Having gotten rid of mdassemble, lets get rid of the man page too Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* kernel-patch: Remove obsolete kernel patches against 2.6Jes Sorensen2017-05-045-339/+0
| | | | | | | While we still support some of these kernels, I do not think it makes sense to carry this patches around at this point. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* util: md_array_valid(): Introduce md_array_valid() helperJes Sorensen2017-05-033-2/+26
| | | | | | | | | | | Using md_get_array_info() to determine if an array is valid is broken during creation, since the ioctl() returns -ENODEV if the device is valid but not active. Where did I leave my stash of brown paper bags? Fixes: ("40b054e mdopen/open_mddev: Use md_get_array_info() to determine valid array") Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* change back 0644 permission for Grow.cZhilong Liu2017-05-031-0/+0
| | | | | | | | Fixes commit: 26714713cd2b ("mdadm: Change timestamps to unsigned data type.") Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Grow: Grow_continue_command: Avoid aliasing array variableJes Sorensen2017-05-021-3/+3
| | | | | | | While this would cause a warning since the two are different types, lets avoid aliasing an existing variable. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* IMSM: Initialize my_vol_raid_dev_num during vol creationPawel Baldysiak2017-05-021-2/+9
| | | | | | | | This field was not initialized so far. This ID needs to be unique for every newly created array in container. Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Manage: Manage_ro(): Use md_array_active()Jes Sorensen2017-05-021-4/+2
| | | | | | | One call less to md_get_array_info() for determining whether an array is active or not. 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-029-27/+86
| | | | | | | | | | | | | | | | | | | | | 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>
* Detail: Reinstate support for not having sysfsJes Sorensen2017-04-251-3/+5
| | | | | | | | While sysfs support will hopefully go away eventually, lets not break it unnecessarily for now. Fixes: 901d5ee ("Detail: Stop bothering about md drivers older than 0.90.00") Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Detail: Respect code lines are 80 character wideJes Sorensen2017-04-251-101/+138
| | | | | | In addition apply spaces and don'f do 'if () action()' on the same line. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Detail: determine array state from sysfsJes Sorensen2017-04-251-5/+4
| | | | | | | | | | This is easily obtained from sysfs as part of the existing call to sysfs_read() and it simplifies the code a little too. Another small step in the process of getting rid of the GET_ARRAY_STATE ioctl. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Don't use UnSet with consistency_policyArtur Paszkiewicz2017-04-244-16/+12
| | | | | | | | | Use CONSISTENCY_POLICY_UNKNOWN instead. Simplify some checks because since 5e8e35fb7e17 ("maps: Use keyvalue for null terminator to indicate 'unset' value") map_name() can return this default directly. Suggested-by: Jes Sorensen <Jes.Sorensen@gmail.com> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
* maps: Simplify implementation of map_name()Jes Sorensen2017-04-211-4/+1
| | | | | Reported-By: NeilBrown <neilb@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* maps: Remove incorrect comment about strcmp()Jes Sorensen2017-04-211-4/+0
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Makefile: Default to -O2 optimizationJes Sorensen2017-04-211-0/+1
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>