This repository has been archived by the owner on Oct 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
Mdadm 3.2.x #19
Open
dhartleben
wants to merge
37
commits into
master
Choose a base branch
from
mdadm-3.2.x
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Mdadm 3.2.x #19
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When an array is assembled incrementally, systemd might see it before it is ready, try to mount it, fail, and give up. Result is that array doesn't get mounted. If we ask udev to tell systemd that it isn't ready yet in this case, systemd waits until it is ready, and all are happy. Signed-off-by: NeilBrown <neilb@suse.de>
In function write_init_super1(): If "rv = store_super1(st, di->fd)" return error and the di is the last. Then the di = NULL && rv > 0, so exec: if (rv) fprintf(stderr, Name ": Failed to write metadata to%s\n", di->devname); will be segmentation fault. Signed-off-by: majianpeng <majianpeng@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
We do not check the return value of sysfs_get_ll() now. It is wrong. If reading of the sysfs "degraded" key does not succeed, the "new_degraded" variable will not be initiated and accidentally it can have the value of "degraded" variable. In that case the change of degradation will not be checked. It happens if mdadm is compiled with gcc's "-fstack-protector" option when one tries to stop a volume under reshape (e.g. OLCE). Reshape seems to be finished then (metadata is in normal/clean state) but it is not finished, it is broken and data are corrupted. Now we always check the return value of sysfs_get_ll(). Even if reading of the sysfs "degraded" key does not succeed (rv == -1) the change of degradation will be checked. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
->percent sometimes stores negative values recording states like 'pending' or 'delayed'. The value '-2' means both 'delayed' and in Monitor, 'unknown'. Also, '-1' has a meaning but not #define. So change the #defines to be prefixed with "RESYNC_", instead of "PROCESS_", add new "_NONE" and "_UNKNOWN", and use correct value in each location. Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: NeilBrown <neilb@suse.de>
The tests here were specific to 0.90 metadata and didn't work properly for 1.x metadata, where a device's "number" doesn't change. By checking if this is a new array we can avoid some corner cases. Then we test mostly based on state and not based on 'number' at all. Signed-off-by: NeilBrown <neilb@suse.de>
-t aka --takeover should not be setting container_name. It sets it to NULL which causes failure when you try mdmon --all --takeover Signed-off-by: NeilBrown <neilb@suse.de>
We should free fdlist when finished with it. Signed-off-by: NeilBrown <neilb@suse.de>
In the "add" uevent, ATTR{md/array_state} does not exist, so the next rule does not kick in. When an array is assembled incrementally, systemd might see it before it is ready, try to mount it, fail, and give up. Result is that array doesn't get mounted. If we ask udev to tell systemd that it isn't ready yet in this case, systemd waits until it is ready, and all are happy. Signed-off-by: NeilBrown <neilb@suse.de>
Inclusion of the 'ansidecl.h' header requires the 'binutils-devel' package to be installed but is not needed. Signed-off-by: Maciej Patelczyk <maciej.patelczyk@intel.com> Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
'external' arrays don't support --re-add yet so old metadata is no value, and 'ddf' gets confusing in mdmon if old metadata is found. So for now, zero out any old metadata found before adding a spare to an externally-managed array. Reported-by: Albert Pauw <albert.pauw@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
If a DDF has two arrays sharing devices and one device fails, then as soon as the spare is used to recover one of the arrays it isn't spare any more and so is not chosen for the other array. Work around this for now by allowing a non-spare to be used if it has enough space. Reported-by: Albert Pauw <albert.pauw@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
When adding a spare to a DDF there is some confusion about the 'level' of the container. It is reported by kernel as unknown -1000000. I don't know why this broke but until I figure out why and fix it, this hack gets us going again. Signed-off-by: NeilBrown <neilb@suse.de>
'-a' was not being recognised as an abbreviation for '--all'. Signed-off-by: NeilBrown <neilb@suse.de>
As --offroot causes ARGV[0] to be changed, we need to be more lenient when checking that the mdmon we are about to kill really is mdmon. i.e. allow name to be "@dmon" instead. Signed-off-by: NeilBrown <neilb@suse.de>
high-number names like "/dev/md126" shouldn't be in /etc/mdadm.conf, but if they are they should be ignored when choosing an unused number. Signed-off-by: NeilBrown <neilb@suse.de>
When recreating the mapfile entry for a container we need to use ->getinfo_super, not ->container_content, just like we do in Detail(). Signed-off-by: NeilBrown <neilb@suse.de>
If disk has been removed, 'st' and 'info' can be NULL. It causes segfault. 'st' and 'info' should be checked against being NULL before being used. Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
The 'enough' function is written to work with 'near' arrays only in that is implicitly assumes that the offset from one 'group' of devices to the next is the same as the number of copies. In reality it is the number of 'near' copies. So change it to make this number explicit. Reported-by: Jakub Husák <jakub@gooseman.cz> Signed-off-by: NeilBrown <neilb@suse.de>
This ensures that mdmon won't be killed by systemd. Signed-off-by: NeilBrown <neilb@suse.de>
Don't print it just when --verbose is set, and explain how to over-ride it. Signed-off-by: NeilBrown <neilb@suse.de>
sha1.h claims GPL3+, while sha1.c claims GPL2+. This is inconsistent and technically prevents the whole from being distributed under GPL2. So replace sha1.h with a version from the GCC sources from before Tue Apr 20 08:36:39 2010 when the copyright notice was updated. Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
1/ When printing the "name=" entry for --brief output, enclose name in quotes if it contains spaces etc. Quotes are already supported for reading mdadm.conf 2/ When a name is used as a device name, translate spaces and tabs to '_', as well as the current translation of '/' to '-'. Signed-off-by: NeilBrown <neilb@suse.de>
We must avoid setting IMSM_T_STATE_UNINITIALIZED if the array was declared to be clean due to --assume-clean. Signed-off-by: NeilBrown <neilb@suse.de>
As it was the code would crash due to "mdstat" being NULL. Code is now more sane, but hasn't been tested on an array that needs to grow. Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: NeilBrown <neilb@suse.de>
open_container should open a container which contains the device, but sometimes it would open another volume which contains the device. Be more careful in 'holder' selection. Signed-off-by: NeilBrown <neilb@suse.de>
When --uuid is specified in the command line, even for v0.90 superblock we override last portion of uuid with data from --homehost, which is wrong (and disagrees with the manpage). Only use homehost in super0 if no uuid is specified. Signed-off-By: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: NeilBrown <neilb@suse.de>
And here's another trivial bugfix, now for spelling mistakes in various places, authred by Sergey Kirpichev (Cc'ed) and carried in debian mdadm package. Signed-off-by: NeilBrown <neilb@suse.de>
If a device is faulty, then that is all there is too it. Even if it isn't 'removed' yet, it shouldn't be reported as 'spare' or 'rebuilding'. Signed-off-by: NeilBrown <neilb@suse.de>
As 'info->size' is signed, it cannot even hold values above 2TB. But it isn't used much. sb->size is the important value and it is unsigned. So use that to check for overflow of size. Reported-by: Eugene San <eugenesan@gmail.com>
Creating a new MD device with the name 'd-0' results in some unexpected behavior, since mdadm sees that '-0' is a non-negative integer and therefore makes a "partitionable" device (/dev/md_d0). This is not the expected behavior, since the documentation mentions 'dN' several places, and a reboot brings it up as /dev/md/d-0. Make this consistent by ensuring that the character immediately following 'd' is a digit during creation. Signed-off-by: NeilBrown <neilb@suse.de>
If we are asked to monitor a RAID0 or Linear - which cannot be monitored - we complain with "Device Disappeared .... Wrong-Level". However if the RAID0 or Linear is being requested because it is in mdadm.conf then the message is inappropriate and confusing. So track which arrays are added from the config file, and suppress that message in that case. Reported-by: "Johnson Yan" <johnson_yan@usish.com> Signed-off-by: NeilBrown <neilb@suse.de>
Now that we recognise partition tables as a sort of metadata we need to be careful in --query not to say that a device with a partition table looks like a device in an array. Testing ->compare_super for NULL is an easy way to do that. Signed-off-by: NeilBrown <neilb@suse.de>
Currently if a member of a 1.x array is queries, mdadm will fail to find the name of the active md array if there is one. Change the lookup to use the mapfile - now it works. Signed-off-by: NeilBrown <neilb@suse.de>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.