Commit Graph

1328 Commits

Author SHA1 Message Date
Dan Williams 4f0a7acc9a mdmon: record sync_completed directly to the metadata
When sync_action is idle mdmon takes the latest value of md/resync_start
or md/<dev>/recovery_start to record the resync/rebuild checkpoint in
the metadata.  However, now that mdmon is reading sync_completed there
is no longer a need to wait for, or force an idle event to take a
checkpoint.

Simply update the forward progress of ->last_checkpoint at every wakeup
event and force it to be recorded at least every 1/16th array-size
interval.  It may be recorded more frequently if a ->set_array_state()
event occurs.

This also cleans up some confusion in handling the dual-rebuild case.
If more than one spare has been activated the kernel starts the rebuild
at the lowest recovery offset, so we do not need to worry about
min_recovery_start().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-06-15 18:41:57 -07:00
Dan Williams 0d80bb2f97 imsm: dump each disk's view of the slot state
Allow --examine to determine which disk might have a stale view of the
per-disk out-of-sync state.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-06-15 18:41:57 -07:00
Dave Jiang 0bd16cf217 create: Check with OROM limit before setting default chunk size
Make create check with the appropriate meta data handler and see what the
largest chunk size is supported. The current 512K default is not supported
by existing imsm OROM.

[dan.j.williams@intel.com: trim the upper limit to 512k for future oroms]
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-06-15 18:41:53 -07:00
Dan Williams 33414a0182 Kill subarray v2
Support for deleting a subarray out of a container.  When all subarrays
are deleted the component devices are converted back into spares, a
--zero-superblock is still needed to kill the remaining metadata at this
point.  This operation is blocked when the subarray is active and may
also be blocked by the metadata handler when deleting the subarray might
change the uuid of other active subarrays.  For example, with imsm,
deleting subarray 'n' may change the uuid of subarrays with indexes > n.

Deleting a subarray needs to be a container wide event to ensure
disks that record the modified subarray list perceive other disks that
did not receive this change as out of date.

Notes:
The st->subarray parsing in super-intel.c and super-ddf.c is updated to
be more strict now that we are reading user supplied subarray values.

Offline container modification shares actions that mdmon typically
handles so promote is_container_member() and version_to_superswitch()
(formerly find_metadata_methods()) to generic utility functions for the
cases where mdadm performs the operation.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-06-15 17:55:41 -07:00
NeilBrown 0017a23753 mdadm.conf: fix AUTO typo
Reported-by: Marc Schiffbauer <marc@schiffbauer.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-06-05 08:02:11 +10:00
NeilBrown fd547b508c Fix man page reference to --level changes with --grow.
--level can be used with --grow now, so correct man page.

Reported-by:  "Leslie Rhorer" <lrhorer@satx.rr.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-05-31 12:52:37 +10:00
martin f. krafft 26f467a954 Compile-time switch to enable 0.9 metadata as default
This commit introduces DEFAULT_OLD_METADATA as a preprocessor
definition. If defined, it causes mdadm to assume metadata version 0.9
as default. If not defined, version 1.x (currently 1.2) is used as
default.

The man page mdadm.8 is also modified to reflect the chosen default.

The selftests will not work if the old default is chosen.

This patch was requested by Debian so they could distribute a current
mdadm together with boot loaders that only understand 0.90 metadata
for md-raid.

Preferred usage is simply
   make DEFAULT_OLD_METADATA=yes


Signed-off-by: martin f. krafft <madduck@debian.org>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-05-31 12:52:37 +10:00
NeilBrown 5082750467 Revert change to handling of -empty-string- metadata.
If the metadata is an empty string, it means the array in question
does not use metadata.  This comes from sysfs_read finding "none" in
"metadata_version", then super_by_fd noticing the vers == -1, and so
just using the ->text_version (which is empty).

In this case we want to use the super0 metadata handler routines
because that is what we always used to do before

 commit 7d5c3964cc

And that commit was wrong because "" doesn't mean "default" and so
should not have been changed at the same time.

Reported-by: martin f. krafft <madduck@debian.org>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-05-31 12:08:02 +10:00
NeilBrown d492df0307 Merge commit '3288b419b988b20a53a2b12eb8e5f9f536228db4'; commit '4363fd80bcc9f85ed824228dee5e6350a8d73e18'; commit '63b4aae33ebf00d443378daf313622630f2336c0'
* commit '3288b419b988b20a53a2b12eb8e5f9f536228db4':
  Revert "Incremental: honor --no-degraded to delay assembly"
  Incremental: honor an 'enough' flag from external handlers

* commit '4363fd80bcc9f85ed824228dee5e6350a8d73e18':
  imsm: robustify recovery-start detection
  fix: memory leak in mdmon_pid()

* commit '63b4aae33ebf00d443378daf313622630f2336c0':
  mdmon: fix missing open of md/<dev>/recovery_start
2010-05-31 11:34:14 +10:00
Dan Williams 4363fd80bc imsm: robustify recovery-start detection
update_recovery_start() assumed that the out-of-sync disk would always be
marked as IMSM_ORD_REBUILD in the disk_ord_tbl, but the segmentation
fault reported by Andy proves otherwise.  This might also be explained by
an interrupted rebuild and the disk has not yet been marked missing.

https://bugzilla.redhat.com/show_bug.cgi?id=592030

Reported-by: Andy Lutomirski <luto@mit.edu>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-05-26 13:33:43 -07:00
Dan Williams 3288b419b9 Revert "Incremental: honor --no-degraded to delay assembly"
This reverts commit fdb482f99b.

Now that containers can report state for ->container_enough we can
automatically determine when the array can be started, and no longer
need the --no-degraded hammer.

Conflicts:

	Incremental.c

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-05-26 13:25:47 -07:00
Dan Williams 97b4d0e971 Incremental: honor an 'enough' flag from external handlers
This is needed for imsm where:
1/ we want to report raid_disks as zero to allow mdadm -As to
   incorporate all spares
2/ we can't determine stale disks by looking at the event counts.
3/ we can't see per-subarray expectations with the info returned from
   the container level ->getinfo_super()

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-05-26 13:22:36 -07:00
NeilBrown 4460f8f7c3 Monitor: don't report the disappearance of a faulty device as SpareActive.
Normally Monitor doesn't see faulty devices in active slots - they get
moved away too quickly.
But if it does, it reports the "faulty device disappeared" event (when
it finally does get moved away) as SpareActive due to insufficient
checking.

So add a better check.

Reported-by:  Pierre Vignéras <pierre@vigneras.name>
2010-05-18 12:31:29 +10:00
NeilBrown c03ef02d92 Grow: move error message closer to error cause.
A recent change move the sysfs_read call away from the check that it
succeeded.  This patch moves the check back next to the sysfs_read
call.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-05-18 12:29:28 +10:00
Przemyslaw Hawrylewicz Czarnowski 10013317ce fix: memory leak in mdmon_pid()
devnum2devname() returns pointer to memory allocated with strdup.
It must be released to prevent memory leak.

Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-05-17 15:38:34 -07:00
Dan Williams 484240d8a3 mdmon: periodically checkpoint recovery
The kernel updates and notifies md/sync_completed when it is time to
take a checkpoint.  When this occurs (at 1/16 array size intervals)
write 'idle' to md/sync_action to have the current recovery position
updated in recovery_start and resync_start.

Requires the metadata handler to reset ->last_checkpoint when it has
determined that recovery has ended.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-05-14 17:42:49 -07:00
Dan Williams 63b4aae33e mdmon: fix missing open of md/<dev>/recovery_start
When activating a spare we neglect to open recovery_start and as such do
not see checkpoint events.  Move disk initialization to common routine
to mitigate recurrence.

Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-04-29 10:50:29 -07:00
NeilBrown 200871adf9 Grow: avoid overflow of chunk sizes.
Chunks aren't particularly big, but when you could them in bytes
and multiply them together (as we do for calculating the backup
size for 'grow') they can overflow a 32bit int.

So group the division by 512 more closely with the
chunk size so were would need 30Meg chunks to come close to
overflowing 32bits.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-04-29 16:14:30 +10:00
NeilBrown 691c6ee1b6 IMSM/DDF: don't recognised these metadata on partitions.
These metadata are not expected on partitions, and they have
no way of differentiation whether which is correct if they
are found both on the device and on the last partition.

So if the device is a partition, refuse to read the metadata.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-04-29 16:09:59 +10:00
Dan Williams 4eb269706f Create: cleanup after failed create in duplicated array member case
mdadm prevents creation when device names are duplicated on the command
line, but leaves the partially created array intact.  Detect this case
in the error code from add_to_super() and cleanup the partially created
array.  The imsm handler is updated to report this conflict in
add_to_super_imsm_volume().

Note that since neither mdmon, nor userspace for that matter, ever saw an
active array we only need to perform a subset of the cleanup actions.
So call ioctl(STOP_ARRAY) directly and arrange for Create() to cleanup
the map file rather than calling Manage_runstop().

Reported-by: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-04-19 15:28:07 +10:00
Dan Williams c824e91898 Fixup default definitions of VAR_RUN and ALT_RUN
I suspect commit c132678b wanted VAR_RUN and ALT_RUN to be suffixed by
'/mdadm' to match the defaults in mdadm.h.

Cc: Luca Berra <bluca@comedia.it>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-04-15 15:29:49 +10:00
Doug Ledford 94fcb80a8e powerpc compile fix
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-04-07 09:19:42 +10:00
NeilBrown ebeb366382 Don't attempt to create or read bitmaps where the metadata doesn't support it.
In particular, if the relevant bitmap method is NULL, don't try to
call it, print an error instead.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-04-07 09:18:01 +10:00
NeilBrown 9b0502b879 Merge branch 'HEAD'; commit 'a4b93c9ce4f15217afb8' 2010-04-07 09:17:13 +10:00
NeilBrown a4b93c9ce4 Add ANNOUNCE-3.1.2
Forgot to git-add this for the release :-(

Signed-off-by: NeilBrown <neil@suse.de>
2010-04-07 09:13:16 +10:00
Doug Ledford 7bf59f5c16 Only signal a udev change event if we actually write a mapfile in RebuildMap
Signed-off-by: Doug Ledford <dledford@redhat.com>
2010-03-24 09:37:39 +11:00
Doug Ledford e259df4e63 mapfile: if we putting the mapfile in a custom location via ALT_RUN, allow
a custom filename too.

Signed-off-by: Doug Ledford <dledford@redhat.com>
2010-03-24 09:37:34 +11:00
Doug Ledford 435b90e7d4 Create directory to contain mapfile (Assuming parent exists and
filesystem is writable).
This particularly keeps udev happy if VAR_RUN is set to /dev/md.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-24 09:07:03 +11:00
NeilBrown 86983cce34 2010-03-24 09:07:02 +11:00
NeilBrown a31c140f13 Release mdadm-3.1.2 2010-03-10 15:58:46 +11:00
NeilBrown ebe6ea0c4c tests: adjust sizes for new defaults
Default metadata type is now 1.2, and we sometimes
add extra alignment before the data section,
so adjust tests for these changes.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-10 15:56:01 +11:00
NeilBrown d682f3445c ddf/intel: zero out old metadata before creating a container.
Matching the functionality already in super0 and super1, when
we first create a container, remove any other recognisable metadata to
ensure it doesn't cause confusion.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-10 15:55:47 +11:00
NeilBrown a847575aa1 Grow: fix recent breakage - lseek return status.
Recent fix to check lseek64 return status got it badly wrong.
It doesn't return 0 on success!!

Fix it.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-10 15:21:28 +11:00
NeilBrown 1ff9833928 Assemble: fix some recently introduced bugs.
Found during testing:
 - cannot check metadata for homehost before loading metadata.
 - As 1.x metadata can has a state 'rebuilding' between
   'spare' and 'ok', we need to include that in our calculations.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-10 11:21:40 +11:00
NeilBrown c147484252 Merge branch 'master' of git://github.com/djbw/mdadm 2010-03-10 07:54:03 +11:00
NeilBrown 430ea469ad Stop: done stop a container which still have members active.
Doing that is just confusing...

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-09 16:32:04 +11:00
NeilBrown 624c5ad4cb Make sure reshape_active is cleared by getinfo_super
There were cases where --detail would report phantom reshapes.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-09 16:15:29 +11:00
NeilBrown ecdbb368f8 mdmon.8: minor manpage update
Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-09 14:34:03 +11:00
NeilBrown c64ba03ae7 mdadm.8: improve hosthost documentation
Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-09 14:22:39 +11:00
NeilBrown be1cabbd29 Grow: fix problem with validating chunk size
When checking if the new chunk size fit in the component size
we were confusing sectors and K, and so getting it wrong.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-09 14:14:39 +11:00
NeilBrown 056b331efe Improve partition table code.
Code to check partition tables used some needless casts
and was broken, using a u8 when a u32 was wanted.

So create structure describing the tables rather than using offset,
and read into those tables instead.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-09 10:57:57 +11:00
Ryo Fujita 10adfe9ae7 mdadm.8: correct typo: pairty
Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-08 15:47:33 +11:00
Dan Williams 49133e5782 imsm: kill ->creating_imsm flag
It is an unused holdover from long since removed functionality.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-03-03 00:03:04 -07:00
Dan Williams 32ba9157f5 Revert "Make the IMSM_DEVNAME_AS_SERIAL option work when creating containers."
This reverts commit 9ef5dbff4a as it is
duplicating the check that is done internal to imsm_read_serial().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2010-03-03 00:03:04 -07:00
NeilBrown a380e2751e super1: encourage data alignment on 1Meg boundary
For 1.1 and 1.2 metadata where data_offset is not zero,
it is important to align the data_offset to underlying
block size.

We don't currently have access to the particular device
in avail_size so just try to force to a 1Meg boundary.

Also default 1.x metadata to 1.2 as documented.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 15:22:56 +11:00
NeilBrown d1d3482b56 config: add 'homehost' option to 'AUTO' line.
This allows basing auto-assembly decisions on whether
the array is recorded as belonging to this host or not.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 14:33:55 +11:00
NeilBrown 5a9de8db04 Manage: fix regression on removing detached devices.
If /dev is static, a name may remain there after the
device has been detached from the system.
Using 'mdadm' to remove such a device from the array
should still work (even though "mdadm --remove detached"
might be preferred).

So when processing a device for '-r', don't insist on
being able to open the device.

Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 13:16:24 +11:00
Luca Berra c132678b18 allow redefinition of VAR_RUN
having mdmon socket under var is painful at shutdown time

Signed-off-by: Luca Berra <bluca@comedia.it>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 12:23:30 +11:00
NeilBrown 32f217017f mdmon: Check both RUN directories to find running mdmon
If mdmon is run without "--takeover", it should still
check both *_RUN directories for a valid 'pid' file
to guard against having two mdmons running at the same time.


Suggested-by: Luca Berra <bluca@comedia.it>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 12:07:18 +11:00
Luca Berra ed8fa52f31 mdmon: check select a writable pid_dir
Check that either VAR_DIR or ALT_DIR is actually writable before
selecting it.

Signed-off-by: Luca Berra <bluca@comedia.it>
Signed-off-by: NeilBrown <neilb@suse.de>
2010-03-03 11:54:47 +11:00