Commit Graph

427 Commits

Author SHA1 Message Date
Bill Nottingham 767bd45298 Simplistig locking for --incremental.
From: Bill Nottingham <notting@redhat.com>

mdadm --incremental doesn't really do any locking. If you get multiple
events in parallel for the same device (that has not yet started), they
will all go down the path to create the array. One will succeed, the
rest will have SET_ARRAY_INFO die with -EBUSY (md: array mdX already has disks!)
and will exit without adding the disk.

Original bug report is: https://bugzilla.redhat.com/show_bug.cgi?id=433932

This is solved by adding very very rudimentary locking. Incremental() now
opens the device with O_EXCL to ensure only one invocation is frobbing the
array at once. A simple loop just tries to open 5 times a second for 5
seconds. If the array stays locked that long, you probably have bigger
issues.
2008-05-05 19:44:04 +10:00
Bill Nottingham 62552fdfcc Create /dev/md if needed and it doesn't exist.
From: Bill Nottingham <notting@redhat.com>
2008-05-05 19:44:01 +10:00
Neil Brown 02b76eeace Fix RAID acronym in man page.
The 'D' in 'RAID' stands for 'DISKS' even it md supports other 'devices'.
2008-05-05 19:43:58 +10:00
Neil Brown 25b05c515e Add a .gitignore file. 2008-04-29 17:14:01 +10:00
Neil Brown e43d0cda22 Use .\" instead of '''
Debian bug 477273
2008-04-29 17:13:59 +10:00
Neil Brown c2c9bb6fe0 diff -ru mdadm-2.6.4-orig/Query.c mdadm-2.6.4/Query.c 2008-04-29 17:13:55 +10:00
Neil Brown 519561f73f Fix possible bug with bitmap space allocation with v1.0 metadata
When adding a device to an array, make sure we don't reserve
so much space for the bitmap that there isn't room for the data.
2008-04-29 17:13:53 +10:00
Neil Brown 5f98d3cbd9 Small improvements to --incremental for arrays that are in the middle of reshape
There is still a problem:  If array is partially assembled and started
read-only, the last device doesn't get added properly.  Probably a kernel
problem.
2008-04-28 16:30:31 +10:00
Neil Brown 6fb79233b0 Allow creation of a RAID6 with a single missing device.
This did not work before as we couldn't mark it clean as there would
be some parity blocks out of sync, and raid6 will not assemble a
dirty degraded array.
So make such arrays doubly degraded (the last device becomes a spare)
and clean.
2008-04-28 16:30:09 +10:00
Neil Brown 3cdfb6a712 Updates some URLs in the man page.
Particularly, add the wiki on osdl.org
2008-04-28 16:29:53 +10:00
Neil Brown 1486e43fec Print 'Events' more sensibly.
Instead of MSW.LSW, just print it as a 64bit number.
2008-04-28 16:29:45 +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 2cdb64897d Fix for segfault when reading /proc/mdstat
Some kernel versions don't put a space between 'active' and '(auto-read-only)'
in /proc/mdstat.  This causes a parsing problem leaving 'level' set to
NULL which causes a crash.

So synthesise a space there if it is missing, and check for 'level' to
be NULL and don't de-ref if it is.
2008-04-28 16:29:12 +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 7e0f69790c Replace sysarray with mdinfo
Sure, mdinfo is bigger, but having a uniform structure for lots of things
will make life easier.
2007-12-14 20:14:59 +11:00
Neil Brown 06c7f68e40 Use 'mdinfo' instead of special 'sysdev' structure.
there is needless duplicatiion between mdinfo and sysdev, so discard
the latter.
2007-12-14 20:14:57 +11:00
Neil Brown 213ee40bd2 Some tidy up of 'devices' in assemble.
use "mdinfo" in the devices list rather than just copying
ad-hoc fields in.
2007-12-14 20:14:53 +11:00
Neil Brown 61255666e2 Don't record oldmajor/oldminor any more during assemble.
We don't use the information at all (any longer).
2007-12-14 20:14:44 +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 64557c3391 Fix compare_super to take supertype instead of a superblock.
As this function takes 2 superblocks, the change is a bit more subtle,
so is done separately.
2007-12-14 20:14:27 +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 2faf1f5f63 Make sure sysfs_read never succeeds for a non-MD device.
... just in case.
2007-12-14 20:13:51 +11:00
Neil Brown aba69144fd Remove spaces/tabs from ends of lines. 2007-12-14 20:13:43 +11:00
Neil Brown 08e43379e5 A recent patch broke --create --level=faulty - fix it.
Thanks to Martin Bene.
2007-11-29 14:40:01 +11:00
Neil Brown 7615d98913 Add metadata version information to "--detail --brief" output. 2007-11-13 09:55:29 +11:00
Neil Brown 6a0671608b Release 2.6.4 2007-10-19 14:13:04 +10:00
Neil Brown 25037aa872 Remove partitions from a device before adding it to an array.
The 'remove_partitions' call is in the wrong place and applying
to the wrong file.
2007-10-19 14:03:17 +10:00
Neil Brown 570510ba32 Add some extra consistency checks based on level.
Also use LEVEL_LINEAR, LEVEL_MULTIPATH in place of -1 or -4 in a few places.
2007-10-17 13:08:12 +10:00
Neil Brown 5cda096425 Clarify the avail/used devices sizes with version1 superblock.
Not all of the device may be available.  Of that, not all may be used
(if devices are of different sizes).
2007-10-17 10:28:38 +10:00
Neil Brown dc2ee6b3e3 Make sure --auto=mdp is honoured properly
This would only create partitioned devices if the device name was a
'standard' name.  This this patch, any name will work.
2007-10-17 10:00:55 +10:00
Neil Brown 6e9eac4f08 Fix restarting of a reshaping array.
The last release broke the ability to assemble an array that
was in the middle of a reshape.
This patch adds code to test if the critical section needs
to be restored or not so that - if we have failed to restore it,
we know whether to fail or not.
2007-10-16 13:52:35 +10:00
Jérémy Bobbio cc4c7f14b1 Also use &tst instead of st later on when loading v1 superblocks 2007-10-01 09:17:06 +01:00
martin f. krafft cf3370c7a7 Fix segfault on assembly on amd64 with v1 superblocks
Commit a40b4fe introduced a temporary supertype variable tst, instead of
manipulating st directly. However, it was forgotton to pass &tst into the
recursive load_super1 call, causing an infinite recursion.

Signed-off-by: martin f. krafft <madduck@debian.org>
2007-09-30 13:28:56 +01:00
maximilian attems 4450e59ffa Monitor.c s/MAXINT/INT_MAX/g
include limits.h directly instead of values.h

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Neil Brown <neilb@suse.de>
2007-09-27 10:08:30 +10:00
maximilian attems b440882edf mdopen.c don't shadow major() and minor()
s/(major|minor)/\1_num/

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Neil Brown <neilb@suse.de>
2007-09-27 10:08:30 +10:00
maximilian attems 98127a6d4d Monitor.c include signal.h directly
another small step for better klibc support, glibc compile tested.

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Neil Brown <neilb@suse.de>
2007-09-27 10:08:30 +10:00
Neil Brown a039409b1a Add ANNOUNCE-2.6.1 to git
Somehow this missed out of getting into .git even though it is in all
tha tar-balls.
2007-09-24 14:40:23 +10:00
Neil Brown 23dc1ae877 Don't corrupt 'supertype' when speculatively calling load_super1
When load_super1 is trying to see which sub-version of v1 superblock
is present, failure will cause it to clear st->ss, which is not good.

So use a temporary 'super_type' for the 'test if this version works'
calls, then copy that into 'st' on success.
2007-09-24 14:26:44 +10:00
maximilian attems ff7f2ebbe9 config.c include dirent.h instead sys/dir.h
sys/dir.h is an old BSD'ism, include dirent directly.
small step for better klibc support.

compile tested against glibc.

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Neil Brown <neilb@suse.de>
2007-09-24 13:21:38 +10:00
maximilian attems 943eafefca Create.c s/major/major_num/
don't shadow the major() function by int major.

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Neil Brown <neilb@suse.de>
2007-09-24 13:21:38 +10:00
maximilian attems e39b673e48 Add klibc support to mdadm.h
klibc still misses a lot functionality to let mdadm link against,
this small step helps to get to the real trouble.. :)

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Neil Brown <neilb@suse.de>
2007-09-24 13:21:38 +10:00
Neil Brown 4d20d744cb Make "--write-mostly" effective when re-adding a device to an array.
Fixes Debian Bug 442874

When we discover that we can 're-add' a drive, we forget to check the
write-mostly flag.
This highlights the fact that you cannot turn 'off' the write-mostly
flag at this point.  I wonder if that is a problem...
2007-09-24 13:14:13 +10:00
Iustin Pop 3dacb89029 Explain the read-balancing algorithm for RAID1 better in md.4
From: Iustin Pop <iusty@k1024.org>

There are many questions on the mailing list about the RAID1 read
performance profile. This patch adds a new paragraph to the RAID1
section in md.4 that details what kind of speed-up one should expect
from RAID1.

Signed-off-by: Iustin Pop <iusty@k1024.org>
2007-09-11 16:20:19 +02:00
Neil Brown e5bddffd35 Release 2.6.3 2007-08-20 14:22:15 +10:00
Neil Brown e1584dd2c7 Update changelog 2007-08-20 14:14:46 +10:00
Neil Brown 2295250a73 Report error when grow cannot be restarted.
Make sure that if --assemble find an array in the critical region
of a reshape, and cannot find the critical data to restart the
reshape, it gives an error message.
2007-08-20 14:14:42 +10:00
Neil Brown eb6dae9850 Fix error message when adding a device that is too small.
We were multiplying MD_RESERVED_SECTORS by 1024 instead of 512,
so lots of 'is it too small' checks were wrong.
2007-08-20 14:14:28 +10:00
Neil Brown 005debfc11 Fix problem with add a device to a 1.x array created with older mdadm.
When adding new disk to an array, don't reserve so much bitmap
space that the disk cannot store the required data. (Needed when
1.x array was created with older mdadm).
2007-08-20 14:14:25 +10:00