Commit Graph

103 Commits

Author SHA1 Message Date
Pawel Jakub Dawidek
501250ba60 Now, that we have gjournal in the tree add possibility to configure
gmirror and graid3 in a way that it is not resynchronized after a
power failure or system crash.
It is safe when gjournal is running on top of gmirror/graid3.
2006-11-01 22:51:49 +00:00
Pawel Jakub Dawidek
42461fba65 Implement BIO_FLUSH handling by simply passing it down to the components.
Sponsored by:	home.pl
2006-10-31 21:23:51 +00:00
Pawel Jakub Dawidek
8e007c52fd Fix synchronization in gmirror and graid3 which I broken. Synchronization
request can still have bio_to set to sc_provider (this is READ part of a
synchronization request) and in this case g_{mirror,raid3}_sync() wasn't
called as it should be.

MFC after:	1 week
2006-09-13 15:46:49 +00:00
John-Mark Gurney
0cca572e64 move created/detected/activated under debug level 1 to quiet the common case..
add count of active and total components to the launched line so you can
see at a glance if your mirror/raid3 is complete...

now:
GEOM_MIRROR: Device mirror/sam launched (2/2).

Reviewed by:	pjd
2006-09-09 21:45:37 +00:00
Pawel Jakub Dawidek
de6f1c7c6c Not only a request from us can be passed to g_{mirror,raid3}_worker()
function, but also a request to us, in which case checking bio_cflags
is wrong, because the class above us is controling it, not we.

MFC after:	1 week
2006-08-09 09:41:53 +00:00
Yaroslav Tykhiy
776fc0e90e Commit the results of the typo hunt by Darren Pilgrim.
This change affects documentation and comments only,
no real code involved.

PR:		misc/101245
Submitted by:	Darren Pilgrim <darren pilgrim bitfreak org>
Tested by:	md5(1)
MFC after:	1 week
2006-08-04 07:56:35 +00:00
Pawel Jakub Dawidek
3c57a41d7b Don't use f-word in comments. We are gentlemans.
Pointed out by:	Maciej Sobczak
2006-08-01 23:17:33 +00:00
Pawel Jakub Dawidek
86ed3c25e1 Always allow to specify components with /dev/ prefix.
MFC after:	3 days
2006-07-13 20:37:59 +00:00
Pawel Jakub Dawidek
3525bb6b98 Use proper defines instead of magic values.
MFC after:	1 week
2006-07-10 21:18:00 +00:00
Pawel Jakub Dawidek
1f7fec3cb5 Allow to close access even if device is already destroyed.
Reported by:	Ulrich Spoerlein <uspoerlein@gmail.com>
PR:		kern/98093
MFC after:	1 week
2006-07-03 10:32:38 +00:00
Pawel Jakub Dawidek
a2fe5c6676 - Remove dead code.
- Comment possible event miss, which isn't critical, but probably can be
  fixed by replacing the event lock usage with the queue lock.

MFC after:	2 weeks
2006-04-28 12:13:49 +00:00
Pawel Jakub Dawidek
a063667622 Be sure to not destroy device twice. This is not possible in theory, but
with this change there is even no theoretical race.

MFC after:	2 weeks
2006-04-28 11:47:28 +00:00
Pawel Jakub Dawidek
712fe9bd7a Introduce and use delayed-destruction functionality from a pre-sync hook,
which means that devices will be destroyed on last close.

This fixes destruction order problems when, eg. RAID3 array is build on
top of RAID1 arrays.

Requested, reviewed and tested by:	ru
MFC after:	2 weeks
2006-04-10 10:32:22 +00:00
Pawel Jakub Dawidek
2e128ca835 - 'ndisks' variable is not boolean, so compare it with a value.
- Keep conditions order consistent with the comment above.

MFC after:	3 days
2006-03-30 12:15:41 +00:00
Pawel Jakub Dawidek
9bfdf5987d Update copyright for 2006. 2006-03-19 12:55:51 +00:00
Pawel Jakub Dawidek
18d370acae kern.geom.mirror.sync_requests=2 seems to be a better default - it still
keeps disks very busy, but makes system much more responsive.

While here, kill extra space.
2006-03-19 10:49:05 +00:00
Ruslan Ermilov
ef25813de6 Fix build on 64-bit platforms. 2006-03-13 14:48:45 +00:00
Pawel Jakub Dawidek
855761d5db - Speed up synchronization process by using configurable number of I/O
requests in parallel.
  + Add kern.geom.mirror.sync_requests tunable which defines how many parallel
    I/O requests should be used.
  + Retire kern.geom.mirror.reqs_per_sync and kern.geom.mirror.syncs_per_sec
    sysctls.
- Fix race between regular and synchronization requests.
- Reimplement mirror's data synchronization - do not use the topology lock
  for this purpose, as it may case deadlocks.
- Stop synchronization from pre-sync hook.
- Fix some other minor issues.

MFC after:	3 days
2006-03-13 00:58:41 +00:00
Pawel Jakub Dawidek
9d793bdd46 When inserting a new component md_provsize metadata field wasn't set, which
means that old problem was triggered (when two providers end at the same
offset, eg. ad0 and ad0s1 and the wrong was is picked up by gmirror/graid3).

Reported by:	Michal Suszko <dry@dry.pl>
MFC after:	3 days
2006-03-10 07:41:31 +00:00
Pawel Jakub Dawidek
4686187543 Allow to dump kernel to gmirror providers.
Some conditions have to be met to make it work properly. This will be
described in the manual page.

MFC after:	3 days
2006-03-08 08:27:33 +00:00
Pawel Jakub Dawidek
bf31327cca On component state change to ACTIVE don't forget to update metadata.
MFC after:	3 days
2006-02-12 17:38:09 +00:00
Pawel Jakub Dawidek
01f1f41c25 Use time_uptime instead of time_second, as the latter may go backwards.
Suggested by:	ru
MFC after:	3 days
2006-02-12 17:36:09 +00:00
Pawel Jakub Dawidek
d4b0268a24 - Add kern.geom.mirror.disconnect_on_failure sysctl/tunnable (default to 1
to preserve currect behaviour). When set to 0, components are not
  disconnected - gmirror will try to still use them (only first error will
  be logged). This is helpful when we have two broken components, but in
  different places, so actually all data is available.
  Such buggy component will be visible in 'gmirror list' output with flag
  BROKEN.
- Never disconnect the last valid component. If we detect errors there we
  will just pass them up. This wasn't reasonable to deny access to the
  whole provider because of one broken sector.

Prodded by:	ru
MFC after:	3 days
2006-02-11 17:39:29 +00:00
Pawel Jakub Dawidek
fe6f94ea84 Mark array as CLEAN when there are no write requests in
kern.geom.mirror.idletime seconds. Write, not any requests.
Mark array as clean immediatelly on last write close.

Prodded by:	ru
MFC after:	3 days
2006-02-11 14:42:23 +00:00
Pawel Jakub Dawidek
38ea96ac99 Remove trailing spaces. 2006-02-01 12:06:01 +00:00
Pawel Jakub Dawidek
a49c0bd40a Remove dead code.
Found by:	Coverity Prevent(tm)
Coverity ID:	CID104
MFC after:	3 days
2006-01-18 21:42:19 +00:00
Maxim Sobolev
8a4a44b5aa Check for g_read_data(9) errors properly:
o The only indication of error condition is NULL value returned by
  the function;

o value pointed to by error argument is undefined in the case when
  operation completes successfully.

Discussed with: phk
2005-11-30 19:24:51 +00:00
Robert Watson
5bb84bc84b Normalize a significant number of kernel malloc type names:
- Prefer '_' to ' ', as it results in more easily parsed results in
  memory monitoring tools such as vmstat.

- Remove punctuation that is incompatible with using memory type names
  as file names, such as '/' characters.

- Disambiguate some collisions by adding subsystem prefixes to some
  memory types.

- Generally prefer lower case to upper case.

- If the same type is defined in multiple architecture directories,
  attempt to use the same name in additional cases.

Not all instances were caught in this change, so more work is required to
finish this conversion.  Similar changes are required for UMA zone names.
2005-10-31 15:41:29 +00:00
Pawel Jakub Dawidek
59ddf345d5 After provider creation!! 2005-05-25 15:54:17 +00:00
Pawel Jakub Dawidek
0f2bbe5ba4 - Call root_mount_rel() when provider IS created, not earlier.
This should close the race observed by Daniel Eriksson.
- Remove redundant wakeup().
2005-05-25 13:10:04 +00:00
Pawel Jakub Dawidek
4eafb037f6 Add some debug code to diagnose root-on-mirror problems with recent -current.
Reported by:	Daniel Eriksson
2005-05-23 13:05:07 +00:00
Pawel Jakub Dawidek
862f5624ea Add KASSERT() to be sure there is an active component.
Suggested by:	Coverity Prevent analysis tool
2005-05-11 18:13:51 +00:00
Pawel Jakub Dawidek
3865ca2e13 Fix provider's size check for 'insert' command.
Before this fix one was able to insert one sector too small provider.

MFC after:	3 days
2005-04-25 10:41:26 +00:00
Pawel Jakub Dawidek
7979b3683c Remove the hack which allowed to use gmirror for root file system,
use root_mount KPI instead.
2005-04-19 21:47:25 +00:00
Pawel Jakub Dawidek
c2ca10933d Make the code more obvious - when an error occurs in g_mirror_connect_disk(),
detach and destroy consumer before returning.
2005-03-26 17:23:01 +00:00
Pawel Jakub Dawidek
cc6aa917b9 Check for return values.
Submitted by:	sam
Found by:	Coverity Prevent analysis tool
2005-03-26 16:51:19 +00:00
Pawel Jakub Dawidek
e68909854c - Add md_provsize field to metadata, which will help with
shared-last-sector problem.
  After this change, even if there is more than one provider with the same
  last sector, the proper one will be chosen based on its size.
  It still doesn't fix the 'c' partition problem (when da0s1 can be confused
  with da0s1c) and situation when 'a' partition starts at offset 0
  (then da0s1a can be confused with da0s1 and da0s1c). One can use '-h'
  option there, when creating device or avoid sharing last sector.
  Actually, when providers share the same last sector and their size is equal,
  they provide exactly the same data, so the name (da0s1, da0s1a, da0s1c)
  isn't important at all.
- Provide backward compatibility.
- Update copyright's year.

MFC after:	1 week
2005-02-27 23:07:47 +00:00
Pawel Jakub Dawidek
0218292cdf Update copyright in files changed this year. 2005-02-16 22:14:52 +00:00
Pawel Jakub Dawidek
437566858a Increase default synchronization speed.
MFC after: 3 days
2005-01-09 14:43:39 +00:00
Pawel Jakub Dawidek
da84416791 Spoiling is now not possible, because we keep consumers open for writing
all the time. Remove unused code then.

MFC after:	4 days
2005-01-04 12:11:49 +00:00
Pawel Jakub Dawidek
fd6d312082 Fix 'rebuild' command (we ignore retaste event now, so don't relay on it). 2005-01-03 19:42:37 +00:00
John Baldwin
63710c4d35 Stop explicitly touching td_base_pri outside of the scheduler and simply
set a thread's priority via sched_prio() when that is the desired action.
The schedulers will start managing td_base_pri internally shortly.
2004-12-30 20:29:58 +00:00
Pawel Jakub Dawidek
538ff5ee7a Update disk->d_genid field when increasing sc->sc_genid. 2004-12-23 21:15:15 +00:00
Pawel Jakub Dawidek
9a9f504132 - Add genid field to the metadata which will allow to improve reliability a bit.
After this change, when component is disconnected because of an I/O error,
  it will not be connected and synchronized automatically, it will be logged
  as broken and skipped. Autosynchronization can occur, when component is
  disconnected (on orphan event) and connected again - there were no I/O
  error, so there is no need to not connected the component, but when there were
  writes while it wasn't connected, it will be synchronized.
  This fix cases, when component is disconnected because of I/O error and can be
  connected again and again.
- Bump version number.
- Add version change history.
- Implement backward compatibility mechanism. After this change when metadata in
  old version is detected, it is automatically upgraded to the new (current)
  version.
2004-12-22 23:09:32 +00:00
Pawel Jakub Dawidek
4485f00081 Now, when force device destruction is done on shutdown, hide warning,
that device cannot be destroyed immediately, under debug=1.

Suggested by:	simon
2004-12-21 19:50:18 +00:00
Pawel Jakub Dawidek
f663832b75 This should not be permitted, but some GEOM classes held the topology lock
while doing g_(read|write)_data() (e.g. BSD). This can cause a deadlock
in MIRROR class. Not sure if this is safe to drop the topology lock in BSD
class, so change the code in MIRROR class to avoid this deadlock.
2004-12-21 18:42:51 +00:00
Pawel Jakub Dawidek
dc7d54e7b3 Remove unused variables. 2004-12-19 23:55:49 +00:00
Pawel Jakub Dawidek
a2a7b44de0 - Argument 'flags' in g_mirror_destroy_consumer() function is unsed -
mark it as such.
- Before closing consumer check if it is open. It can be closed here
  when g_mirror_connect_disk() fails on g_access().
2004-12-19 23:33:59 +00:00
Pawel Jakub Dawidek
9eec299fab Some major cleanups.
Keeping consumers open when device is closed is very hard. We need to
open consumers sometimes to update metadata, etc.
Many hacks was introduced in the past to made it possible. You cannot
be sure that you can open consumer for writing always, even if you think
it should be allowed. If one of the mirror components is for example da0
and you try to open it, you can get EPERM when da0s1 is opened for reading
(because BSD class opens consumers (da0) with an extra 'e' bit set).
Waiting for the events queue to be empty may do the trick, but it makes
code much uglier (as you cannot always call g_waitidle()), it doesn't
solve all edge cases and it can introduce deadlocks if there are events
in the queue that wait for gmirror.

I removed those hacks. Now all consumers are open r1w1e1 always, even if
device is closed. Maybe it is less clean from GEOM perspective, but simpify
code a lot and make it much more reliable.
The only issue was retaste event which is sent when we close consumers
opened for writing. I ignore retaste event by not detaching consumer
immediately (so retaste event is not send to my class) and sending event
right after it to detach and destroy consumer.
2004-12-19 23:12:00 +00:00
Pawel Jakub Dawidek
c37e2f9bbf Don't quit on first failure, just skip failures. 2004-12-19 22:58:25 +00:00