Commit Graph

1120 Commits

Author SHA1 Message Date
Pawel Jakub Dawidek
ee40c7aa76 Use G_RAID3_FOREACH_SAFE_BIO() macro instead of G_RAID3_FOREACH_BIO() in
two places where g_io_request() is called. g_io_request() can free bio
structure so we can't reference it after and G_RAID3_FOREACH_BIO() macro
was doing this.

Found by:	Coverity Prevent analysis tool (with my new models)
MFC after:	1 day
2006-05-04 13:01:16 +00:00
Pawel Jakub Dawidek
ffd106f5a3 We shouldn't lock the topology here - we will panic on assertion inside
g_raid3_bump_syncid().

Reported by:	Bradley W. Dutton <brad-fbsd-stable@duttonbros.com>
MFC after:	1 day
2006-04-30 22:14:17 +00:00
Pawel Jakub Dawidek
84edb86df6 - Don't hold the device sx lock when going to sleep.
- Prevent possible live-lock in case of memory problems by freeing
  already completed requests first.

Reported and tested by:	markus, Bradley W. Dutton <brad-fbsd-stable@duttonbros.com>
MFC after:		1 day
2006-04-28 12:18:03 +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
18486a5ee3 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:52:45 +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
5af2ae28f6 geli(8) provides keys on newsession time, so remove CRD_F_KEY_EXPLICIT flag
as HW crypto drivers don't support it.
2006-04-20 06:33:46 +00:00
Pawel Jakub Dawidek
c082905bb6 Fix storing offset of already synchronized data. Offset in entire array was
stored in metadata instead of an offset in single disk.
After reboot/crash synchronization process started from a wrong offset
skipping (not synchronizing) part of the component which can lead to data
corrutpion (when synchronization process was interrupted on initial
synchronization) or other strange situations like 'graid3 status' showing
value more than 100%.

Reported, reviewed and tested by:	ru
Reported by:	Dmitry Morozovsky <marck@rinet.ru>
MFC after:	1 day
2006-04-18 13:52:11 +00:00
Pawel Jakub Dawidek
cd0d707eb7 Correct debug: we are sending child bio here, not parent bio.
MFC after:	1 week
2006-04-15 18:30:42 +00:00
Martin Cracauer
3f4f4a1465 Make CCD be able to read and write Linux software raids.
Supported for raid-0 with <n> disks, raid-1 with 2 disks.

Manpages have examples, warnings etc.

Test scripts on
http://www.cons.org/cracauer/ccdconfig-linux/
Reviewed by:	alfred
2006-04-13 20:35:31 +00:00
Pawel Jakub Dawidek
d3a1be900a Pass BIO_GETATTR requests down.
MFC after:	1 week
2006-04-12 12:18:44 +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
Marcel Moolenaar
ec0889a069 MFp4:
o  Implement the remove verb to remove a partition entry.
o  Improve error reporting by first checking that the verb is valid.
o  Add an entry parameter to the add verb. this parameter can be
   both read-only as welll as read-write and specifies the entry
   number of the newly added partition.
o  Make sure that the provider is alive when passed to us. It may
   be withering away.
o  When adding a new partition entry, test for overlaps with existing
   partitions.
2006-04-10 04:03:14 +00:00
Marcel Moolenaar
d99c155975 Add g_wither_provider() to abstract the details of destroying a
particular provider. Use this function where g_orphan_provider()
is being called so that the flags are updated correctly and
g_orphan_provider() is called only when allowed.
2006-04-10 03:55:13 +00:00
Marcel Moolenaar
41063f9380 Change gctl_set_param() to return an error instead of setting an
error on the request.  Add a wrapper, gctl_set_param_err(), that
sets the error on the request from the error returned by
gctl_set_param() and update current callers of gctl_set_param()
to call gctl_set_param_err() instead.
This makes gctl_set_param() much more usable in situations where
the caller knows better what to do with certain (apparent) error
conditions and setting an error on the request is not one of the
things that need to be done.
2006-04-07 16:19:48 +00:00
Pawel Jakub Dawidek
39d92f5fa3 Typos. 2006-04-05 22:07:31 +00:00
Pawel Jakub Dawidek
700e04d9b6 Revert previous change, as I fixed MD5(9). 2006-03-30 18:50:00 +00:00
Pawel Jakub Dawidek
8e88808915 md_hash field in g_eli_metadata structure is not 4 byte aligned, which
case panic on sparc64.

The problem is in MD5(9) implementation. The Encode() function takes
'unsigned char *output' as its first argument, which is then assigned to
'u_int32_t *op'. If the 'output' argument is not 4 byte aligned (and in
geli(8) case it is not), sparc64 machine will panic.

I don't know how to fix MD5(9) in a clean way, so I'm implementing a
work-around in geli(8).

Reported by:	brueffer
MFC after:	3 days
2006-03-30 14:41:13 +00:00
Lukas Ertl
ff91880e5d Protect from creating striped and RAID5 plexes with unequally sized
subdisks.
2006-03-30 14:01:25 +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
0d14fae5f3 Preserve previous behaviour of kern.geom.raid3.n{64,16,4}k tunables were 0
means unlimited.

Reported by:	ru
MFC after:	3 days
2006-03-28 18:34:36 +00:00
Pawel Jakub Dawidek
d7fad9f651 Increase debug level for "Thread exiting." message. It's not that important
and is 0 by accident.

MFC after:	3 days
2006-03-25 23:30:36 +00:00
Lukas Ertl
5c391fb60c Fix whitespace. 2006-03-23 20:01:13 +00:00
Lukas Ertl
7b5264faa1 Implement the 'resetconfig' command.
PR:            kern/94835
Submitted by:  Ulf Lilleengen <lulf@stud.ntnu.no>
2006-03-23 19:58:43 +00:00
Pawel Jakub Dawidek
9bfdf5987d Update copyright for 2006. 2006-03-19 12:55:51 +00:00
Pawel Jakub Dawidek
e675705966 kern.geom.raid3.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 11:18:33 +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
ad5722357f Fix a typo. 2006-03-13 14:59:57 +00:00
Ruslan Ermilov
ef25813de6 Fix build on 64-bit platforms. 2006-03-13 14:48:45 +00:00
Pawel Jakub Dawidek
3650be51e2 - Reimplement I/O data allocation to prevent deadlocks.
Submitted by:	green

- Speed up synchronization process by using configurable number of I/O
  requests in parallel.
  + Add kern.geom.raid3.sync_requests tunable which defines how many parallel
    I/O requests should be used.
  + Retire kern.geom.raid3.reqs_per_sync and kern.geom.raid3.syncs_per_sec
    sysctls.
- Fix race between regular and synchronization requests.
- Reimplement raid3'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.

Tested by:	Mike Tancsa <mike@sentex.net>
MFC after:	3 days
2006-03-13 01:03:18 +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
99c889fc7d We need to check if file system size is equal to provider's size, because
sysinstall(8) still bogusly puts first partition at offset 0 instead of 16,
so glabel/ufs will find file system on slice instead of partition.

Before sysinstall is fixed, we must keep this code, which means that we
wont't be able to detect UFS file systems created with 'newfs -s ...'.

PS. bsdlabel(8) creates partitions properly.

MFC after:	3 days
2006-03-04 19:41:54 +00:00
Jeff Roberson
420239c773 - Lock Giant if needed around the call to vnode_create_vobject(). This is
only important if devfs is not mpsafe.

Sponsored by:	Isilon Systems, Inc.
Found by:	kris
2006-03-02 05:37:44 +00:00
Pawel Jakub Dawidek
92ee312dd4 Assert proper use of bio_caller1, bio_caller2, bio_cflags, bio_driver1,
bio_driver2 and bio_pflags fields.

Reviewed by:	phk
2006-03-01 19:01:58 +00:00
Pawel Jakub Dawidek
290c616103 Do not use bio structure after g_io_deliver(), it may not longer by valid.
Found and fixed by:	Vsevolod Lobko <seva@ip.net.ua>
MFC after:		3 days
2006-02-22 10:21:05 +00:00
Pawel Jakub Dawidek
3d48264f02 Inform when label disappears.
MFC after:	3 days
2006-02-18 11:24:00 +00:00
Pawel Jakub Dawidek
bdf2e45a5c Allow to use g_slice_orphan() from outside.
MFC after:	3 days
2006-02-18 11:21:17 +00:00
Pawel Jakub Dawidek
c058f51257 - Do not depend on fact that file system covers entire provider.
It won't work for file systems created with -s option.
  Use better file system verfication.
- Add myself to the copyright.

MFC after:	3 days
2006-02-18 10:59:47 +00:00
Pawel Jakub Dawidek
17fb8ae78f This function returns nothing. 2006-02-18 03:04:26 +00:00
Pawel Jakub Dawidek
33361bb5db If provider's sector size prevents reading SBLOCKSIZE bytes return
immediatelly.
2006-02-18 03:00:49 +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
67cae8aab8 Allow to set kern.geom.raid3.disconnect_on_failure from loader.conf.
MFC after:	3 days
2006-02-12 02:01:38 +00:00
Pawel Jakub Dawidek
3aae74ec02 - Add kern.geom.raid3.disconnect_on_failure sysctl/tunnable (default to 1
to preserve currect behaviour). When set to 0, components are not
  disconnected - graid3 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 'graid3 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:42:31 +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
17fec17e77 Correct typo. 'fbp' is NULL here so this will result in a panic.
MFC after:	3 days
2006-02-11 17:29:06 +00:00
Pawel Jakub Dawidek
0962f94295 Mark array as CLEAN when there are no write requests in
kern.geom.raid3.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:58 +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