Commit Graph

82 Commits

Author SHA1 Message Date
NeilBrown 53f5035339 Fix warning about unused variable.
Warning only appears with -O2, but is invalid.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 10:29:24 +11:00
NeilBrown 097075b611 Grow: be more relaxed about timestamp mismatches on backup file.
As backup file has a timestamp which is updated quite separately
from the metadata timestamp.  They should be largely in-sync but
sometimes are not.
So be more generous in the check, and allow it to be over-ridden
by an environment variable.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-02-24 11:59:11 +11:00
NeilBrown 39bbb39202 Grow: If bitmap interferes with grow, report this.
If a bitmap exists on an array, then current kernels cannot grow
that array.
So when we try to grow an array, test for EBUSY and if a bitmap is
present, report that the bitmap needs to be removed.

Resolves-Debian-Bug: 534571
Signed-off-by: NeilBrown <neilb@suse.de>
2010-01-28 11:48:03 +11:00
NeilBrown 080fd00521 Remove stray debugging printfs
These were never supposed to be released, and due
to a type issue they cause compile problems on
some architectures.

Resolves-Debian-Bug: 567167
Signed-off-by: NeilBrown <neilb@suse.de>
2010-01-28 08:55:18 +11:00
NeilBrown f98841b385 Grow: be more careful when using array.size
As array.size is 32bit we need to prefer the 'component_size'
read from sysfs when that is available.
Grow wasn't always suitably careful.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-26 16:28:35 +11:00
NeilBrown 2ed4f75388 Grow: avoid truncation error when checking size of array.
array.size is only 32bit so it is not safe to multiply it
up before casting to (long long).
Actually, we shouldn't be using array.size here at all, but that
will get fixed in a subsequent patch.

Reported-by: Andrew Burgess <aab@cichlid.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-26 14:19:26 +11:00
NeilBrown ff94fb86fd Grow: various fixes to recent breakages.
- I forgot to write the send backup-super-block on spares.
- I wasn't adding the data_offset to an offset

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-17 13:15:33 +11:00
NeilBrown 14e5b4d72b Grow: data_offset is in sectors, offsets[] is in bytes - convert
Another missed sectors->bytes conversion.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-16 11:06:44 +11:00
NeilBrown 9ce510be9c Grow: do not allow size changes with other changes.
A change the reduces the size of an array always happens
before any other change.  So it can cause data to be lost.
By themselves these changes are reversible.  But once another
change has started, the data would be permanently lost.
So recommend data integrity be checked between a size change
and any other change.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-06 17:26:47 +11:00
NeilBrown b5ea446ae7 Grow: goto release rather than just return
otherwise we exit with the array frozen.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-06 15:22:14 +11:00
NeilBrown d2505cff5a Grow: restrict to 2.6.32
2.6.31 has a bug which can lead to unsafe reshaping.
So only allow a reshape with 2.6.32.
When the required fixed get into 2.6.31.y, this can be relaxed
slightly

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-06 15:19:39 +11:00
NeilBrown 1b13faf757 Grow: use large block count and make sure stripe cache can hold it.
The bigger the backup is, the fast it goes to some extend.

16Meg is fairly arbitrary

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-06 14:48:10 +11:00
NeilBrown e380d3be42 Grow: get component_size before using it.
We were using ->component_size while it hadn't been set.
This effectively meant that 'blocks' wasn't multiplied by
16 and reshape was even slower than it should have been.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-06 14:18:49 +11:00
NeilBrown d44453876e Grow: handle array going degraded during reshape.
If an array goes degraded during reshape, we need to
adjust the devices we read from so as not to back up
stale data.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-06 13:56:05 +11:00
NeilBrown 92dcdf7c01 Grow: restore backup to proper location.
The 'arraystart' is in sectors while restore_stripes requires
bytes, so we need a conversion.

Without this, backups get restored to the wrong offset.

Reported-by: "KueiHuan Chen" <kueihuan.chen@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2009-11-06 13:38:43 +11:00
NeilBrown 9739642288 Grow: update backup-metadata mtime every time we write it.
Originally the backup-metadata was only written once at the
start of a raid5 reshape that made the array bigger.  So we only
set the mtime once.

Now that we can be writing metadata continually during an in-place
reshape, we need to update the mtime more often.

Also, allow the metadata mtime to be slightly in advance of the
array mtime.  Normally the difference will be less than a second,
so 10 minutes should be plenty.  This guards against an old backup
file being used to restart an array.  but starting two reshapes in the
10 minutes is sufficiently unlikely, and the possibility of an
accident is already sufficiently small, that 10 minutes is probably
fine.

Thanks to Guy Martin <gmsoft@tuxicoman.be> for discovering and
reporting that .mtime wasn't being updated properly.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-22 10:42:06 +11:00
NeilBrown 24d40069d7 Grow: reject raid-disks reduction in RAID5 etc before 2.6.32
2.6.31 has some bugs with restarting a RAID5 reduction, so
refuse to try unless at least 2.6.32.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-20 16:36:03 +11:00
NeilBrown ea0ebe9685 Assemble: print more verbose messages about restarting a reshape
Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-20 16:23:45 +11:00
NeilBrown 22e305169f Add missing 'continue' in Grow_restart.
Thus we weren't checking the uuid properly.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-20 15:36:49 +11:00
NeilBrown 82f2d6abf0 Grow_restart to handle reducing number of devices in an array.
FIXME this is wrong . what direction does reshape_position move?

If the device count in an array is shrinking, the critical
region is different so the tests need to be different when
restarting.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-16 17:43:51 +11:00
NeilBrown eba7152931 Grow: don't make 'blocks' too large during in-place reshape.
On small (test) arrays, multiplying by 16 can make the 'chunk' size
larger than half the array, which is a problem.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-16 17:02:34 +11:00
NeilBrown 725cac4c56 Grow: ignore error from final wait_backup
The last time wait_backup is called, it might see reshape
finish and so return an error indicator.
But this is not an error, and we must go ahead and prepare
the array for full access.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-12 16:55:19 +11:00
NeilBrown 5fdf37e357 Grow: make sure bsb2 is properly aligned
We do O_DIRECT io in bsb2, so it must be aligned
properly.  Easiest if it is static.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-10-12 16:55:12 +11:00
NeilBrown ca4f89a3b7 Merge branch 'master' into devel-3.1
Conflicts:
	mdadm.8
2009-10-01 16:58:40 +10:00
NeilBrown e9e43ec367 Grow: support restart of new migrations. 2009-08-13 11:12:54 +10:00
NeilBrown 7236ee7ad4 Handle extra 'grow' variations.
UNFINISHED
2009-08-11 13:02:49 +10:00
NeilBrown a628848379 restripe: support saving when not all devices are present. 2009-07-14 15:12:30 +10:00
NeilBrown 5f4fc0e191 Grow: --size improvements.
1/ allow --size to be given with 'G' or 'T' suffix.
2/ allow size to exceed 32bits, and in that case write through sysfs.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-07-14 14:32:30 +10:00
NeilBrown 19678e536d Grow: pass layout as a string rather than a number.
This allows the layout to be parsed after the current level of the
array is know, so that the level doesn't need to be given (otherwise
pointlessly) on the command line.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-07-14 12:13: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 c256924e52 Merge branch 'master' of git://github.com/djbw/mdadm into devel-3.0
Conflicts:
	Grow.c
	mdadm.h
	sysfs.c
Due to independent fixes for the "mdadm hangs if reshape finishes too quickly"
problem.
2009-04-14 11:11:14 +10:00
Dan Williams 48924014b0 Grow: fix hang when reshape completes too fast
For short reshapes the kernel may be done before mdadm can check that
progress has passed the critical section.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2009-04-12 00:58:28 -07:00
NeilBrown 93ecfa01d4 grow: don't wait forever for critical section to pass.
If an array reshape completed within 1 second, then --grow will not
notice that it has finished and will keep waiting for the critical
section to pass.

So be more cautious in the test.

Signed-off-by: NeilBrown <neilb@suse.de>
2009-04-01 12:26:08 +11:00
NeilBrown 94a20f0c80 Fix alignment for backup of reshape data.
Since we introduced O_DIRECT for device access we need
properly aligned buffers and IO requests.  The reshape code
missed out on the conversion.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-08-19 17:55:15 +10:00
NeilBrown 37ea3936a6 Merge branch 'master' into from-stable
Conflicts:

	Create.c
	Manage.c
2008-08-07 14:12:25 +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 6416d5275d Use O_DIRECT for all IO to devices.
Using buffered IO risks non-atomic updates to parts of the
device that we don't actually want to write to.  This isn't in
general safe.
So switch to O_DIRECT for all that IO and make sure we have
properly aligned buffers.
2008-07-12 20:28:33 +10:00
Neil Brown 0aa389dc62 Add test for stoping and restarting a raid5 reshape.
There was a kernel bug with stopping and restarting
raid5 recently.  So add a test to check for it.
2008-06-27 16:07:52 +10: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 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 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
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 5b28bd5672 Improve error message for adding bitmap to a level that cannot support it.
Also give error on --build if no devices given.
2007-05-21 14:25:47 +10:00
Neil Brown f752781f81 Fix --grow --add for linear arrays.
The new superblock needs to have a new disk.number.  This is a bit of a hack...
Fix handling of negative bitmap offsets on 64bit hosts.

The bitmap offset is a signed 32bit number, so casting to (long)
isn't sufficient.  We must cast to (int32_t).
Fix various problems with --grow --add for linear.

The code to add a drive to a live linear array had never
been tested properly and so was buggy.  This tidies it up
and means that the new regression-test passes.
2007-05-21 14:25:37 +10:00
Neil Brown beae1dfe2e Central calls to ioctl BLKGETSIZE
Instead of opencoding the same thing everywhere.
2006-12-14 17:32:57 +11:00