summaryrefslogtreecommitdiff
path: root/super-ddf.c
Commit message (Collapse)AuthorAge
* DDF: cast print arguments in super-ddf.cGuy Menanteau2014-08-05
| | | | | | | | | | | | | | | | | | | | mdadm fails to build on ppc64 and ppc64le architectures. === super-ddf.c: In function '_set_config_size': super-ddf.c:2849:4: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' [-Werror=format=] pr_err("%s: %x:%x: workspace size 0x%llx too big, ignoring\n", ^ super-ddf.c:2855:2: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type '__u64' [-Werror=format=] dprintf("%s: %x:%x config_size %llx, DDF structure is %llx blocks\n", ^ cc1: all warnings being treated as errors <builtin>: recipe for target 'super-ddf.o' failed === Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1125883 Signed-off-by: <menantea@linux.vnet.ibm.com> Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com> Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: validate metadata_update size before using it.NeilBrown2014-07-10
| | | | | | | | | | | | process_update already checks update->len, for all but the 'magic', prepare_update doesn't at all. So add tests to prepare_update that we don't exceed the buffer. This will consequently protect process_update from looking for a 'magic' which isn't there. Reported-by: Vincent Berg <vberg@ioactive.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdmon: allow prepare_update to report failure.NeilBrown2014-07-10
| | | | | | | | | If 'prepare_update' fails for some reason there is little point continuing on to 'process_update'. For now only malloc failures are caught, but other failures will be considered in future. Signed-off-by: NeilBrown <neilb@suse.de>
* Make sure "make everything" builds again.NeilBrown2014-06-05
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: remove "BVD xx is missing".NeilBrown2014-05-22
| | | | | | | This can happen in normal cases during incremental assembly so printing an error message is confusing. Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm: Do not reimplment offsetofCristian Rodríguez2014-05-22
| | | | | | Proper implementations have offsetof in stddef.h Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: remove some pointless code in validate_geometryNeilBrown2014-05-21
| | | | | | | | I'm not sure what this was supposed to do, but it isn't needed as creating on a container and on individual devices (in a container) work fine already. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: remove a FIXME comment that doesn't seem to mean anything.NeilBrown2014-05-21
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: remove 'FIXME' comment that doesn't need fixing.NeilBrown2014-05-21
| | | | | | | It appears this is correct, though for consistency with elsewhere we check that pdnum is not negative. Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: ensure dl->devname is freed when processing a 'delete device' update.NeilBrown2014-05-21
| | | | | | | | | | 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-21
| | | | | | | 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-21
| | | | | | | 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-21
| | | | | | | | 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-21
| | | | | | 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-21
| | | | | | | | | 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-21
| | | | | | | | | | | 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-21
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: DDF_Missing devices should not be reported as 'working' by ↵NeilBrown2014-05-21
| | | | | | getinfo_super_ddf Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: remove old and wrong comment about settinig raid_disk.NeilBrown2014-05-21
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: provide simple detail_super() implementation.NeilBrown2014-05-21
| | | | | | 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-21
| | | | | | | | | 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-21
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* DDF: use array_size from metadata.NeilBrown2014-05-21
| | | | | | | 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-21
| | | | | | 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-21
| | | | | | | | | 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-21
| | | | | | | | | - 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-21
| | | | | | | | | | 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-21
| | | | | | | | 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-21
| | | | | | | | 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-21
| | | | | | | | | | | | 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-21
| | | | | | | 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-02
| | | | | | | | | | | | | | | | | | 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-02
| | | | | | | | | | 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-02
| | | | | | | | | | | 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-01
| | | | | | | 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-01
| | | | | | ..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-26
| | | | | | | 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-26
| | | | | | | | | 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-20
| | | | | | | | | | | | | | | | | | | | 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-20
| | | | | | | | 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-16
| | | | | | | | | 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-16
| | | | | | | | | | | | | | | | 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-12
| | | | | | | | | | 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-12
| | | | | | | | 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-12
| | | | | | | | 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-10
| | | | | | 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-10
| | | | | | | | | | | | | | | | | | | | | 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-28
| | | | | | | | | | | 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-28
| | | | | | | | | | | | | 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-28
| | | | | | | | | 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>