summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* show 2TB volumes/disks support in --detail-platformCzarnowska, Anna2012-04-022-0/+5
| | | | | Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* simplify calculating array_blocksCzarnowska, Anna2012-04-022-4/+3
| | | | | | | | no point calling info_to_blocks_per_member when it just returns size*2 for level==1 calc_array_size can be used for all levels Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* clear hi bits if not used after loading metadata from diskCzarnowska, Anna2012-04-021-1/+27
| | | | | | | | | | | | | | | | Functions retrieving sizes from metadata do not need to check 2TB attribute only when we can guarantee the hi bits are always clear when the MPB_ATTR_2TB_DISK attribute is not set. Therefore the following fields are cleared on metadata load when not in use according to attribute: struct imsm_disk.total_blocks_hi struct imsm_map.pba_of_lba0_hi struct imsm_map.blocks_per_member_hi struct imsm_map.num_data_stripes_hi Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: avoid overflows for disks over 1TBCzarnowska, Anna2012-04-021-67/+131
| | | | | | | | | | | | | | | | | | Calculating array_blocks using info->size causes error on activation of volume using disks over 1 TB. unsigned long long size parameter is used instead. total_blocks, pba_of_lba0, blocks_per_member and num_data_stripes overflow when using disks over 2TB. Part of fillers in metadata is used to contain hi bits of the numbers that are likely to go over 32 bit limit. Functions are added to get and set such fields as the hi bits are not adjacent with low bits in the structures. Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* sysfs: fixed sysfs_freeze_array array to work properly with Manage_subdevs.NeilBrown2012-03-281-3/+4
| | | | | | | | | | | | | If the array is already frozen when Manage_subdevs is called we don't want it to unfreeze the array. This is because Grow calls Manage_subdevs to add devices to an array being reshaped, and the array must stay frozen over this call. So if sysfs_freeze_array find the array to be frozen it returns '0', meaning that it didn't and cannot freeze it. Then the caller will not try to unfreeze, which is good. Signed-off-by: NeilBrown <neilb@suse.de>
* Fix the new ROUND_UP macro.NeilBrown2012-03-221-1/+1
| | | | | | It was missing a "- 1". Signed-off-by: NeilBrown <neilb@suse.de>
* Fix tests/05r1-re-add-nosupperNeilBrown2012-03-221-2/+2
| | | | | | | This shouldn't have been changed when we size of RAID1 arrays was changed, as this uses 'build', not 'create' Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: print useful error when converting RAID1->RAID5 will fail.NeilBrown2012-03-221-0/+4
| | | | | | | | | RAID1 can only be converted to RAID0 or RAID5 if the size is a multiple of 4K as we cannot have chunks smaller than 4K. If this might happen, report a useful error message. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: round off size for RAID1 arrays.NeilBrown2012-03-2218-40/+53
| | | | | | | | | | | RAID1 arrays don't have a chunk size, but if you ever convert one to RAID5 you will need at least a small one >= 4K. So round of size to a multiple of 64K. This only affect Create, not "--grow --size=max". The latter is too hard and with smaller returns. Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: freeze recovery while adding multiple devices.NeilBrown2012-03-221-0/+13
| | | | | | | | If the kernel supports it, freeze recovery over multiple adds, so that they can all be added to the array at the same time and be recovered in parallel. Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: replace 'return 1' with 'goto abort'.NeilBrown2012-03-221-36/+39
| | | | | | This will allow exit processing in next patch Signed-off-by: NeilBrown <neilb@suse.de>
* Incremental: fix adding devices with --incrementalNeilBrown2012-03-221-4/+4
| | | | | | | | | | | | We should use 'info' here, not 'info2'. info2 refers to some other device (There may not even be one).l info is *this* disk. This is particularly important for getting info.disk.state correct, which the kernel depends on to get 're-add' functionality correct. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove possible crash during RAID6 -> RAID5 reshape.NeilBrown2012-03-221-6/+22
| | | | | | | | | | | | If a RAID6 array is in a state which doesn't have a RAID5 equivalent, the code currently dereferences a NULL. If it does have an equivalent - use that. If it doesn't but it already in the RAID5-compatible layout with the Q block last, handle that case, else require the new layout to be explicitly requested. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: improve verbose logging when including old devices.NeilBrown2012-03-221-2/+4
| | | | | | | | | | | | | | | | | | | | | Reporting: mdadm: added /dev/loop1 to /dev/md0 as 1 mdadm: added /dev/loop2 to /dev/md0 as 2 mdadm: added /dev/loop0 to /dev/md0 as 0 mdadm: /dev/md0 has been started with 2 drives (out of 3). is confusing - why only 2? Code now reports: mdadm: added /dev/loop1 to /dev/md0 as 1 mdadm: added /dev/loop2 to /dev/md0 as 2 (possibly out of date) mdadm: added /dev/loop0 to /dev/md0 as 0 mdadm: /dev/md0 has been started with 2 drives (out of 3). which is somewhat clearer. Signed-off-by: NeilBrown <neilb@suse.de>
* Examine: fix array size calculation for RAID10.NeilBrown2012-03-222-11/+17
| | | | | | | | RAID10 arrays with an odd number of devices had the arraysize reported wrongly by --examine due to a rounding error. Reported-by: Chris Francy <zoredache@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* __write_init_super_ddf(): Use posix_memalign() instead of static aligned bufferJes Sorensen2012-03-211-8/+11
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* super-intel.c: Use ROUND_UP() instead of manually coding itJes Sorensen2012-03-211-1/+1
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* super1.c: use ROUND_UP/ROUND_UP_PTRJes Sorensen2012-03-211-4/+3
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Generalize ROUND_UP() macro and introduce matching ROUND_UP_PTR()Jes Sorensen2012-03-211-4/+4
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* match_metadata_desc0(): Use calloc instead of malloc+memsetJes Sorensen2012-03-211-3/+3
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Use struct align_fd to cache fd's block size for aligned reads/writesJes Sorensen2012-03-211-21/+54
| | | | | | | | This uses a struct to cache the block size for aligned reads/writes, to avoid repeated ioctl(BLKSSZGET) calls. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Use 4K buffer alignment for superblock allocationsJes Sorensen2012-03-211-3/+3
| | | | | | | | To better accommodate 4K sector drives, use 4K buffer alignment for superblock buffers. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* match_metadata_desc1(): Use calloc instead of malloc+memsetJes Sorensen2012-03-211-3/+3
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* init_super1() memset full buffer allocated for superblockJes Sorensen2012-03-211-2/+1
| | | | | | | | | Avoid possibly using stale data in bitmap and misc area of superblock. In addition, remove superfluous memsets already covered by memset of full superblock. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Define and use SUPER1_SIZE for allocationsJes Sorensen2012-03-211-10/+6
| | | | | | | | Use a #define rather than calculate the size of the superblock buffer on every allocation. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* super1.c don't keep recalculating bitmap pointerJes Sorensen2012-03-211-3/+2
| | | | | | | | We just calculated the pointer to the bitmap, so use it instead of recalculating. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Create: reduce the verbosity of 'default_layout'.NeilBrown2012-03-081-1/+1
| | | | | | | We only need this the first couple of times. Reporting it for every device is not necessary. Signed-off-by: NeilBrown <neilb@suse.de>
* super1: support superblocks up to 4K.NeilBrown2012-03-081-27/+33
| | | | | | | | | | | | The current 1024 byte limit on 1.x superblocks limits us to 384 devices. Sometimes people want more. The kernel is already prepared for superblocks up to 4K, so enable that in mdadm allowing up to (4096-256)/2 == 1920 devices (active plus spare). Signed-off-by: NeilBrown <neilb@suse.de>
* Reset bad flag on map updateCzarnowska, Anna2012-03-081-0/+1
| | | | | | | | | | | Map file may miss an entry if bad flag is not cleared on update. This happens for example when an old entry exists in map that has no mdstat counterpart and we create a new array with the same devnum. Newly created array will not appear in map if update doesnt clear bad flag. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Manage: allow --re-add to failed array.NeilBrown2012-03-071-3/+13
| | | | | | | | | | | If both "legs" of a RAID1 (or equivalent in RAID10) fail, then one of the becomes available again it maybe appropriate to re-add the failed device(s). So remove the restriction that an array must has 'enough' devices before being re-added, and if there is no-where to read a superblock from for matching, then assume the kernel will do necessary checks. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: support assembling of a RAID0 being reshaped.NeilBrown2012-03-071-1/+3
| | | | | | | | | This is a bit of a hack and the code need to be made more general. But this adds the special case of a RAID0 being reshaped which looks like a RAID4 but doesn't need as many devices. Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: don't use O_EXCL until we have checked device content.NeilBrown2012-03-071-1/+24
| | | | | | | | | | | | | | | | | | If we open with O_EXCL before checking that the device is one that we really want, then that could cause some other process to think the device is busy when it isn't really. This particularly affects running "mdadm -A devname" in parallel for different arrays. One might be looking at a device that it won't end up using while another trys and fails to look at a device that it needs. So delay the O_EXCL until after all identity checks. Multiple "mdadm -As" will still have races, but that is fundamentally racy anyway. Signed-off-by: NeilBrown <neilb@suse.de>
* Use MDMON_DIR for pid files created in Monitor.cJes Sorensen2012-02-231-3/+5
| | | | | | | | Other parts of mdadm/mdmon place .pid/.sock files in MDMON_DIR. This makes Monitor.c consistent with the rest. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Print error message if failing to write super for 1.x metadataJes Sorensen2012-02-232-12/+16
| | | | | | | | | | | | In addition remove attempt to print an error message if write_init_super() fails, as this is handled in the various write_init_super() functions. This avoids a segfault on error. Reported by Jim Meyering in https://bugzilla.redhat.com/show_bug.cgi?id=795461 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* avoid double-free upon "old buggy kernel" sysfs_read failureJim Meyering2012-02-221-1/+0
| | | | | | | | | * Incremental.c (Incremental): On sysfs_read failure, don't call sysfs_free(sra) just before "goto out_unlock", since that very same "sra" is freed the same way by the clean-up code below. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Changes in '0' case for reshape position verificationAdam Kwolek2012-02-201-2/+10
| | | | | | | | | | | | | | | Reading sysfs entry that is '0' long should cause an error. Reshape position cannot be empty. Absence of reshape position should be ignored. It is possible that we are about raid0 reshape continuation and it is before takeover. This means that according metadata (changed by mdmon) it should be reshaped but md knows nothing about it at this moment. Reshape continuation in reshape_array() will change it to raid4 and reshape position appears in sysfs. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Use posix_memalign() for memory used to write bitmapsJes Sorensen2012-02-162-5/+10
| | | | | | | | | | | | This makes super[01].c properly align buffers used for the bitmap using posix_memalign() to make sure the writes don't fail in case the bitmap is opened using O_DIRECT. This is based on https://bugzilla.redhat.com/show_bug.cgi?id=789898 and an initial patch by Alexander Murashkin. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* config: conf_match should ignore devname when not set.NeilBrown2012-02-161-1/+1
| | | | | | | | mapfile:RebuildMap calls conf_match with no devname, so we must be careful not to use it. Reported-by: Arkadiusz Miƛkiewicz <arekm@maven.pl> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Do not try to (continue) reshape using inactive arrayAdam Kwolek2012-02-091-0/+14
| | | | | | | | When one of arrays is inactive, do not try to continue reshape on this array. Just skip it. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: restart reshape when reshape process is stopped just between 2 reshapesAdam Kwolek2012-02-091-0/+12
| | | | | | | | | | | | When reshape is restarted from '0', very begin of array it is possible that for external metadata reshape and array configuration doesn't happen. Check if md has the same opinion, and reshape is restarted from 0. If so, this is regular reshape start after reshape switch in metadata to next array only. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: Clear migration record when migration switches to next volume.Adam Kwolek2012-02-091-3/+16
| | | | | | | | | | | | | When OLCE is in progress, checkpoint steps are getting bigger due to added space during process. When mdadm fails after saving "max" to sync_max, mdmon will monitor process and switch reshape to next array. At this moment we have got information inconsistency between metadata and migration record. To avoid this, clear migration record by mdmon /exception from the rule that migration record is maintained by mdadm/ when reshape switches to next array. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: use md position to reshape restartAdam Kwolek2012-02-091-0/+12
| | | | | | | | | | | When reshape is broken it can occur that metadata is not saved properly. This can cause that reshape process is farther in md than metadata states. On restart save checkpoint to store current position /probably farther/ that can be read from md. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: use md position to reshape restartAdam Kwolek2012-02-091-26/+60
| | | | | | | | | | | When reshape is broken, it can occur that metadata is not saved properly. This can cause that reshape process is farther in md than metadata states. On reshape restart use md position as start position, if it is farther than position specified in metadata. Opposite situation treat as error. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: Chunk size migration problemAdam Kwolek2012-02-091-1/+2
| | | | | | | | | When chunk size migration occurs (e.g. 128k->4k) first checkpoint cannot be set in md due to too small step. Correct migration record initialization to allow whole copy area usage and increase migration checkpoint step. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Flush mdmon before next reshape step during container operationAdam Kwolek2012-02-093-2/+21
| | | | | | | | | | | Using takeover operation for grow purposes, mdadm has to be sure that mdmon processes all updates, and if necessary it will be closed at takeover to raid0 operation. If mdmon is late, next array in container is processed and due to race condition mdmon closes itself instead to monitor next reshape operation. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Fix: Sometimes mdmon throws core dump during reshapeAdam Kwolek2012-02-091-0/+6
| | | | | | | | | | | | | | | | | | | | Problem was found during reshaping 2 volumes /raid0 and raid5/ in container. Sometimes mdmon throws core dump due to NULL pointer exception. Problem occurs in scenario: - managemon: is about spare activation (degraded raid4 volume == raid0 under takeover) - managemon: detect level change and signals monitor (manage_member() calls replace_array()) - monitor: detects transition raid4/5->raid0 and sets a->container to NULL to indicate array deactivation - managemon : continues his work and tries to activate spare (a->check_degraded is set). NULL pointer is passed to metadata handler activate_spare() Core dump is generated. To resolve this situation managemon (after monitor kick) checks again a->container pointer to learn if current array is not to be deactivated. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: imsm_get_allowed_degradation() doesn't count degradation for raid1Adam Kwolek2012-02-091-0/+1
| | | | | | | Missing case raid1 added to function. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: Array is not run when expansion disks are addedAdam Kwolek2012-02-091-1/+1
| | | | | | | | When added disk is disk added by expansion and this is last disk added to array, assemble_container_content() will not even try to run such array. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* imsm: FIX: No new missing disks are allowed during general migrationAdam Kwolek2012-02-091-1/+11
| | | | | | | | | | | When during incremental assembly general migration is in progress, starting degraded array causes that no more disks (even present) can be added later as array is already started. Request all previously present disks during general migration for assembly. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* FIX: NULL pointer to strdup() can be passedAdam Kwolek2012-02-091-2/+3
| | | | | | | | | | | | When result from strchr() is NULL and it is assigned to subarray, NULL pointer can be passed to strdup() function and coredump file is generated. Subarray is checked for NULL pointer, so it is assumed that it can be NULL at this moment. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>