summaryrefslogtreecommitdiffstats
path: root/super-ddf.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* DDF: ensure dl->devname is freed when processing a 'delete device' update.NeilBrown2014-05-211-3/+3
| | | | | | | | | | As this code runs in 'monitor' it cannot just free memory, it must add it to a list for 'manager' to free. Fortunate update->space_list exists for just this purpose. dl->devname might be small, so put it in update->space and put dl in update->space_list. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: remove old comment about looking for spares.NeilBrown2014-05-211-1/+0
| | | | | | | As handle_missing() sets ->check_degraded, nothing else needs to be done here. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: remove an old incorrect FIXME comment.NeilBrown2014-05-211-1/+3
| | | | | | | We mustn't close fds in write_init_super if ->update_tail was set. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: add data-offset information to --examine output.NeilBrown2014-05-211-0/+1
| | | | | | | | Raid Devices[1] : 5 (4@20000K 3@20000K 2@0K 1@0K 0@0K) The data offsets are 200000K and 0K. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: split up ddf_process_updateNeilBrown2014-05-211-264/+297
| | | | | | Function was way too big, make several smaller functions. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: add support of --data-offset when creating array.NeilBrown2014-05-211-12/+10
| | | | | | | | | Infrastructure is there, so use it. This requires making sure that ->data_offset is correctly set, even for containers. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: factor out common code for search through extents.NeilBrown2014-05-211-90/+62
| | | | | | | | | | | Each place the uses "get_extents" has slightly different search code to look through the result. Factor this out into a single find_space() function. This is will make it easier to add --data-offset support. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: allow for unused slots when creating map list for getinfo_super_ddf.NeilBrown2014-05-211-4/+8
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: DDF_Missing devices should not be reported as 'working' by ↵NeilBrown2014-05-211-1/+2
| | | | | | getinfo_super_ddf Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: remove old and wrong comment about settinig raid_disk.NeilBrown2014-05-211-1/+1
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: provide simple detail_super() implementation.NeilBrown2014-05-211-6/+8
| | | | | | Just print the GUID, Seq and number of VDs in the container. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: support more RAID10 levels.NeilBrown2014-05-211-3/+31
| | | | | | | | | The DDF "RAID1E" level is similar to md "raid10". So use raid10 to support RAID1E, and create RAID1E for raid10 configs not already supported. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: explain why spare_refs are ignored.NeilBrown2014-05-211-1/+4
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: use array_size from metadata.NeilBrown2014-05-211-1/+1
| | | | | | | If some other controller sets a number smaller than a calculation would give us, we really should honour it. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: set utime for container from timestamp is superblock.NeilBrown2014-05-211-2/+2
| | | | | | Also be more consistent about setting events from seq in superblock. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: don't assume the anchor is fully up-to-date.NeilBrown2014-05-211-1/+1
| | | | | | | | | We currently copy the anchor to both primary and secondary blocks. This assumes that the anchor is uptodate, but it might not be. We should trust the 'active' block and copy from there. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: update timestamp/seqnum for virtual disks when config changes.NeilBrown2014-05-211-20/+26
| | | | | | | | | - we weren't updating this timestamp at all - the 'vd_config' seqnum was updated on every write of the metadata, which is excessive. Just update it when there is a change. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: update timestamp in DDF header.NeilBrown2014-05-211-0/+1
| | | | | | | | | | Doco says: Header update timestamp. MUST be set when the DDF header is updated. So I guess we should. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: avoid ref outside array in getinfo_super_ddf_bvdNeilBrown2014-05-211-4/+4
| | | | | | | | As we are range-checking 'cd', there is a chance that it is not in-range. In that case we should include all array indexes with 'cd' inside the range-tested branch. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: examine_pds to also list devices that aren't in the metadata.NeilBrown2014-05-211-0/+20
| | | | | | | | The phys disks table should list all disks, but if the metadata is corrupt, it might not even list the disk it was read from. So check for and report any known disks that aren't listed. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: fix usage of ->used_pdesNeilBrown2014-05-211-7/+14
| | | | | | | | | | | | The "used_pdes" value counts the number of physdisk entries that are in used. It may not be the last one in use as there may be unused slots in the middle. So when were are iterating over phys disks, we need to use max_pdes and skip unused entries. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: more guards against pdnum being negative.NeilBrown2014-05-211-3/+3
| | | | | | | With consistent metdata, pdnum should never be negative, but it is better to be safe than sorry. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: Don't fail compare_super_ddf due to re-configure changes.NeilBrown2014-04-021-33/+11
| | | | | | | | | | | | | | | | | | It is possible that one device has seem some reconfig but the other hasn't. In that case they are still the "same" DDF, even though one might be older. Such age will be detected by 'seq' differences. If A is new and B is old, then it is import that mdadm -I B mdadm -I A doesn't get confused because A has the same uuid as B, but compare_super fails. So: if the seq numbers are different, then just accept as two different superblocks. If they are the same, then look to copy data from new to old. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: fix possible mdmon crash when updating metadata.NeilBrown2014-04-021-1/+1
| | | | | | | | | | Testing 'c' and then using 'vdc' assumes that the two are in sync, but sometimes they aren't. Testing 'vdc' is safer. This avoids a crash in some cases when failing/removing/added devices to a DDF. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: guard against ->pdnum being negative.NeilBrown2014-04-021-6/+16
| | | | | | | | | | | It is conceivable that ->pdnum could be -1, though only if the metadata is corrupt. We should be careful not to use it if it is. Also remove an assignment for pdnum to ->container_member. This is never used and cannot possibly mean anything. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: mark missing-on-assembly device properly.NeilBrown2014-04-011-3/+28
| | | | | | | As well as removing from the array we really should mark it is 'failed', and mark the array as degraded. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: Fix assorted typos and do some reformatting.NeilBrown2014-04-011-142/+148
| | | | | | ..because it is more fun when new patches are harder to apply to old version :-) Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: when first activating an array, record any missing devices.NeilBrown2014-03-261-0/+28
| | | | | | | We must remember they are missing so that if they re-appear we don't get confused. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: report seq counter as events.NeilBrown2014-03-261-7/+4
| | | | | | | | | Also don't treat two devices with different seq numbers as completely unrelated. This allows split-brain detection to work properly for ddf. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: fix detection of failed devices during assembly.NeilBrown2014-01-201-4/+14
| | | | | | | | | | | | | | | | | | | | When we call "getinfo_super", we report the working/failed status of the particular device, and also (via the 'map') the working/failed status of every other device that this metadata is aware of. It is important that the way we calculate "working or failed" is consistent. As it is, getinfo_super_ddf() will report a spare as "working", but every other device will see it as "failed", which leads to failure to assemble arrays with spares. For getinfo_super_ddf (i.e. for the container), a device is assumed "working" unless flagged as DDF_Failed. For getinfo_super_ddf_bvd (for a member array), a device is assumed "failed" unless DDF_Online is set, and DDF_Failed is not set. Reported-by: "David F." <df7729@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF - really ignore DDF metadata on partitions.NeilBrown2014-01-201-1/+1
| | | | | | | | See commit 357ac1067835d1cdd5f80acc28501db0ffc64957 which made a similar change for super-intel, and really should have fixed DDF at the same time. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: add_to_super_ddf: be careful with workspace_lbamwilck@arcor.de2013-10-161-1/+26
| | | | | | | | | Some vendor DDF structures interpret workspace_lba very differently then us. Make a sanity check on the value before using it for config_size. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: compare_super_ddf: fix sequence number checkmwilck@arcor.de2013-10-161-4/+4
| | | | | | | | | | | | | | | | The sequence number check in compare_super_ddf was broken, anchor sequence number is always -1. With this patch, mdadm will refuse to add a disk with non-matching sequence number. This fixes Francis Moreau's problem reported with subject "mdadm 3.3 fails to kick out non fresh disk". FIXME: More work is needed here. Currently mdadm won't even add the disk to the container, that's wrong. It should be added as a spare. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: brief_examine_subarrays_ddf: print array namemwilck@arcor.de2013-09-121-1/+5
| | | | | | | | | | Print an array name in brief output, like IMSM does. SUSE's YaST2 (libstorage) needs this in order to detect MD arrays during installation. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: factor out array name generationmwilck@arcor.de2013-09-121-12/+13
| | | | | | | | The same algorithm was used in getinfo_super_ddf_bvd and container_content_ddf. Put it in a common function. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: allow for possibility that there is no secondary copy of metadata.NeilBrown2013-09-121-2/+7
| | | | | | | | If there isn't, we currently write the second copy at some random location :-) Reported-and-tested-by: Francis Moreau <francis.moro@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Move ARRAY_SIZE macro to common include file.NeilBrown2013-09-101-2/+1
| | | | | | That was super-ddf can use it. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: handle fake RAIDs with changing subarray UUIDsmwilck@arcor.de2013-09-101-5/+50
| | | | | | | | | | | | | | | | | | | | | Some fake RAID BIOSes (in particular, LSI ones) change the VD GUID at every boot. These GUIDs are not suitable for identifying an array. Luckily the header GUID appears to remain constant. We construct a pseudo-UUID from the header GUID and those properties of the subarray that we expect to remain constant. This is only array name and index; all else might change e.g. during grow. Don't do this for all non-MD arrays, only for those known to use varying volume GUIDs. This patch obsoletes my previous patch "DDF: new algorithm for subarray UUID" Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: increase default value for safe_mode_delay to 4000msmwilck@arcor.de2013-08-281-2/+6
| | | | | | | | | | | That is the same value that IMSM uses. The current default of 200ms seems to have been copied from the native MD meta data. That value appears to be much too low for DDF, given that writing the DDF meta data means that easily several MB worth of data need to be written to disk. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: container_content_ddf: set safe_mode_delay > 0mwilck@arcor.de2013-08-281-0/+1
| | | | | | | | | | | | | Set safe_mode_delay to something >0, otherwise all container subarrays assembled will have safe_mode_delay=0. That will break the assumption that meta data becomes clean after running mdadm --wait-clean. Use the same value as in getinfo_super_ddf_bvd. It would be cleaner to call that directly from container_content_ddf, but I need to check possible side effects first. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: export_examine_super_ddf: print MD_DEVICESmwilck@arcor.de2013-08-281-0/+2
| | | | | | | | | Have mdadm -E --export print the number of RAID devices, like other meta data formats do. Anaconda (RHEL/CentOS installer) depends on it. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_activate_spare: fix gcc -O2 uninitialized warningNeilBrown2013-08-281-1/+1
| | | | | | | | | At this point 'di' and 'rv' both have the same value. gcc doesn't realise that and a human reader might not either. 'rv' makes more sense too, so use that. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ddf_open_new: check device status for new subarraymwilck@arcor.de2013-08-081-1/+28
| | | | | | | | | | | It is possible that mdadm creates a new subarray containing failed devices. This may happen if a device has failed, but the meta data containing that information hasn't been written out yet. This code tests for this situation, and handles it in the monitor. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: Write new conf entries with a single write.NeilBrown2013-08-071-41/+26
| | | | | | | | | | | | | The recent change to skip over invalid conf entries was bad because it could leave garbage on the disk. But we don't to write each entry separately as the writes a O_DIRECT and so synchronous so it takes way too long. So allocate a large buffer (probably the one used to read the config records) and fill that then write it all at once. Reported-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: get_extents: don't allocate space on failed disksmwilck@arcor.de2013-08-061-0/+4
| | | | | | | | We should skip known failed disks when allocating space for new arrays. This fixes the problem with 10ddf-fail-spare. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: fix removal of failed devices.NeilBrown2013-08-051-4/+11
| | | | | | | | | | | | | | | | | | | | | | Commit c7079c84 arrange for DDF to forget about any device that is failed and not still marked as part of any array. However such devices could still be part of the container and this removal and updating of 'pdnum' can result in multiple devices having the same pdnum. This in turn easily leads to confusion and corruption. So only discard pd entries for devices which are failed, not listed in any virtual device, and for which we don't have a handle on the device. pd entries will not get removed until a new device is added after the device has been removed from the container, either by "mdadm --remove" or by assembling without the failed devices. Reported-by: Albert Pauw <albert.pauw@gmail.com> Analysed-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: fix writing metadata updates.NeilBrown2013-08-051-1/+2
| | | | | | | | | | Recent commit 273989b93a3185c0e4d54f0d1bc404248a92d157 skipped writing some large blocks of 0xFF, but didn't seek over the space, so subsequent data was written wrongly. When we don't write, we need to seek. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: no need for GET_LAYOUT any moremwilck@arcor.de2013-08-051-7/+1
| | | | | | | With the previous patch, mdmon will provide the layout property for us. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: differentiate between new metadata and metadata updates.NeilBrown2013-08-011-10/+12
| | | | | | | When writing an update, we don't need to overwrite lots of empty fields. This makes updates somewhat faster. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: use some #defines instead of bare constants.NeilBrown2013-08-011-4/+4
| | | | Signed-off-by: NeilBrown <neilb@suse.de>