Commit Graph

2312 Commits

Author SHA1 Message Date
NeilBrown 3b2aad6e8b Create new release: 3.2.5
Fix a serious regression in 3.2.4 which caused "--add" to often
fail.  Other minor fixes included.

Signed-off-by:  NeilBrown <neilb@suse.de>
2012-05-18 17:10:03 +10:00
NeilBrown 3c8b273984 Update some device sizes for self tests.
A recent change means that devices smaller than
1Gig no longer have 1Meg wasted at the start.
So we must adjust some sizes again.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-18 17:08:28 +10:00
Lukasz Dorau 65d38cca14 imsm: fix: check if size of expansion is not larger than maximum
We do not check if requested size of expansion is larger than maximum
available size now. If it is larger the output message is a bit misleading,
for example:
   mdadm: Cannot set size on array members.
   mdadm: Cannot set device size for /dev/md/vol: Device or resource busy
Now we check if requested size of expansion is larger than maximum
available size and the appropriate output message was added.

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-18 13:40:17 +10:00
Lukasz Dorau 8948c17fde imsm: fix a typo in fprintf message
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-18 13:40:17 +10:00
NeilBrown 6c89c86792 mdadm.conf.5: typo: of -> or
Addresses-Debian-bug: 673344
Reported-by: Robert Henney <robh@rut.org>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-18 12:31:06 +10:00
NeilBrown ccced50fba RebuildMap: check that container_content returns a valid 'info'.
If it doesn't, just skip that entry.

Reported-by: Maciej Naruszewicz <maciej.naruszewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-17 15:46:09 +10:00
Alexander Lyakas 135a31f5ed Don't consider disks with a valid recovery offset as candidates for bumping up event count
When we are looking for a candidate disk to bump up the event count,
we consider only disks that have recovery_start==MaxSector.
However, after we find one such disk, we agree to accept more disks
having same event count, regardless of their recovery_start.
Be consistent and don't accept disks with a valid recovery_start at all.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-15 14:20:42 +10:00
NeilBrown c456301a05 Grow: don't print message if unfreezing fails.
This is most likely to happen if the array has been stopped,
in which case the error is pointless.

Reported-by: Patrik Horník <patrik@dsl.sk>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-15 12:12:58 +10:00
NeilBrown 385167f364 Grow: fix --layout=preserve to match man page.
I think there was some confusion about what --layout=preserve
actually means, but in any case it wasn't doing what the man
page says it should.
So add some case analysis and make sure it does the right thing,
or complains if it cannot.

Reported-by: Patrik Horník <patrik@dsl.sk>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-15 11:59:40 +10:00
NeilBrown d9751e06a6 super1: fix choice of data_offset.
While it is nice to set a high data_offset to leave plenty of head
room it is much more important to leave enough space to allow
of the data of the array.
So after we check that sb->size is still available, only reduce the
'reserved', don't increase it.

This fixes a bug where --adding a spare fails because it does not have
enough space in it.

Reported-by: nowhere <nowhere@hakkenden.ath.cx>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-15 09:51:03 +10:00
NeilBrown 9f9a7d034f New sha1.c and sha1.h
These are from:
  http://gcc.gnu.org/svn/gcc/branches/cilkplus/include/sha1.h
and
  http://gcc.gnu.org/svn/gcc/branches/cilkplus/libiberty/sha1.c

and hopefully avoid aliasing issues.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-15 09:24:27 +10:00
NeilBrown f648834d13 Create new release: 3.2.4
Bugfix release

Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-09 09:42:57 +10:00
Jes Sorensen 562aa10219 super-intel.c: Fix resource leak from opendir()
Use closedir() on dirp from opendir() to avoid resource leaking.

Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-07 09:09:33 +10:00
Jes Sorensen 36614e9546 super-intel.c: Don't try to close negative fd
This should be harmless, but lets be consistent and not try to close a
negative file descripter.

Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-07 09:08:36 +10:00
NeilBrown b0a658ffbc Grow: failing the set the per-device size is not an error.
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-03 16:18:22 +10:00
NeilBrown 974e0395ee test: don't worry too much about array size.
With different amounts of space being reserved for metadata
it is hard for the script to know how big the array should be.
So allow a bit of slack.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-03 15:29:04 +10:00
NeilBrown 96fd06edce Adjust to new standard of /run
Now that /run seems to be a good standard, make that
the default for storing various run-time files, rather than
/var/run or /dev/.mdadm.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-03 14:16:56 +10:00
NeilBrown 5ffdc2dd44 Update test for "is udev active".
Newer udev doesn't use /dev/.udev any more. it used
/run/udev instead.
So test for that as well.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-03 14:16:51 +10:00
Czarnowska, Anna 5d7b407adb imsm: fix: thunderdome may drop 2tb attribute
Spare superblock doesn't depend on other spares in container.
When loading container metadata thunderdome
may pick a small disk for the champion. This will result in incorrect
interpretation of sizes of other disks in container when joint superblock
is returned. If any disk in container has the 2TB attribute set, the result
must have it set too.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-30 09:57:37 +10:00
Jes Sorensen 012a864129 Introduce sysfs_set_num_signed() and use it to set bitmap/offset
mdinfo->bitmap_offset is a signed long and needs to be treated as
such when passed to the kernel.

This resolves the problem with adding internal bitmaps to a 1.0 array.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-30 09:56:22 +10:00
Jes Sorensen 34a13953fa Fix sign extension of bitmap_offset in super1.c
fbdef49811 incorrectly tried to fix sign
extension of the bitmap offset. However mdinfo->bitmap_offset is a u32
and needs to be converted to a 32 bit signed integer before the sign
extension.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-30 09:56:22 +10:00
Lukasz Dorau b51702b827 fix: correct extending size of raid0 array
Setting "sync_action" to "idle" while extending size of raid0 array
is racy and sometimes fails.
"sync_action" should be set to "frozen" instead.

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-23 10:12:33 +10:00
Lukasz Dorau 7ce0570181 imsm: fix: rebuild does not continue after reboot
If system is rebooted during rebuild, md driver changes sync_action
from 'recover' to 'idle' (during stopping all md devices).
If mdmon is still running then, it detects the change of sync_action state,
finishes rebuild and writes metadata to disks. After computer's restart
the RAID volume is in Normal state in OROM and rebuild seems to be finished.
After system's start-up RAID volume is in auto-read-only state
and metadata is in Dirty state. Rebuild seems to be finished but it is not.
Data is inconsistent (out-of-sync).

When mdmon detects the change of sync_action from 'recover' to 'idle',
it has to check if rebuild is really finished. Appropriate test was added.
Now mdmon examines each volume's member if it is being rebuilt.

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-23 09:51:10 +10:00
NeilBrown 0a999759b5 Relax restrictions on when --add is permitted.
The restriction that --add was not allowed on a device which
looked like a recent member of an array was overly harsh.

The real requirement was to avoid using --add when the array had
failed, and the device being added might contain necessary
information which can only be incorporated by stopping and
re-assembling with --force.

So change the test to reflect the need.

Reported-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-18 14:19:49 +10:00
NeilBrown c2ecf5f61a Add --prefer option for --detail and --monitor
Both --detail and --monitor can report the names of member
devices on an array, and do so by searching /dev and finding
the shortest name that matches.

If
   --prefer=foo
is given, they will instead prefer a name that contain /foo/.
So
   mdadm --detail /dev/md0 --prefer=by-path

will list the component devices via their /dev/disk/by-path/xxx
names.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-18 11:00:07 +10:00
NeilBrown 480f356641 Raid limit of 1024 when scanning for devices.
When we can for devices using GET_DISK_INFO we currently
limit to 1024.  But some arrays can have more than this.
So raise it to 4096 and make the constant a #define.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-18 09:06:02 +10:00
Lukasz Dorau ae2416e7b6 FIX: resolve make everything compilation error
When mdadm is compiled using e.g. 'everything' option, mdassemble
compilation is broken.

Change code to enable mdassemble compilation.

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:57:15 +10:00
Adam Kwolek 4aecb54a21 FIX: Assembled second array is in read only state during reshape
When arrays using external metadata are assembled, and one of array
in container is under reshape, second array will remain in read only
state (not auto read only). It is caused by array fact that array
is frozen and mdmon doesn't has opportunity to switch array in r/w mode.

Freezing not reshaped array just after it is being assembled allows mdmon
to enable it for writing.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:38 +10:00
Adam Kwolek 58d26a2a81 FIX: Size change is possible as standalone change only
Size change is possible as standalone change only. To make sure size change
is not requested pass '-1' as size parameter.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:38 +10:00
Adam Kwolek c41e00b2e6 imsm: FIX: Component size alignment check
Put currently existing code for alignment correction in to function
imsm_component_size_aligment_check() and use it for align component size
to chunk size during volume size expansion operation.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:38 +10:00
Adam Kwolek b130333f39 imsm: Support setting max size for size change operation
Add support for setting max size for size change operation using
imsm_get_free_size() function for computing maximum available space.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:38 +10:00
Adam Kwolek 13bcac9059 imsm: Add function imsm_get_free_size()
Add function imsm_imsm_get_free_size() using part of code from function
reserve_space().

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:38 +10:00
Adam Kwolek 65a9798b58 FIX: Detect error and rollback metadata
Some setting size error cases were not detected.
When error occurs, stop setting new size action and rollback metadata
changes.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:38 +10:00
Adam Kwolek 7e7e9a4d72 FIX: Respect metadata size limitations
When reshape_super() updates metadata with new size, due to some metadata
limitations saved value can be different than requested value by user.
Update size (read it from metadata) for setting it in md.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:37 +10:00
Adam Kwolek 44f6f18113 FIX: Extend size of raid0 array
For raid0, takeover operation is required for size change.
Add takeover to degraded raid4 before size change and back to raid0 after.
Array information has to be read again from md after takeover.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:37 +10:00
Adam Kwolek fbf3d20214 imsm: FIX: Support metadata changes rollback
Add metadata rollback specific code for imsm.
Let reshape_super() ability to differentiate metadata apply and rollback
actions.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:37 +10:00
Adam Kwolek 016e00f546 FIX: Support metadata changes rollback
Function reshape_super() guards metadata changes.
It is used to apply changes rollback in error case also.
As change (apply and rollback) can be not bi-directional reshape_super()
has to know if current action is metadata change that should be guarded
using metadata restrictions, or this is metadata rollback change
executed due to error occurrence.

In second case change has to be unconditional.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:37 +10:00
Adam Kwolek 54397ed97a imsm: Execute size change for external metatdata
For external metatdata ioctl doesn't set new size. Set new size using sysfs.
Put code for size change in to function to re-use the same code as during
On-line Capacity Expansion

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:37 +10:00
Adam Kwolek f3871fdc68 imsm: Add new metadata update for volume size expansion
Add new meatdata update type imsm_update_size_change, and update metadata
for volume size expansion operation.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:37 +10:00
Adam Kwolek 7abc98717c imsm: FIX: Add volume size expand support to imsm_analyze_change()
Patch adds ability to function imsm_analyze_change() for:
1. Detect size change request for volume operation.
2. Check and correct size for change.
3. Set new change kind to CH_ARRAY_SIZE

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:37 +10:00
Adam Kwolek 36fd8ccc0e imsm: FIX: Update function imsm_num_data_members() for Raid1/10
Function imsm_num_data_members() returns wrong value for raid 1 and 10.
It returns all data member but it should return number of unique data
members (excluding mirror devices)

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:33:37 +10:00
Labun, Marcin 0e7f69a873 imsm: display maximum volumes per controller and array
Display maximum volumes per array and per controller
in --detail-platform command.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-17 12:30:50 +10:00
CoolCold 342460cb8d mdadm man page: fix typo
manpage for mdadm(8) contains typo - missing "d" at the end of "describe" word.

Signed-off-by: Roman Ovchinnikov <coolthecold@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-12 12:43:26 +10:00
Lukasz Dorau 40110b9050 Fix two typos in fprintf messages
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-10 09:16:47 +10:00
NeilBrown 508a7f16b2 super1: leave more space in front of data by default.
The kernel is growing the ability to avoid the need for a
backup file during reshape by being able to change the data offset.

For this to be useful we need plenty of free space before the
data so the data offset can be reduced.

So for v1.1 and v1.2 metadata make the default data_offset much
larger.  Aim for 128Meg, but keep a power of 2 and don't use more
than 0.1% of each device.

Don't change v1.0 as that is used when the data_offset is required to
be zero.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-04 14:04:28 +10:00
NeilBrown fbdef49811 Bitmap_offset is a signed number
As the bitmap can be before the superblock, bitmap_offset is signed.
But some of the code didn't honour that :-(

Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-04 14:03:45 +10:00
NeilBrown 15632a96f4 parse_size: distinguish between 0 and error.
It isn't sufficient to use '0' for 'error' as well will
later have fields that can validly be '0'.

So return "-1" on error.

Also fix parsing of --bitmap_check so that '0' is treated
as an error: we don't support 512B anyway.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-04 14:03:13 +10:00
NeilBrown 3556c2fafb Fix typo: wan -> want
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-04 14:02:00 +10:00
Czarnowska, Anna 027c374fd9 imsm: set 2tb disk attribute for spare
This patch ensures metadata attribute is set correctly also for spares.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-02 10:19:04 +10:00
Czarnowska, Anna 9126b9a816 check that no disk over 2TB is used to create container when no support
Creation of a container using disks over 2TB should be allowed only when orom supports large disks

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-04-02 10:18:37 +10:00