summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Release mdadm-4.1mdadm-4.1Jes Sorensen2018-10-015-22/+7
| | | | Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: block using partitionMariusz Tkaczyk2018-09-281-0/+5
| | | | | | | | | | | | | When IMSM_NO_PLATFORM is exported mdadm allows to create array with partitions or add partition to existing array but there is no possibilty to assemble it after stopping, see commit 691c6ee1b6bb ("IMSM/DDF: don't recognised these metadata on partitions."). When searching for hba capabilities first test device and print corresponding error if it is a partition. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Assemble: set devices to NULL when load_devices can't load deviceGuoqing Jiang2018-09-271-0/+5
| | | | | | | | | | | | | | | Since load_devices frees "devices" when it can't find any device, we should set it to NULL to avoid double free issue which can be reproduced by below steps: mdadm -CR /dev/md/vol -l0 -e 1.2 -n2 /dev/sd[b-c] --assume-clean mdadm -Ss mdadm -A /dev/md127 /dev/sd[b-c] --update metadata Reported-by: Tkaczyk Mariusz <mariusz.tkaczyk@intel.com> Tested-by: Tkaczyk Mariusz <mariusz.tkaczyk@intel.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Assemble: free resources in load_devicesGuoqing Jiang2018-09-271-0/+3
| | | | | | | | Like other failure cases in load_devices, we need to free those resources as well. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: Avoid duplicate entries in --detail-platformRoman Sobanski2018-09-271-0/+3
| | | | | | | | In some scenarios mdadm --detail-platform shows duplicated info about one of controllers. Block it. Signed-off-by: Roman Sobanski <roman.sobanski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: Block volume creation with empty nameRoman Sobanski2018-09-271-1/+13
| | | | | | | | There is a possibility to create a RAID with empty name. Block it. Also remove trailing and leading whitespaces from given name. Signed-off-by: Roman Sobanski <roman.sobanski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm.c: Fix error handling for --zero-superblockMariusz Tkaczyk2018-09-272-3/+4
| | | | | | | | | | | When Kill() cannot open device or find superblock it return the same error and mdadm ignores it. Change error handling in Kill() function. Return error if device is busy, ignore it only when superblock doesn't exist- assume that metadata is zeroed. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Release mdadm-4.1-rc2mdadm-4.1-rc2Jes Sorensen2018-08-036-5/+22
| | | | 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>
* Grow: Frozen array can't be idleMariusz Tkaczyk2018-08-011-1/+2
| | | | | | | | | | | When array is frozen but there is no recovery/reshape in mdstat, check_idle() will not return error but grow countinue can still working. Check is array frozen. Do not use sysfs sync_action parameter because it doesn't exist for Raid0, simply check metadata_version in mdstat. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* udev.rules: make safe timeouts compatible with split-usr systems.Dimitri John Ledkov2018-07-311-2/+2
| | | | | | | | | | Instead of /usr/bin/sh, and /usr/bin/echo, use /bin/sh and shell built-in echo respectively. This makes udev-md-raid-safe-timeouts.rules to be compatible with both usr-merged and split-usr systems alike. Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Assemble: remove the protection when clustered raid do assembleGuoqing Jiang2018-07-201-21/+0
| | | | | | | | | | | | | | | | | | | | For HA product, RA (resource agent) assembles cluster raid through call below cmd: $MDADM --assemble $mddev --config=$RAIDCONF $MDADM_HOMEHOST Sometimes node can't assemble array because all the nodes need to contend dlm lock, which causes node fence in automatic test. And in fact, we don't need the protection since the assemble cmd called by RA doesn't change superblock, so revert the commit 76781701a487090172d32befae07671a10ea88ad ("Assemble: provide protection when clustered raid do assemble") to remove unneccessary protection. Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mapfile: set *mapp to NULL after map_freeGuoqing Jiang2018-07-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | We can see "double free or corruption" with below steps as reported by Mariusz: export IMSM_NO_PLATFORM=1 export IMSM_DEVNAME_AS_SERIAL=1 mdadm --zero-super /dev/sd* mdadm -C /dev/md/imsm -n2 -eimsm /dev/sdb /dev/sdc --run mdadm -C /dev/md/r1 -n2 -z15G -eimsm /dev/sdb /dev/sdc -l1 --run --assume-clean mdadm -f /dev/md126 /dev/sdb mdadm -Ss It is caused by Manage_stop calls map_remove and map_unlock, but *mapp is not set to NULL after map_remove -> map_free, so map_unlock will call map_free again. Reported-by: Tkaczyk Mariusz <mariusz.tkaczyk@intel.com> Tested-by: Tkaczyk Mariusz <mariusz.tkaczyk@intel.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* tests, imsm: Calculate expected array_size in proper wayMichal Zylowski2018-07-113-8/+26
| | | | | | | | | | | | | Tests should calucalte expected array_size accordingly to raid level. Also tests should take care about runding to neares MB introduced from b53bfba6 "imsm: use rounded size for metadata initialization". Expect proper size in tests. Simplify 09imsm-overlap test by creating array with size which has not been rounded. Main purpose of this test is checking something else. Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* tests, imsm: Migration from RAID5 to RAID0 is not supported for IMSM metadataMichal Zylowski2018-07-112-4/+4
| | | | | | | | | | | When test tries to change RAID level from RAID5 to RAID0 mdadm respond with error about unsporrted operation. Make 16imsm-r5_3d-migrate-r0_3d and 16imsm-r5_5d-migrate-r0_5d test negative. Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* tests, imsm: Test shouldn't call grow with chunk and level in one commandMichal Zylowski2018-07-111-3/+8
| | | | | | | | | | Since a3b831c9 "Grow.c: Block any level migration with chunk size change" there is no possibility to perform migration between level and chunk in one operation. When any test tries to do this error message is printed and tests finishes with fail. Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* tests, imsm: Set new_num_disks value corectly to perform expected size ↵Michal Zylowski2018-07-113-1/+3
| | | | | | | | | | | | | | | | calculations In some migration tests, variable new_num_disks should be set to expected number of disks after migration. This is required for proper expected size calculation. Pass new_num_disks variable during test execution for: - 16imsm-r0_3d-migrate-r5_4d - 18imsm-r1_2d-takeover-r0_1d - 16imsm-r0_5d-migrate-r5_6d Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* tests, imsm: Fix unit inconsistency in tests error messagesMichal Zylowski2018-07-111-1/+1
| | | | | | | | Chunk size copied from sysfs should be divied by 1024 to compare with expected chunk size. Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* tests, imsm: Set correct expected offset between volumesMichal Zylowski2018-07-1113-19/+17
| | | | | | | | | | | Since 611d9529 (imsm: change reserved space to 4MB) gap between RAID volumes has changed. Tests should expect correct offset in size calulations. Fix expected offset for tests. Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Coverity: Resource leak: close fd before returnAnthony Youngman2018-07-111-0/+1
| | | | | Anthony Youngman <anthony@youngman.org.uk> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Coverity: Resource leak: close fds and free array before returnAnthony Youngman2018-07-111-0/+3
| | | | | Signed-off-by: Anthony Youngman <anthony@youngman.org.uk> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Coverity: Resource leak: fix return without freeAnthony Youngman2018-07-111-0/+2
| | | | | Signed-off-by: Anthony Youngman <anthony@youngman.org.uk> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Free map to avoid resource leak issuesGuoqing Jiang2018-06-116-2/+13
| | | | | | | | | | | | | | | | | | | | | | | 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>
* imsm: correct num_data_stripes in metadata map for migrationRoman Sobanski2018-06-081-6/+10
| | | | | | | | | When migrating an array from R0 to R10 num_data_stripes in metadata map will not be updated. Update it to allow correct migration process. Changes in R10 to R0 migration for clarity of code. Signed-off-by: Roman Sobanski <roman.sobanski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Assemble.c Don't ignore faulty disk when array is auto assembled.Mariusz Tkaczyk2018-06-081-0/+2
| | | | | | | | | | | | | | | | | | Since commit 20dc76d15b40 ("imsm: Set disk slot number") mdadm sets slot number for each disk in imsm array. Now auto-assemble determines devices using slot number and ignores devices on the same slot that have older generation number. It causes infinit loop if failed device is still visible in system (it has metadata, but it is not merged with exisiting array). To avoid it, out-of-sync device should be added to the best[]. Later mdadm adds it as spare to the container. Imsm doesn't support disk replacement feature, so it can use rooms for replacements. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* gcc-8 coverity hackJes Sorensen2018-06-042-4/+21
| | | | | | | Coverity still has issues with gcc-7, not to mention gcc-8. Hack around it, until they fix it. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: correct tests/testdev as testdev in 02r5growZhilong Liu2018-06-011-1/+1
| | | | | | | Fixes: a6994ccc230b ("mdadm/test: get rid of the tests/testdev") Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: mdadm needn't make install on the systemZhilong Liu2018-06-011-7/+4
| | | | | | | | | | | | Fixes: beb71de04d31 ("mdadm/test: enable clustermd testing under clustermd_tests/") clustermd_tests/func.sh: remove unnecessary 'make install', just ensure 'make everything' has done. the original idea is to make the /sbin/mdadm version same as ./mdadm, and this breakage has pointed out by commit: 59416da78fc6 ("tests/func.sh: Fix some total breakage in the test scripts") Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Check major number of block device when querying md deviceXiao Ni2018-06-011-3/+2
| | | | | | | | | | | | | | | | | | | It give error message when query a non md device. mdadm /dev/null /dev/null: is an md device, but gives "Inappropriate ioctl for device" when queried It's introduced by commit 5cb8599 and 8d0cd09 At first it checks whether a block is md device by function md_get_version. In this function it does mainly two jobs: 1. send request by ioctl. (now it can be replace by argument ioctlerr) 2. check the block device major number which we don't do this. We add the second judgement in this patch. Fixes: 5cb8599 and 8d0cd09 Reported-by: Karsten Weiss <karsten.weiss@atos.net> Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* super-ddf: Fix gcc-8.1 overflow warningsJes Sorensen2018-05-311-2/+3
| | | | | | | Cast to types that are big enough to hold the values, but also guarantee no overflow of the buffer keepts gcc happy. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* super1: Fix cases triggering gcc-8.1 strncpy truncate warningJes Sorensen2018-05-311-4/+18
| | | | | | | Find the string length, copy it, and zero out the rest, instead of relying on strncpy cleaning up for us. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* super0: Use memmove() when adjusting sparc2.2 superblock dataJes Sorensen2018-05-311-3/+4
| | | | | | memcpy() does not allow overlapping copies, switch to memmove() Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdopen: fix gcc 8.1 string overflow errorJes Sorensen2018-05-311-3/+5
| | | | | | | We already cut symlinks longer than 1000, so rely on this calling readlink and error out if we are able to read more than 1000 bytes. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Monitor: Increase size of percentalert to avoid gcc warningJes Sorensen2018-05-311-1/+1
| | | | | | | | gcc-8.1 complains about truncated string operations. While we know percent will never grow larger than 100, it doesn't cost us anything to increase the size of 'percentalert' on the stack like this. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: Do not require MDADM_EXPERIMENTAL flag anymoreMichal Zylowski2018-05-315-33/+6
| | | | | | | | | | | | | | Grow feature for IMSM metadata is currently fully supported and tested. Reshape operation is not in experimental state anymore, so usage of this flag is unnecessary. Do not require MDADM_EXPERIMENTAL flag and remove obsolete information from manual. Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Acked-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com> Acked-by: Roman Sobanski <roman.sobanski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: Do not block volume creation when container has disks with mixed ↵Michal Zylowski2018-05-311-0/+5
| | | | | | | | | | | | sector size Currently when created container keeps disks with mixed sector size (few 4K disks and some 512 disks) there is no possibility to create volume from disks with one sector size. Allow volume creation when given disks are related with mixed container. Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* super-intel: Do not truncate last character of volume nameJes Sorensen2018-05-301-3/+4
| | | | | | | Clear up strncpy abuse to avoid gcc-8.1 complaining about truncating the string. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* super-intel: Avoid gcc-8.1 complaining about truncating snprintf()Jes Sorensen2018-05-301-1/+2
| | | | | | | We know the max size of the volume name, so no need to play the snprintf() game. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* super-intel: Get rid of unnused stringJes Sorensen2018-05-291-1/+0
| | | | | | No need to snprintf() into the string when we don't use it afterards Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* super-intel: Use memcpy() to avoid confusing gccJes Sorensen2018-05-291-1/+1
| | | | | | | | When added :0 to serial number and copying it back, use memcpy() instead of strncpy() as we know the actual length. This stops gcc from complaining with -Werror=stringop-truncation enabled Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Do not confuse gccJes Sorensen2018-05-291-1/+7
| | | | | | | gcc-8.1's -Werror=stringop-truncation is easily confused. Rather than disabling the check, make it explicit we are OK truncating here. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Fix misspelling of 'alignment' and 'geometry'Michal Zylowski2018-05-291-15/+15
| | | | | | | | | Set gemetry to geometry in error message about geometry validation failed. Fix misspelled 'alignment' word in imsm_component_size_alignment_check function. Signed-off-by: Michal Zylowski <michal.zylowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/grow: correct size and chunk_size castingRoman Sobanski2018-04-271-1/+1
| | | | | | | | | | With commit 4b74a905a67e ("mdadm/grow: Component size must be larger than chunk size") mdadm returns incorrect message if size given to grow was greater than 2 147 483 647 K. Cast chunk_size to "unsigned long long" instead of casting size to "int". Signed-off-by: Roman Sobanski <roman.sobanski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* Prevent create IMSM volume with size smaller than 1M or chunkRoman Sobanski2018-04-251-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Block creation of the imsm volume when given size is smaller than 1M and print appropriate message. Commit b53bfba6119d3f6f56eb9e10e5a59da6901af159 (imsm: use rounded size for metadata initialization) introduces issue with rounding volume sizes smaller than 1M to 0. There is an inconsistency when size smaller than 1M was given depends of what we give as target device: 1) When block devices was given created volume has maximum available size. 2) When container symlink was given created volume has size 0. Additionally it causes below call trace: [69587.891556] WARNING: CPU: 28 PID: 22485 at ../drivers/md/md.c:7582 md_seq_show+0x764/0x770 [md_mod] [69588.066405] Call Trace: [69588.066409] seq_read+0x336/0x430 [69588.066411] proc_reg_read+0x40/0x70 [69588.066412] __vfs_read+0x26/0x140 [69588.066414] vfs_read+0x89/0x130 [69588.066415] SyS_read+0x42/0x90 [69588.066417] do_syscall_64+0x74/0x140 [69588.066419] entry_SYSCALL_64_after_hwframe+0x3d/0xa2 Signed-off-by: Roman Sobanski <roman.sobanski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: do not use blocks_per_member in array size calculationsMariusz Dabrowski2018-04-121-29/+76
| | | | | | | | | | | | mdadm assumes that blocks_per_member value is equal to num_data_stripes * blocks_per_stripe but it is not true. For IMSM arrays created in OROM NUM_BLOCKS_DIRTY_STRIPE_REGION sectors are added up to this value. Because of this mdadm shows invalid size of arrays created in OROM and to fix this we need to use array size calculation based on num data stripes and blocks per stripe. Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: pass already existing map to imsm_num_data_membersMariusz Dabrowski2018-04-121-20/+21
| | | | | | | | | In almost every place where imsm_num_data_members is called there is already existing map so it can be used it to avoid mistake when specifying map for imsm_num_data_members. Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: add functions to get and set imsm dev sizeMariusz Dabrowski2018-04-121-20/+21
| | | | | Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* imsm: change reserved space to 4MBMariusz Dabrowski2018-04-121-2/+2
| | | | | | | | Due to compatibility to the newest OROM, imsm reserved space has to be expanded to 4MB. Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* tests/func.sh: Fix some total breakage in the test scriptsJes Sorensen2018-04-112-20/+4
| | | | | | | | | We will never mandate an obsolete file system such as ext[2-4] for running the test suite, nor should the test version of mdadm be installed on the system for the tests to be run. Signed-off-by: Jes Sorensen <jsorensen@fb.com> Fixes: 20d10b4be873ba ("mdadm/test: Refactor and revamp 'test' script")
* 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>