]> git.ipfire.org Git - thirdparty/mdadm.git/log
thirdparty/mdadm.git
6 years agoZeroout whole ppl space during creation/force assemble
Pawel Baldysiak [Thu, 28 Sep 2017 12:41:11 +0000 (14:41 +0200)] 
Zeroout whole ppl space during creation/force assemble

PPL area should be cleared before creation/force assemble.
If the drive was used in other RAID array, it might contains PPL from it.
There is a risk that mdadm recognizes those PPLs and
refuses to assemble the RAID due to PPL conflict with created
array.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoimsm: validate multiple ppls during assemble
Pawel Baldysiak [Thu, 28 Sep 2017 12:41:10 +0000 (14:41 +0200)] 
imsm: validate multiple ppls during assemble

Change validation algorithm to check validity of multiple ppls that
are stored in PPL area.

If read error occurs during - treat the all PPLs as invalid -
there is no guarantee that this one was not latest. If the header CRC is
incorrect - assume that there are no further PPLs in PPL area.

If whole PPL area was written at least once - there is a possibility that
old PPL (with lower generation number) will follow the recent one
(with higest generation number). Compare those generation numbers to check
which PPL is latest.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoimsm: Add support for multiple ppls
Pawel Baldysiak [Thu, 28 Sep 2017 12:41:09 +0000 (14:41 +0200)] 
imsm: Add support for multiple ppls

Add interpreting new rwh_policy bits. Set PPL size as 1MB.
If new array with ppl is created - use new implementation of ppl by
default.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agosuper1: Add support for multiple-ppls
Pawel Baldysiak [Thu, 28 Sep 2017 12:41:08 +0000 (14:41 +0200)] 
super1: Add support for multiple-ppls

Add support for super1 with multiple ppls. Extend ppl area size to 1MB.
Use 1MB as default during creation. Always start array as single ppl -
if kernel is capable of multiple ppls and there is enough space reserved -
it will switch the policy during first metadata update.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoDon't abort starting the array if kernel does not support ppl
Artur Paszkiewicz [Thu, 28 Sep 2017 12:41:07 +0000 (14:41 +0200)] 
Don't abort starting the array if kernel does not support ppl

Change the behavior of assemble and create for consistency-policy=ppl
for external metadata arrays. If the kernel does not support ppl, don't
abort but print a warning and start the array without ppl
(consistency-policy=resync). No change for native md arrays because the
kernel will not allow starting the array if it finds an unsupported
feature bit in the superblock.

In sysfs_add_disk() check consistency_policy in the mdinfo structure
that represents the array, not the disk and read the current consistency
policy from sysfs in mdmon's manage_member(). This is necessary to make
sysfs_add_disk() honor the actual consistency policy and not what is in
the metadata. Also remove all the places where consistency_policy is set
for a disk's mdinfo - it is a property of the array, not the disk.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm: fixes some trivial typos in comments
Zhilong Liu [Tue, 5 Sep 2017 09:41:38 +0000 (17:41 +0800)] 
mdadm: fixes some trivial typos in comments

fix some trivial typos in comments.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/manpage: disable bitmap_resize for external file bitmap
Zhilong Liu [Tue, 5 Sep 2017 09:41:37 +0000 (17:41 +0800)] 
mdadm/manpage: disable bitmap_resize for external file bitmap

Update the manpage in "SIZE CHANGES" against the md commit.
Commit: e8a27f836f165c26f867ece7f31eb5c811692319
(md/bitmap: disable bitmap_resize for file-backed bitmaps.)

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/grow: Component size must be larger than chunk size
Zhilong Liu [Tue, 5 Sep 2017 09:41:36 +0000 (17:41 +0800)] 
mdadm/grow: Component size must be larger than chunk size

Grow: Changing component size must be larger than current
chunk size against stripe raids, otherwise Grow_reshape()
would set s->size to '0'.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor: Check redundancy for arrays
Mariusz Tkaczyk [Mon, 4 Sep 2017 10:52:46 +0000 (12:52 +0200)] 
Monitor: Check redundancy for arrays

GET_MISMATCH option doesn't exist for RAID arrays without redundancy
so sysfs_read fails if this information is requested. Set options
according to the device using information from /proc/mdstat.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoimsm: New disk controller domains
Mariusz Tkaczyk [Thu, 7 Sep 2017 14:05:09 +0000 (16:05 +0200)] 
imsm: New disk controller domains

Add disk controller domain for nvme and vmd devices to prevent moving
spares between different domains.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoGrow: stop previous reshape process first
Tomasz Majchrzak [Thu, 7 Sep 2017 11:01:16 +0000 (13:01 +0200)] 
Grow: stop previous reshape process first

If array is stopped during reshape and assembled again straight away,
reshape process in a background might still be running. systemd doesn't
start a new service if one already exists. If there is a race, previous
process might terminate and new one is not created. Reshape doesn't
continue after assemble.

Tell systemd to restart the service rather than just start it. It will
assure previous service is stopped first. If it's not running, stopping
has no effect and only new process is started.

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoClose mdfd before returning main function
Xiao Ni [Tue, 19 Sep 2017 06:06:46 +0000 (14:06 +0800)] 
Close mdfd before returning main function

Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoutil: Code is 80 characters wide
Jes Sorensen [Fri, 29 Sep 2017 22:15:23 +0000 (18:15 -0400)] 
util: Code is 80 characters wide

Lets not make things uglier than they need to be.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoManage_subdevs(): Use a dev_t
Jes Sorensen [Fri, 29 Sep 2017 22:08:01 +0000 (18:08 -0400)] 
Manage_subdevs(): Use a dev_t

Use the correct type for rdev

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agosysfs_init_dev - take a dev_t argument
Jes Sorensen [Fri, 29 Sep 2017 22:04:06 +0000 (18:04 -0400)] 
sysfs_init_dev - take a dev_t argument

Be consistent and use the correct type.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agolib: devid2kname() should take a dev_t
Jes Sorensen [Fri, 29 Sep 2017 21:54:12 +0000 (17:54 -0400)] 
lib: devid2kname() should take a dev_t

Make devid2kname() and devid2devnm() consistent in their APIs

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdopen: call "modprobe md_mod" if it might be needed.
NeilBrown [Mon, 25 Sep 2017 05:52:19 +0000 (15:52 +1000)] 
mdopen: call "modprobe md_mod" if it might be needed.

Creating an array by opening a block-device with major number of 9
will transparently load the md module if needed.
Creating an array by opening
   /sys/module/md_mod/parameters/new_array
and writing to it won't, it will just fail if md_mod isn't loaded.

So when opening that file fails with ENOENT, run "modprobe md_mod" and
try again.

This fixes a bug whereby if you have "CREATE names=yes" in mdadm.conf,
and the md modules isn't loaded, then creating or assembling an
array will not honor the "names=yes" configuration.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/test: add new testcase for testing readonly/readwrite
Zhilong Liu [Mon, 28 Aug 2017 09:24:31 +0000 (17:24 +0800)] 
mdadm/test: add new testcase for testing readonly/readwrite

This is a test case for testing --readonly and
--readwrite feature, it covers common metadata
versions and raid levels.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/test: get rid of tests/check
Zhilong Liu [Mon, 28 Aug 2017 09:24:30 +0000 (17:24 +0800)] 
mdadm/test: get rid of tests/check

The tests/check can be removed due to check()
in new 'test' has covered various checking.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/test: get rid of the tests/testdev
Zhilong Liu [Mon, 28 Aug 2017 09:24:29 +0000 (17:24 +0800)] 
mdadm/test: get rid of the tests/testdev

It's time to get rid of the tests/testdev due
to it has covered by testdev() in new 'test'.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/test: use the first element of array as parsing condition
Zhilong Liu [Mon, 28 Aug 2017 09:24:28 +0000 (17:24 +0800)] 
mdadm/test: use the first element of array as parsing condition

it would complain "too many arguments" when array[] has
few members, it's proper to check whether or not array[0]
is null.

Reported-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/bitmap: examine-bitmap failed when bitmap is external mode
Zhilong Liu [Mon, 28 Aug 2017 09:24:27 +0000 (17:24 +0800)] 
mdadm/bitmap: examine-bitmap failed when bitmap is external mode

--examine-bitmap: the bitmap_file_open() shouldn't omit the
regular file descriptor when the bitmap is external mode.
Such as: ./mdadm -X /mnt/3

This commit is partial revert of commit 0a6bff09d416
(mdadm/util: unify fstat checking blkdev into function)

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm: set journal_clean after scanning all disks
Song Liu [Tue, 29 Aug 2017 16:53:02 +0000 (09:53 -0700)] 
mdadm: set journal_clean after scanning all disks

Summary:
In Incremental.c:count_active(), max_events is tracked to show to
which devices are up to date. If a device has events==max_events+1,
getinfo_super() is called to reload the superblock from this
device. getinfo_super1() blindly set journal_clean to 0, which is
wrong.

This patch fixes this by tracking max_journal_events for all the
disks. After scanning all disks, journal_clean is set if
max_journal_events >= max_events-1.

Signed-off-by: Song Liu <songliubraving@fb.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm: install two more udev rules in mdadm.spec
Song Liu [Mon, 28 Aug 2017 22:20:35 +0000 (15:20 -0700)] 
mdadm: install two more udev rules in mdadm.spec

To avoid rpmbuild error.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoDetail: differentiate between container and inactive arrays
Mariusz Tkaczyk [Fri, 18 Aug 2017 10:00:23 +0000 (12:00 +0200)] 
Detail: differentiate between container and inactive arrays

Containers used to be handled as active arrays because GET_ARRAY_INFO
ioctl returns valid structure for them. As containers appear as inactive
in sysfs, the output for detail command has changed.

Stop relying on inactive state for containers. Make the output look the
same as in mdadm 4.0.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor: Include containers in spare migration
Mariusz Tkaczyk [Wed, 16 Aug 2017 12:59:46 +0000 (14:59 +0200)] 
Monitor: Include containers in spare migration

Spare migration doesn't work for external metadata. mdadm skips
a container with spare device because it is inactive. It used to work
because GET_ARRAY_INFO ioctl returned valid structure for a container
and mdadm treated such response as active container. Current
implementation checks it in sysfs where container is shown as inactive.

Adapt sysfs implementation to work the same way as ioctl.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor: containers don't have the same sysfs properties as arrays
Mariusz Tkaczyk [Wed, 16 Aug 2017 12:22:32 +0000 (14:22 +0200)] 
Monitor: containers don't have the same sysfs properties as arrays

GET_MISMATCH option doesn't exist for containers so sysfs_read fails if
this information is requested. Set options according to the device using
information from /proc/mdstat.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoDon't use exit(ERANGE)
NeilBrown [Fri, 4 Aug 2017 05:30:02 +0000 (15:30 +1000)] 
Don't use exit(ERANGE)

mdadm uses smaller exit codes like 0,1,2,3,4.
Using ERANGE is inconsistent and not helpful.
So change it to a more consistent number.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agosuper1: only set clustered flag when bitmap is present
NeilBrown [Fri, 4 Aug 2017 05:30:02 +0000 (15:30 +1000)] 
super1: only set clustered flag when bitmap is present

If no bitmap is present, then the test

if (__le32_to_cpu(bsb->nodes) > 1)

accesses uninitialised memory.  So move that test inside
a test for a bitmap being present.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoUse correct syntax for passing DEVLINKS to mdadm from udev
NeilBrown [Fri, 4 Aug 2017 05:30:02 +0000 (15:30 +1000)] 
Use correct syntax for passing DEVLINKS to mdadm from udev

 ${DEVLINKS}
is not valid udev syntax, and is passed through uninterpreted.
 $env{DEVLINKS}
or
  %e{DEVLINKS}
is correct.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoError messages should end with a newline character.
NeilBrown [Fri, 4 Aug 2017 05:30:02 +0000 (15:30 +1000)] 
Error messages should end with a newline character.

Add "\n" to the end of error messages which don't already
have one.  Also spell "opened" correctly.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoimsm: rebuild from 2-disk RAID10
Tomasz Majchrzak [Thu, 10 Aug 2017 13:47:22 +0000 (15:47 +0200)] 
imsm: rebuild from 2-disk RAID10

When RAID10 loses 2 disks and it is still operational, it cannot be
rebuilt. The rebuild process starts for the first disk and completes,
however completion is not recorded in metadata. There is an assumption
that rebuild completion corresponds to transition from degraded to
normal state. It's not the case for 2-disk RAID10 as it's still degraded
after rebuild to first disk completes.

Check if disk rebuild flag is set in the second map and clear it. So far it
has been checked only in the first map (where it was not set). The flag in
the second map has not been cleared but rebuild completion dropped second
map so the problem was not visible.

If rebuild completion is notified and array still has failed disks and is in
degraded state, check first if rebuild position is really unset (the same
check as for array in normal state). If so, mark migration as done but don't
change array state (it should remain degraded). Update failed disk number.

On rebuild start don't clear the rebuild flag in the destination map for all
the drives because failed state is lost for one of them. Just do a copy of
a map and clear the flag in the destination map for the disk that goes into
rebuild. Similarily preserve the rebuild flag in the map during disk removal.

If the disk is missing on array start and migration has been in progress,
don't just cancel it. Check first if maybe one of the disks was not under
rebuild (rebuild flag present both in source and destination map). If so,
rebuild was running despite of failed disk so there is no need to cancel
migration.

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoDetail: correct output for active arrays
Mariusz Tkaczyk [Thu, 10 Aug 2017 09:43:48 +0000 (11:43 +0200)] 
Detail: correct output for active arrays

The check for inactive array is incorrect as it compares it against
active array. Introduce a new function md_is_array_active so the check
is consistent across the code.

As the output contains list of disks in the array include this
information in sysfs read.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoudev rules: introduce rules for cluster-md to confirm device
Guoqing Jiang [Wed, 2 Aug 2017 02:05:41 +0000 (10:05 +0800)] 
udev rules: introduce rules for cluster-md to confirm device

For cluster scenario, add device is different with native raid.
When a node issues adds a device, then the node will broadcast
a message with UUID to other nodes in the cluster. If receiving
node can find the device with the specific UUID, it must confirm
the device, otherwise reports it is missing.

Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/r5cache: allow adding journal to array without journal
Song Liu [Tue, 28 Mar 2017 18:04:44 +0000 (11:04 -0700)] 
mdadm/r5cache: allow adding journal to array without journal

Currently, --add-journal can be only used to recreate broken journal
for arrays with journal since  creation. As the kernel code getting
more mature, this constraint is no longer necessary.

This patch allows --add-journal to add journal to array without
journal.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agosuper1: Always round data offset to 1M
Pawel Baldysiak [Wed, 26 Jul 2017 14:41:54 +0000 (16:41 +0200)] 
super1: Always round data offset to 1M

Currently if metadata requires more then 1M,
data offset will be rounded down to closest MB.
This is not correct, since less then required space is reserved.
Always round data offset up to multiple of 1M.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor: don't assume mdadm parameter is a block device
Tomasz Majchrzak [Mon, 19 Jun 2017 09:19:53 +0000 (11:19 +0200)] 
Monitor: don't assume mdadm parameter is a block device

If symlink (e.g. /dev/md/raid) is passed as a parameter to mdadm --wait,
it fails as it's not able to find a corresponding entry in /proc/mdstat
output. Get parameter file major:minor and look for block device name in
sysfs. This commit is partial revert of commit 9e04ac1c43e6
("mdadm/util: unify stat checking blkdev into function").

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/test: Add '--disks=' to support testing phsical devices
Zhilong Liu [Wed, 14 Jun 2017 13:02:53 +0000 (21:02 +0800)] 
mdadm/test: Add '--disks=' to support testing phsical devices

If test mode has set as '--dev=disk', then users can specify
the argument of "--disks" to test a bunch of physical devices.
For example: ./test --dev=disk --disks=/dev/sda{2..15}
could execute all test cases on physical devices.

Currently, the --dev=disk mode would confilct with testdev()
in current test cases, thus ignore testing testdev() if has
set --dev=disk mode.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/test: Add '--raidtype=' to run different raidlevel cases
Zhilong Liu [Wed, 14 Jun 2017 13:02:52 +0000 (21:02 +0800)] 
mdadm/test: Add '--raidtype=' to run different raidlevel cases

It supports to specify the argument of "--raidtype"
to run the different raid level cases. Details refer
to the do_help() usage.
For example: ./test --raidtype=raid1
could execute all the raid1 test cases under tests/.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/test: Refactor and revamp 'test' script
Zhilong Liu [Wed, 14 Jun 2017 13:02:51 +0000 (21:02 +0800)] 
mdadm/test: Refactor and revamp 'test' script

Adding functions:
die()
  uniform the abnormal situations that have to abort.
check_env()
  do various basic checking before running test suite.
save_log()
  collect array infos, include of dmesg, superblock,
  bitmap and /proc/mdstat.
main()
  the core function of this script.

Improve functions:
cleanup()
  clear dmesg and remove the /var/tmp/mdtest* files.
mdadm()
  clear superblock once creating or building arrays
  every time, because it's always creating arrays
  many times in a test case.
check()
  just tidy up with die(), didn't change code meanings.
testdev()
  add checking $1 must be a block device, add 'return 0'
  in final because this function exists in last line of
  test case, such as tests/05r6tor0.
do_test()
  add checking abnormal dmesg and changing log management.
do_help()
  just recommend a better way to print Usage.
parse_args()
  revamp and improve.

Delete function:
fast_sync()
  It's no longer used, so get rid of it.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/test: Convert code format to use Tab
Zhilong Liu [Wed, 7 Jun 2017 09:31:26 +0000 (17:31 +0800)] 
mdadm/test: Convert code format to use Tab

In case to make codes neat, this commit didn't change
any codes, just tidy up and use Tab as code format.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoGrow: don't allow to enable PPL when reshape is in progress
Tomasz Majchrzak [Fri, 9 Jun 2017 14:20:19 +0000 (16:20 +0200)] 
Grow: don't allow to enable PPL when reshape is in progress

Don't allow to enable PPL consistency policy when reshape is in progress.
Current PPL implementation doesn't work when reshape is taking place.

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoGrow: don't allow array geometry change with ppl enabled
Tomasz Majchrzak [Thu, 8 Jun 2017 14:05:51 +0000 (16:05 +0200)] 
Grow: don't allow array geometry change with ppl enabled

Don't allow array geometry change (size expand, disk adding) when PPL
consistency policy is enabled. Current PPL implementation doesn't work when
reshape is taking place.

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoGet failed disk count from array state
Tomasz Majchrzak [Wed, 31 May 2017 10:46:57 +0000 (12:46 +0200)] 
Get failed disk count from array state

Recent commit has changed the way failed disks are counted. It breaks
recovery for external metadata arrays as failed disks are not part of
the array and have no corresponding entries is sysfs (they are only
reported for containers) so degraded arrays show no failed disks.

Recent commit overwrites GET_DEGRADED result prior to GET_STATE and it
is not set again if GET_STATE has not been requested. As GET_STATE
provides the same information as GET_DEGRADED, the latter is not needed
anymore. Remove GET_DEGRADED option and replace it with GET_STATE
option.

Don't count number of failed disks looking at sysfs entries but
calculate it at the end. Do it only for arrays as containers report
no disks, just spares.

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoGrow: set component size prior to array size
Tomasz Majchrzak [Mon, 5 Jun 2017 14:09:44 +0000 (16:09 +0200)] 
Grow: set component size prior to array size

It is a partial revert of commit 758b327cf5a7 ("Grow: Remove unnecessary
optimization"). For native metadata component size is set in kernel for
entire disk space. As external metadata supports multiple arrays within
one disk, the component size is set to array size. If component size is
not updated prior to array size update, the grow operation fails.

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomd_u: Remove unused ioctl declaration of START_ARRAY
Zhilong Liu [Wed, 31 May 2017 11:38:36 +0000 (19:38 +0800)] 
md_u: Remove unused ioctl declaration of START_ARRAY

START_ARRAY is no longer used in the code, so get rid of it.
MD commit: fbedac04fa11 ("[PATCH] md: the scheduled removal
of the START_ARRAY ioctl for md") merged in the year 2006.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agosuper1: fix sb->max_dev when adding a new disk in linear array
Lidong Zhong [Thu, 25 May 2017 09:28:11 +0000 (17:28 +0800)] 
super1: fix sb->max_dev when adding a new disk in linear array

The value of sb->max_dev will always be increased by 1 when adding
a new disk in linear array. It causes an inconsistence between each
disk in the array and the "Array State" value of "mdadm --examine DISK"
is wrong. For example, when adding the first new disk into linear array
it will be:

Array State : RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
('A' == active, '.' == missing, 'R' == replacing)

Adding the second disk into linear array it will be

Array State : .AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
('A' == active, '.' == missing, 'R' == replacing)

Signed-off-by: Lidong Zhong <lzhong@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoDetail: don't exit if ioctl has been successful
Tomasz Majchrzak [Wed, 24 May 2017 09:34:22 +0000 (11:34 +0200)] 
Detail: don't exit if ioctl has been successful

When GET_ARRAY_INFO ioctl is successful, mdadm exits with an error.
It breaks udev and no links in /dev/md are created.

Also change debug print to error print in the message indicating lack
of the link to facilitate debugging similar issues in the future.

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomanpage: bad block support for IMSM
Tomasz Majchrzak [Thu, 18 May 2017 13:14:49 +0000 (15:14 +0200)] 
manpage: bad block support for IMSM

Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm: Fixup != broken formatting
Jes Sorensen [Tue, 16 May 2017 18:09:57 +0000 (14:09 -0400)] 
mdadm: Fixup != broken formatting

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm: Fix '==' broken formatting
Jes Sorensen [Tue, 16 May 2017 18:04:22 +0000 (14:04 -0400)] 
mdadm: Fix '==' broken formatting

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm: Fixup more broken logical operator formatting
Jes Sorensen [Tue, 16 May 2017 17:59:43 +0000 (13:59 -0400)] 
mdadm: Fixup more broken logical operator formatting

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm: Fixup a large number of bad formatting of logical operators
Jes Sorensen [Tue, 16 May 2017 17:52:15 +0000 (13:52 -0400)] 
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>
6 years agosuper-ddf: sysfs_read() takes a pointer as device name argument
Jes Sorensen [Tue, 16 May 2017 17:29:46 +0000 (13:29 -0400)] 
super-ddf: sysfs_read() takes a pointer as device name argument

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm: Uninitialized variable rdev
James Puthukattukaran [Tue, 16 May 2017 15:57:00 +0000 (11:57 -0400)] 
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>
6 years agoMonitor: Fixup a pile of whitespace issues
Jes Sorensen [Thu, 11 May 2017 20:56:55 +0000 (16:56 -0400)] 
Monitor: Fixup a pile of whitespace issues

No code was hurt in this event

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor: mailfrom is initialized correctly
Jes Sorensen [Thu, 11 May 2017 20:44:19 +0000 (16:44 -0400)] 
Monitor: mailfrom is initialized correctly

Remove gratituous variable initialization.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor: Not much point declaring mdlist in both forks of the if() statement
Jes Sorensen [Thu, 11 May 2017 20:40:16 +0000 (16:40 -0400)] 
Monitor: Not much point declaring mdlist in both forks of the if() statement

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoretire the APIs that driver no longer supports
Zhilong Liu [Thu, 11 May 2017 08:52:41 +0000 (16:52 +0800)] 
retire the APIs that driver no longer supports

refer to commit: e6e5f8f1267d ("Build: Stop
bothering about supporting md driver ...")
continue to retire the APIs that md driver
wasn't supported for very long period of time.

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoIMSM: Correct --examine output for 4k disks
Maksymilian Kunt [Tue, 9 May 2017 12:03:27 +0000 (14:03 +0200)] 
IMSM: Correct --examine output for 4k disks

"Array Size" and "Per Dev Size" are incorrect for disks with sector size
different than 512B.

Calculate "Array Size" and "Per Dev Size" based on sector size. Additionally
print "Sector Size".

Signed-off-by: Maksymilian Kunt <maksymilian.kunt@intel.com>
Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor/check_array: Use working_disks from sysfs
Jes Sorensen [Tue, 9 May 2017 21:15:14 +0000 (17:15 -0400)] 
Monitor/check_array: Use working_disks from sysfs

sysfs now provides working_disks information, so lets use it too.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agosysfs/sysfs_read: Count working_disks
Jes Sorensen [Tue, 9 May 2017 21:09:40 +0000 (17:09 -0400)] 
sysfs/sysfs_read: Count working_disks

This counts working_disks the same way as get_array_info counts it in
the kernel.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor/check_array: Get nr_disks, active_disks and spare_disks from sysfs
Jes Sorensen [Tue, 9 May 2017 21:03:03 +0000 (17:03 -0400)] 
Monitor/check_array: Get nr_disks, active_disks and spare_disks from sysfs

This leaves working_disks and utime missing before we can eliminate
check_array()'s call to md_get_array_info()

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor/check_array: Get array_disks from sysfs
Jes Sorensen [Tue, 9 May 2017 20:58:55 +0000 (16:58 -0400)] 
Monitor/check_array: Get array_disks from sysfs

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor/check_array: Get 'failed_disks' from sysfs
Jes Sorensen [Tue, 9 May 2017 20:54:19 +0000 (16:54 -0400)] 
Monitor/check_array: Get 'failed_disks' from sysfs

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor/check_array: Obtain RAID level from syfs
Jes Sorensen [Tue, 9 May 2017 20:52:44 +0000 (16:52 -0400)] 
Monitor/check_array: Obtain RAID level from syfs

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor/check_array: Read sysfs entry earlier
Jes Sorensen [Tue, 9 May 2017 20:49:33 +0000 (16:49 -0400)] 
Monitor/check_array: Read sysfs entry earlier

This will allow us to pull additional info from sysfs, such as level
and device info.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor/check_array: Declate mdinfo instance globally
Jes Sorensen [Tue, 9 May 2017 20:41:06 +0000 (16:41 -0400)] 
Monitor/check_array: Declate mdinfo instance globally

We can pull in more information from sysfs earlier, so move sra to the top.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor/check_array: Reduce duplicated error handling
Jes Sorensen [Tue, 9 May 2017 20:38:06 +0000 (16:38 -0400)] 
Monitor/check_array: Reduce duplicated error handling

Avoid closing fd in multiple places, and duplicating the error message
for when a device disappeared.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor/check_array: Centralize exit path
Jes Sorensen [Tue, 9 May 2017 20:25:23 +0000 (16:25 -0400)] 
Monitor/check_array: Centralize exit path

Improve exit handling to make it easier to share error handling and free
sysfs entries later.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoAdd sector size as spare selection criterion
Alexey Obitotskiy [Tue, 9 May 2017 10:25:47 +0000 (12:25 +0200)] 
Add sector size as spare selection criterion

Add sector size as new spare selection criterion. Assume that 0 means
there is no requirement for the sector size in the array. Skip disks
with unsuitable sector size when looking for a spare to move across
containers.

Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoAllow more spare selection criteria
Alexey Obitotskiy [Tue, 9 May 2017 10:25:46 +0000 (12:25 +0200)] 
Allow more spare selection criteria

Disks can be moved across containers in order to be used as a spare
drive for reubild. At the moment the only requirement checked for such
disk is its size (if it matches donor expectations). In order to
introduce more criteria rename corresponding superswitch method to more
generic name and move function parameter to a structure. This change is
a big edit but it doesn't introduce any changes in code logic, it just
updates function naming and parameters.

Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoimsm: don't allow disks with different sector size in one array
Alexey Obitotskiy [Tue, 9 May 2017 10:25:45 +0000 (12:25 +0200)] 
imsm: don't allow disks with different sector size in one array

As there is no support in IMSM for arrays including disks with different
sector sizes, don't allow to create such configuration. Also skip the
disk with unsuitable sector size when looking for spares in the same
container.

Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoimsm: allocate buffer to support maximum sector size
Alexey Obitotskiy [Tue, 9 May 2017 10:25:44 +0000 (12:25 +0200)] 
imsm: allocate buffer to support maximum sector size

Allocate migration record buffer to support maximum sector size. Disk with
non-matching sector size is not going to be included in the array, however
some preparation/cleanup actions still take place on it and they would
cause a crash. Clear migration record using sector size of the disk (not
array) as they might not match.

Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoimsm: allow drives in a container regardless of sector size
Alexey Obitotskiy [Tue, 9 May 2017 10:25:43 +0000 (12:25 +0200)] 
imsm: allow drives in a container regardless of sector size

IMSM doesn't allow to create arrays including drives with different
sector sizes. The initial idea was not to permit to combine drives
with different sector size in the same container. The problem is it
only worked for array creation. On array assemble there are no
calls to metadata handlers to see if drive is suitable for a container
(e.g. as a spare) and it leads to wrong configuration.

Revert the change and allow adding drives with different sector size
to the container.

Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/md.4: set page-length as 1000 to avoid warnings from grotty
Zhilong Liu [Tue, 9 May 2017 06:25:17 +0000 (14:25 +0800)] 
mdadm/md.4: set page-length as 1000 to avoid warnings from grotty

"nroff" ("man") or ("tbl") needs a long page to avoid warnings
from "grotty", set 'pl' as 1000 to fix the following issue.

This command invokes by Makefile rule.
linux-tjrh:~/mdadm # man -l md.4 > test
grotty:<standard input> (<standard input>):5967:
character above first line discarded
... ...

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor: Code is 80 characters per line
Jes Sorensen [Mon, 8 May 2017 21:52:10 +0000 (17:52 -0400)] 
Monitor: Code is 80 characters per line

Fix up some lines that are too long for no reason, and some that have
silly line breaks.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMonitor: Use md_array_active() instead of manually fiddling in sysfs
Jes Sorensen [Mon, 8 May 2017 21:34:08 +0000 (17:34 -0400)] 
Monitor: Use md_array_active() instead of manually fiddling in sysfs

This removes a pile of clutter that can easily behandled with a simple
check of array_state.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoMention "endian" in documentation for --update=byte-order
NeilBrown [Sun, 7 May 2017 23:40:09 +0000 (09:40 +1000)] 
Mention "endian" in documentation for --update=byte-order

This makes it easier to find as "endian" is a commonly used term.

Reported-by: Trevor Cordes <trevor@tecnopolis.ca>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoIncrementalScan: Use md_array_active() instead of md_get_array_info()
Jes Sorensen [Fri, 5 May 2017 16:18:29 +0000 (12:18 -0400)] 
IncrementalScan: Use md_array_active() instead of md_get_array_info()

This eliminates yet another case where GET_ARRAY_INFO was used to
indicate whether the array was active.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agocontainer_members_max_degradation: Switch to using syfs for disk info
Jes Sorensen [Fri, 5 May 2017 16:06:57 +0000 (12:06 -0400)] 
container_members_max_degradation: Switch to using syfs for disk info

With sysfs now providing the necessary active_disks info, switch to
sysfs and eliminate one more use of md_get_array_info(). We can do
this unconditionally since we wouldn't get here witout sysfs being
available.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agosysfs/sysfs_read: Count active_disks and failed_disks
Jes Sorensen [Fri, 5 May 2017 15:51:43 +0000 (11:51 -0400)] 
sysfs/sysfs_read: Count active_disks and failed_disks

Cound active_disks as drives mark 'in_sync' and failed_disks as
disks marked 'faulty', in the same way ioctl(GET_ARRAY_INFO) does.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoIncremental: return is not a function
Jes Sorensen [Fri, 5 May 2017 15:39:58 +0000 (11:39 -0400)] 
Incremental: return is not a function

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoFix typo in new udev rule.
NeilBrown [Fri, 5 May 2017 05:16:15 +0000 (15:16 +1000)] 
Fix typo in new udev rule.

As pointed out by Peter Rajnoha, the correct usage in udev is
TEST=="file", not TEST="file".

Also improve a related comment which was a bit informal.

Reported-by: Peter Rajnoha <prajnoha@redhat.com>
Fixes: cd6cbb08c458 ("Create: tell udev md device is not ready when first created.")
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agomdadm/util: unify stat checking blkdev into function
Zhilong Liu [Fri, 5 May 2017 03:09:41 +0000 (11:09 +0800)] 
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>
6 years agomdadm/util: unify fstat checking blkdev into function
Zhilong Liu [Thu, 4 May 2017 12:16:21 +0000 (20:16 +0800)] 
mdadm/util: unify fstat checking blkdev into function

declare function fstat_is_blkdev() to integrate repeated fstat
checking block device operations, it returns true/1 when it is
a block device, and returns false/0 when it isn't.
The fd and devname are necessary parameters, *rdev is optional,
parse the pointer of dev_t *rdev, if valid, assigned the 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>
6 years agomdassemble: Kill off the last remains
Jes Sorensen [Thu, 4 May 2017 15:57:41 +0000 (11:57 -0400)] 
mdassemble: Kill off the last remains

Having gotten rid of mdassemble, lets get rid of the man page too

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agokernel-patch: Remove obsolete kernel patches against 2.6
Jes Sorensen [Thu, 4 May 2017 15:39:05 +0000 (11:39 -0400)] 
kernel-patch: Remove obsolete kernel patches against 2.6

While we still support some of these kernels, I do not think it makes
sense to carry this patches around at this point.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoutil: md_array_valid(): Introduce md_array_valid() helper
Jes Sorensen [Wed, 3 May 2017 18:25:57 +0000 (14:25 -0400)] 
util: md_array_valid(): Introduce md_array_valid() helper

Using md_get_array_info() to determine if an array is valid is broken
during creation, since the ioctl() returns -ENODEV if the device is
valid but not active.

Where did I leave my stash of brown paper bags?

Fixes: ("40b054e mdopen/open_mddev: Use md_get_array_info() to determine valid array")
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agochange back 0644 permission for Grow.c
Zhilong Liu [Tue, 2 May 2017 09:27:13 +0000 (17:27 +0800)] 
change back 0644 permission for Grow.c

Fixes commit:
26714713cd2b ("mdadm: Change timestamps to unsigned data type.")

Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoGrow: Grow_continue_command: Avoid aliasing array variable
Jes Sorensen [Tue, 2 May 2017 15:46:49 +0000 (11:46 -0400)] 
Grow: Grow_continue_command: Avoid aliasing array variable

While this would cause a warning since the two are different types,
lets avoid aliasing an existing variable.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoIMSM: Initialize my_vol_raid_dev_num during vol creation
Pawel Baldysiak [Wed, 26 Apr 2017 09:08:07 +0000 (11:08 +0200)] 
IMSM: Initialize my_vol_raid_dev_num during vol creation

This field was not initialized so far. This ID needs to be unique
for every newly created array in container.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoManage: Manage_ro(): Use md_array_active()
Jes Sorensen [Tue, 2 May 2017 14:40:07 +0000 (10:40 -0400)] 
Manage: Manage_ro(): Use md_array_active()

One call less to md_get_array_info() for determining whether an array
is active or not.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoIncremental: Use md_array_active() to determine state of array
Jes Sorensen [Tue, 2 May 2017 14:36:51 +0000 (10:36 -0400)] 
Incremental: Use md_array_active() to determine state of array

One less call to md_get_array_info()

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoCreate: tell udev md device is not ready when first created.
NeilBrown [Fri, 28 Apr 2017 05:05:50 +0000 (15:05 +1000)] 
Create: tell udev md device is not ready when first created.

When an array is created the content is not initialized,
so it could have remnants of an old filesystem or md array
etc on it.
udev will see this and might try to activate it, which is almost
certainly not what is wanted.

So create a mechanism for mdadm to communicate with udev to tell
it that the device isn't ready.  This mechanism is the existance
of a file /run/mdadm/created-mdXXX where mdXXX is the md device name.

When creating an array, mdadm will create the file.
A new udev rule file, 01-md-raid-creating.rules, will detect the
precense of thst file and set ENV{SYSTEMD_READY}="0".
This is fairly uniformly used to suppress actions based on the
contents of the device.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoIncremental: Cleanup some if() statement spaghetti
Jes Sorensen [Tue, 25 Apr 2017 19:01:43 +0000 (15:01 -0400)] 
Incremental: Cleanup some if() statement spaghetti

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoIncremental: Use md_array_active() where applicable
Jes Sorensen [Tue, 25 Apr 2017 18:57:46 +0000 (14:57 -0400)] 
Incremental: Use md_array_active() where applicable

md_get_array_info() == 0 implies an array is active, however this is more
correct.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoDetail: Reinstate support for not having sysfs
Jes Sorensen [Tue, 25 Apr 2017 18:34:31 +0000 (14:34 -0400)] 
Detail: Reinstate support for not having sysfs

While sysfs support will hopefully go away eventually, lets not break
it unnecessarily for now.

Fixes: 901d5ee ("Detail: Stop bothering about md drivers older than 0.90.00")
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoDetail: Respect code lines are 80 character wide
Jes Sorensen [Tue, 25 Apr 2017 16:21:39 +0000 (12:21 -0400)] 
Detail: Respect code lines are 80 character wide

In addition apply spaces and don'f do 'if () action()' on the same line.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
6 years agoDetail: determine array state from sysfs
Jes Sorensen [Tue, 25 Apr 2017 15:40:27 +0000 (11:40 -0400)] 
Detail: determine array state from sysfs

This is easily obtained from sysfs as part of the existing call to
sysfs_read() and it simplifies the code a little too.

Another small step in the process of getting rid of the GET_ARRAY_STATE
ioctl.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>