Commit Graph

332 Commits

Author SHA1 Message Date
Blazej Kucman 3364781b92 imsm: pass subarray id to kill_subarray function
After patch b6180160f ("imsm: save current_vol number")
current_vol for imsm is not set and kill_subarray()
cannot determine which volume has to be deleted.
Volume has to be passed as "subarray_id".
The parameter affects only IMSM metadata.

Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2020-02-24 16:08:15 -05:00
Blazej Kucman b771faef93 imsm: return correct uuid for volume in detail
Fixes the side effect of the patch b6180160f ("imsm: save current_vol number")
- wrong UUID is printed in detail for each volume.
New parameter "subarray" is added to determine what info should be extracted
from metadata (subarray or container).
The parameter affects only IMSM metadata.

Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2019-12-02 16:01:16 -05:00
Dimitri John Ledkov ebf3be9931 Fix spelling typos.
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2019-02-11 14:42:50 -05:00
Jes Sorensen 002a5978f0 super-ddf: Fix gcc-8.1 overflow warnings
Cast to types that are big enough to hold the values, but also guarantee
no overflow of the buffer keepts gcc happy.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2018-05-31 16:07:33 -04:00
Jes Sorensen d16a749444 mdadm: Fixup != broken formatting
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-05-16 14:09:57 -04:00
Jes Sorensen b831b299e8 mdadm: Fix '==' broken formatting
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-05-16 14:04:22 -04:00
Jes Sorensen d7be7d8736 mdadm: Fixup more broken logical operator formatting
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-05-16 13:59:43 -04:00
Jes Sorensen fc54fe7a7e mdadm: Fixup a large number of bad formatting of logical operators
Logical oprators never belong at the beginning of a line.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-05-16 13:52:15 -04:00
Jes Sorensen a0628abf2b super-ddf: sysfs_read() takes a pointer as device name argument
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-05-16 13:29:46 -04:00
James Puthukattukaran a3476c9223 mdadm: Uninitialized variable rdev
rdev is not initialized properly causing compiler complaint.

Signed-off-by: James Puthukattukaran <joejames70@gmail.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-05-16 11:58:31 -04:00
Zhilong Liu 9e04ac1c43 mdadm/util: unify stat checking blkdev into function
declare function stat_is_blkdev() to integrate repeated stat
checking blkdev operations, it returns 'true/1' when it is a
block device, and returns 'false/0' when it isn't.
The devname is necessary parameter, *rdev is optional, parse
the pointer of dev_t *rdev, if valid, assigned device number
to dev_t *rdev, if NULL, ignores.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-05-05 11:05:32 -04:00
Jes Sorensen 32141c1765 Retire mdassemble
mdassemble doesn't handle container based arrays, no support for sysfs,
etc. It has not been actively maintained for years, so time to send it
off to retirement.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2017-04-11 12:54:26 -04:00
Artur Paszkiewicz 65884368cd Detail: show consistency policy
Show the currently enabled consistency policy in the output from
--detail. Add 3 spaces to all existing items in Detail output to align
with "Consistency Policy : ".

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
2017-03-29 11:32:27 -04:00
Artur Paszkiewicz 5308f11727 Generic support for --consistency-policy and PPL
Add a new parameter to mdadm: --consistency-policy=. It determines how
the array maintains consistency in case of unexpected shutdown. This
maps to the md sysfs attribute 'consistency_policy'. It can be used to
create a raid5 array using PPL. Add the necessary plumbing to pass this
option to metadata handlers. The write journal and bitmap
functionalities are treated as different policies, which are implicitly
selected when using --write-journal or --bitmap options.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
2017-03-29 11:32:15 -04:00
NeilBrown eddaacc304 ddf: use 64bit 'size', not 32bit 'info->size' for create.
The 'size' field of mdu_disk_info_t is 32bit and should not be used
except for legacy ioctls.  super-ddf got this wrong :-(

This change makes it possible to create ddf arrays which used more than
2TB of each device.

Reported-by: Dan Russell <dpr@aol.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
2016-03-10 11:42:41 -05:00
Martin Wilck b87fdf4e89 DDF: _write_super_to_disk: fix anchor header type
Since commit 30bee0201, the anchor is updated from the active
DDF header. This requires fixing the header type before the
anchor is written.

The LSI Software RAID code will reject DDF meta data with wrong
anchor type and will erase all meta data when it encounters
such a broken anchor. Thus starting Linux md once on a system
with LSI RAID BIOS may cause the meta data to get destroyed.

Signed-off-by: NeilBrown <neilb@suse.de>
2015-05-13 10:33:35 +10:00
NeilBrown 7a862a020f Don't break long strings onto multiple lines.
It is best to keep strings all together so that they
are easier to search for in the source code.
If a string is so long that it looks ugly one line,
them maybe it should be broken into multiple lines
for display too.

Only strings which contain a newline can be broken
into multiple lines:

 "It is OK to\n"
 "break this string\n"


Signed-off-by: NeilBrown <neilb@suse.de>
2015-02-12 13:46:53 +11:00
NeilBrown 1ade5cc15a Consistently print program Name and __func__ in debug messages.
make dprintf() print program name and __func__, so that
this messaging is consistent.

Also remove all __func__ messages from pr_err(). We shouldn't
leak that internal data in error message.
If we really want function name there, we new pr_XXX might
be wanted.

Signed-off-by: NeilBrown <neilb@suse.de>
2015-02-12 13:21:17 +11:00
Guy Menanteau d13566f9b6 DDF: cast print arguments in super-ddf.c
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>
2014-08-05 08:57:48 +10:00
NeilBrown 1f17f96b53 DDF: validate metadata_update size before using it.
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>
2014-07-10 15:59:06 +10:00
NeilBrown 5fe6f031d9 mdmon: allow prepare_update to report failure.
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>
2014-07-10 15:54:02 +10:00
NeilBrown 1e60caebbc Make sure "make everything" builds again.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-06-05 16:38:29 +10:00
NeilBrown 20d430ca81 DDF: remove "BVD xx is missing".
This can happen in normal cases during incremental assembly so
printing an error message is confusing.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 17:22:47 +10:00
Cristian Rodríguez 04f903b21a mdadm: Do not reimplment offsetof
Proper implementations have offsetof in stddef.h

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-22 14:29:14 +10:00
NeilBrown 2ecda5a3fa DDF: remove some pointless code in validate_geometry
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>
2014-05-21 14:03:48 +10:00
NeilBrown 3d99ecd7b5 DDF: remove a FIXME comment that doesn't seem to mean anything.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:51:33 +10:00
NeilBrown 98fbc0ff37 DDF: remove 'FIXME' comment that doesn't need fixing.
It appears this is correct, though for consistency with elsewhere
we check that pdnum is not negative.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:50:52 +10:00
NeilBrown de9107744b DDF: ensure dl->devname is freed when processing a 'delete device' update.
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>
2014-05-21 13:27:54 +10:00
NeilBrown 30da0fa89b DDF: remove old comment about looking for spares.
As handle_missing() sets ->check_degraded, nothing else needs to be
done here.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:10:03 +10:00
NeilBrown 733eedc8f2 DDF: remove an old incorrect FIXME comment.
We mustn't close fds in write_init_super if ->update_tail
was set.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 13:00:08 +10:00
NeilBrown 31bc5466f5 DDF: add data-offset information to --examine output.
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>
2014-05-21 12:43:40 +10:00
NeilBrown fea6a6c0bf DDF: split up ddf_process_update
Function was way too big, make several smaller functions.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 12:20:56 +10:00
NeilBrown 476066a3d5 DDF: add support of --data-offset when creating array.
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>
2014-05-21 11:54:48 +10:00
NeilBrown fca6552000 DDF: factor out common code for search through extents.
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>
2014-05-21 11:54:48 +10:00
NeilBrown 708997ffb7 DDF: allow for unused slots when creating map list for getinfo_super_ddf.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 4fe903aa8b DDF: DDF_Missing devices should not be reported as 'working' by getinfo_super_ddf
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 25532b88a0 DDF: remove old and wrong comment about settinig raid_disk.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown ff84d05210 DDF: provide simple detail_super() implementation.
Just print the GUID, Seq and number of VDs in the container.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown f70d549f12 DDF: support more RAID10 levels.
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>
2014-05-21 11:54:48 +10:00
NeilBrown 2770f45a43 DDF: explain why spare_refs are ignored.
Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 55e0007423 DDF: use array_size from metadata.
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>
2014-05-21 11:54:48 +10:00
NeilBrown 2a351cea60 DDF: set utime for container from timestamp is superblock.
Also be more consistent about setting events from seq in superblock.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:48 +10:00
NeilBrown 30bee02013 DDF: don't assume the anchor is fully up-to-date.
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>
2014-05-21 11:54:48 +10:00
NeilBrown 609ce16109 DDF: update timestamp/seqnum for virtual disks when config changes.
- 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>
2014-05-21 11:54:48 +10:00
NeilBrown 07de268426 DDF: update timestamp in DDF header.
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>
2014-05-21 11:54:48 +10:00
NeilBrown 0d255ff84e DDF: avoid ref outside array in getinfo_super_ddf_bvd
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>
2014-05-21 11:54:47 +10:00
NeilBrown d2ec75fb3e DDF: examine_pds to also list devices that aren't in the metadata.
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>
2014-05-21 11:54:47 +10:00
NeilBrown 217dead48f DDF: fix usage of ->used_pdes
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>
2014-05-21 11:54:47 +10:00
NeilBrown 41bcbc14c4 DDF: more guards against pdnum being negative.
With consistent metdata, pdnum should never be negative,
but it is better to be safe than sorry.

Signed-off-by: NeilBrown <neilb@suse.de>
2014-05-21 11:54:47 +10:00
NeilBrown f43f5b3299 DDF: Don't fail compare_super_ddf due to re-configure changes.
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>
2014-04-02 15:26:35 +11:00