Commit Graph

97 Commits

Author SHA1 Message Date
NeilBrown 66ccd96ebc Detail: report subarrays of a container properly.
Due to the wrong variable being used, this part of --detail
wasn't working at all.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-09 18:22:27 +11:00
Anna Czarnowska 22e263f64a imsm: set imsm spare uuid to 0
uuid_match_any is replaced by uuid_zero for imsm spares.

Function fixup_container_spare_uuid not needed as it gives
unwanted uuid to spares.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-12-26 21:59:31 +11:00
Dan Williams 5f7e44b29f Initialize st->devnum and st->container_dev in super_by_fd
Precludes needing to deduce this information later, like in Detail.c and
soon in Grow.c.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-23 15:31:18 +11:00
NeilBrown a1f976a013 Use new container_content rather than passing subarray to load_super.
Now that we can ask container_content for a specific subarray,
we don't need to pass the subarray name to load_super, and have it
secretly modify the returned state.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 20:24:35 +11:00
NeilBrown 4725bc31fb super_by_fd: return subarray info explicitly.
Rather than hiding this in the 'st', return it explicitly.

In the one case we still need it, copy it into st where needed.
This will disappear in a future patch.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:25 +11:00
NeilBrown a5d85af748 get_info_super: report which other devices are thought to be working/failed.
To accurately detect when an array has been split and is now being
recombined, we need to track which other devices each thinks is
working.

We should never include a device in an array if it thinks that the
primary device has failed.

This patch just allows get_info_super to return a list of devices
and whether they are thought to be working or not.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:25 +11:00
NeilBrown f94c116f56 detail/wait: better handling of monitoring sync action.
Detail: report reshape and check as well as resync and recovery
Wait: if the resync is pending or delayed, wait for that too.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-11-22 19:35:25 +11:00
NeilBrown f21e18ca89 Compile with -Wextra by default
This produced lots of warning, some of which pointed to actual bugs.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-08-05 13:13:02 +10:00
NeilBrown 9aaada0530 Detail: clean up handing of the 'info' we load from superblock.
The loop for loading it was hard to follow, so restructure that
and avoid a theoretical use-before-set error.

Also there was a second 'info' structure which hid the first and was
pointless.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-08-05 12:10:57 +10:00
NeilBrown 3e4165619b Cast to long long before left-shifting too much.
When left-shifting we must be sure that the value being
shifted is large enough to not lose bits.
The 'chunkssize' in CreateBitmap is only 'long' so it
can overflow.  So cast to 'long long' first.

Also fix a similar issue in Detail even though it isn't currently
being compiled.

Signed-off-by: NeilBrown <neilb@suse.de>
Reported-by: Tomasz Chmielewski <mangoo@wpkg.org>
2010-07-22 15:35:54 +10:00
NeilBrown d998adc316 Detail: Report state of FAILED when an array has too few devices to work.
We already have a call to 'enough' in Detail which is the check for
"do we have enough devices".  We just need to calculate the required
data a bit earlier, then use the same 'enough' call to possibly
print FAILED.

This is motivated by Debian bug 495755.
The other request in that bug is not practical.  

    It would be very nice if output of `mdadm' is more clear in case of a
    broken array.
    
    Currently the only hint you get from `mdadm' that your array is broken
    is this:
    
    # mdadm -A /dev/md0 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
    mdadm: /dev/md0 assembled from 1 drive and 3 spares - not enough to start the
    array.
    
    It could say something like `Your array is broken, you can't use it anymore'

It is not valid to report that array as 'broken' if the user hasn't
listed all the devices, which could be the case here.


Resolves-Debian-Bug: 495755
Signed-off-by: NeilBrown <neilb@suse.de>
2010-01-29 15:46:23 +11:00
Doug Ledford 6e48d593c1 Don't use %02d as a metadata format specifier for metadata numbers.
It confuses us when we read the output back later

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-01-19 10:45:28 +13:00
NeilBrown dab54dcb04 Detail: report new-layout for RAID6 arrays
We were only reporting it for RAID5 and RAID10.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-29 10:02:24 +11:00
NeilBrown 4a997737a1 Merge branch 'master' into devel-3.1 2009-10-22 11:13:13 +11:00
NeilBrown 0eb26465c0 Free some malloced memory that wasn't being freed.
As mdadm is normally a short-lived program it isn't always necessary
to free memory that was allocated, as the 'exit()' call will
automatically free everything.  But it is more obviously correct if
the 'free' is there.
So this patch add a few calls to 'free'

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-22 11:00:56 +11:00
NeilBrown 5d504f4278 Merge git://github.com/djbw/mdadm 2009-10-19 12:52:58 +11:00
Dan Williams aae5a11207 Detail: export MD_UUID from mapfile
The load_super() from an mdadm --detail call may race against an mdmon
update.  When this happens the load_super sees an inconsistent metadata
block and returns an error.  The fallback path to use the map file
contents lacks uuid reporting, so provide __fname_from_uuid for
generically printing a uuid.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-10-13 17:41:57 -07:00
NeilBrown ca4f89a3b7 Merge branch 'master' into devel-3.1
Conflicts:
	mdadm.8
2009-10-01 16:58:40 +10:00
NeilBrown 0e90271e53 Add missing space in "--detail --brief" output.
We need a space between the device name and the word "level"..

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-01 12:38:31 +10:00
Dan Williams 436305c690 Detail: fix for an imsm container with a spare
Spares for imsm arrays do not have any info about the container in their
metadata records.  If Detail() inadvertantly picks such a device for
->get_array_info() it will end up with less than useful info for the
container.  So, continue to read from the disks until a non-spare device
is found.

This bug was found by timeouts waiting for udev to create the
user-friendly container name.  To detect future UUID reporting problems
and a debug print to the timeout case in wait_for().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-09-15 11:34:20 -07:00
NeilBrown fe77a154b1 Examine/Detail: report raid6 layout
Somehow this was missing before...

Signed-off-by: NeilBrown <neilb@suse.de>
2009-07-14 15:12:29 +10:00
NeilBrown e736b62389 Update copyright dates and remove references to @cse.unsw.edu.au
Also removed 'paper' addresses.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-06-02 14:35:45 +10:00
NeilBrown 061f2c6abd Make --brief even briefer.
Because ---examine --brief, or --detail --brief are
often used to create mdadm.conf, and because people don't want to
have to update their mdadm.conf unnecessarily, we don't want to
include information that might change.
And now that level changing is supported, that is almost everything
but UUID.

So move some more fields into the "Only print with --verbose" class.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-05-11 15:18:20 +10:00
NeilBrown 6c40598f59 Merge branch 'master' into devel-3.0 2009-02-02 11:09:09 +11:00
NeilBrown a123619211 Fix the used device size in mdadm -D output.
As get_component_size() returns the number of used sectors of a device
we need halve before pringing as K, and shift the value by 9, not 10,
before passing to human_size.

Thanks to Andre Noll <maan@systemlinux.org> for identifying problem
(and a slightly different version of this patch)

Signed-off-by: NeilBrown <neilb@suse.de>
2009-02-02 10:03:20 +11:00
Dan Williams 5615172f1d Create: warn when a metadata format's platform components are missing
If the metadata handler can not find its platform support components
then there is no way for it to verify that the raid configuration will
be supported by the option-rom.  Provide a generic method for metadata
handlers to warn the user that the array they are about to create may
not work as intended with a given platform.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-01-20 01:36:51 -07:00
Dan Williams 4cce406959 introduce --detail-platform to display platform raid capabilities
Metadata formats like imsm work in concert with platform firmware and
hardware, so provide a way for mdadm to display this info to the user.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2008-12-08 16:59:18 -07:00
NeilBrown 7e6c6cb267 Detail: support MD_DEVNAME in --export for metadata-less devices.
If there is no metadata (--build was used) then we need to lookup
by devnum, not by uuid, to get the map entry.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:50:39 +11:00
NeilBrown f069dd29f0 detail: --export also provided MD_DEVNAME
MD_NAME is the name of the array extracted directly from the metadata.
MD_DEVNAME is the current working name of the array.  It should appear
in /dev/md.  It is possibly what the user gave when creating the
array.
We extract it from /var/run/mdadm/map.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-11-04 20:50:39 +11:00
NeilBrown 9c3220067b Merge branch 'master' into devel-3.0 2008-10-30 17:02:49 +11:00
NeilBrown 4ebd323711 Adjust major number testing to allow for extended minor number in 2.6.28
From 2.6.28, normal md device will be able to have partitions.  These
partitions will have a different major number.  Sometimes mdadm tests
the major number and so can get confused.
Change these tests to test against get_mdp_major().  mdp does not use
extended minor number and so this test will always be accurate.

Also use /sys/dev links to map major/minor to devnum in sysfs.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-10-30 16:37:29 +11:00
NeilBrown 6c766cf101 Merge branch 'master' into devel-3.0
Conflicts:

	Incremental.c
	super0.c
	super1.c
2008-10-30 13:59:11 +11:00
Doug Ledford d7ee65c960 Fix bad metadata formatting
Certain operations (Detail.c mainly) would print out the metadata of
an array in a format that the scan operation in super0.c and super1.c
would later reject as unknown when it was found in the mdadm.conf file.
Use a consistent format, but also modify the super0 and super1 match
methods to accept the other format without complaint.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2008-10-30 08:53:02 +11:00
NeilBrown 492350045c Merge branch 'master' into devel-3.0
Conflicts:

	Manage.c
2008-10-17 12:46:23 +11:00
NeilBrown e4965ef846 Improve reporting of layout for raid10.
Showing e.g.

   near=1, far=2

for the 'far2' layout of raid10 is confusing even though there is a
sense in which is it correct.

Make it less confusing by only printing whichever number is not 1.
If both are 1, make that clear too (i.e. no redundancy).
2008-10-13 16:15:18 +11:00
NeilBrown 35ddc76dcb Use common code to report MD_UUID for --detail --export
As we need to be able to extract a UUID from any superblock
for matching, use that as the MD_UUID as it will probably be
used for array matching too.
2008-09-18 16:12:28 +10:00
NeilBrown ff54de6e47 Report uuid in --detail --brief for ddf and intel
The uuid is slightly fictitious but needed for array matching.
2008-09-18 16:11:40 +10:00
NeilBrown c69b251bc7 Teach --detail about containers and members there-of.
Make --detail on a container more useful by suppressing irrelevant
detail and adding useful detail like a list of member arrays.

Ditto for members of a container: report the name of the container
array.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-09-18 15:05:20 +10:00
Doug Ledford fb97b4d691 Clean up usage of open()
Fix on call that passed an invalid mode to open
	Don't pass a third arg unless we also pass O_CREAT
	Use symbolic args for 2nd and 3rd args

Signed-off-by: Doug Ledford <dledford@redhat.com>
2008-07-24 18:35:11 -04:00
Neil Brown e8eb8763b4 Add "bitmap=" to "--detail --brief" output when relevant.
Thanks to "Jon Nelson" <jnelson-linux-raid@jamponi.net> for the suggestion.

Signed-off-by: Neil Brown <neilb@suse.de>
2008-06-26 09:33:37 +10:00
Kay Sievers 0d726f17e1 add --export option to --examine
From: Kay Sievers <kay.sievers@vrfy.org>

Cc: David Zeuthen <david@fubar.dk>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
2008-05-06 10:02:38 +10:00
Neil Brown 7a3be72fc6 Fix problems with array.size overflowing on large arrays.
array.size is 32bits and counts K.  So for arrays with
more than 4Terrabytes, it can overflow.
The correct number can be read from sysfs, but there are still
a few places that use array.size and risk truncation.  What is worse.
they compare a number of kilobytes with a number of sectors !!

So use get_component_size() to read the sysfs information, and be
more consistent about units.
2008-04-28 16:29:37 +10:00
Neil Brown 142cb9e181 Use sysfs info for metadata version info in Detail and elsewhere. 2007-12-14 20:15:21 +11:00
Neil Brown 1686dc25ec Find super from fd on an array.
We used to use the major/minor numbers, but that isn't sufficient
any more, so pass the fd, and possibly check 'text' version.
2007-12-14 20:14:38 +11:00
Neil Brown 3da92f272d Drop the superblock arg from all metadata methods.
It is now in the 'supertype'
2007-12-14 20:14:33 +11:00
Neil Brown 68c7d6d790 Add 'supertype' arg to almost all metadata methods.
The 'superblock' will be moved into this structure soon.
2007-12-14 20:14:16 +11:00
Neil Brown df37ffc039 Allow metadata handlers to free their own superblock.
As the metadata handler allocates the superblock, it should free it
too.  DDF will have a more complex 'superblock' which needs more complex
freeing.
2007-12-14 20:14:00 +11:00
Neil Brown aba69144fd Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
Neil Brown 7615d98913 Add metadata version information to "--detail --brief" output. 2007-11-13 09:55:29 +11:00
Tim Woods 9bbcc5f7c4 "--export" segfaults with non-persistent super blocks
From: Tim Woods <timwoods@uklinux.net>

	This patch fixes a NULL pointer dereference in Detail.c when running
'mdadm --detail --export' on a device with non-persistent super blocks.
2007-07-23 17:15:52 +10:00