Commit Graph

83 Commits

Author SHA1 Message Date
Greg Lehey
66c4363288 free_vinum: don't change loop bounds for deleting drives while in the loop.
This solved a problem where 'vinum resetconfig' only reset half
	    the drives.

Reported-by:  Brad Knowles <blk@skynet.be>
	      Karl Pielorz <kpielorz@tdx.co.uk>

Change the super device.  We now have three super devices:

  1.  The normal superdevice used by vinum(8).
  2.  The superdevice used by vinum(8) when compiled with debug support.
  3.  The superdevice used by the daemon.

This method allows vinum(8) to determine debug mismatches.  Also check
correctly for the device type.  The old code did not check all bits of
the minor number.

  Reported-by: a cast of thousands, most recently by Brad Knowles
               <blk@skynet.be>.
1999-03-19 07:08:40 +00:00
Greg Lehey
6f70e1c542 Modify to compile with egcs.
Prodded-by: obrien
1999-03-18 23:26:22 +00:00
Greg Lehey
e21b9d8321 deallocrqg: deallocate the correct object, also check that the object
is really in the chain.
1999-03-14 04:04:23 +00:00
Greg Lehey
017944b921 Change prototype of vinum_inactive. 1999-03-13 07:46:34 +00:00
Greg Lehey
962113a4bf Remove opencount from vinum_conf and struct vol, and disk index from
struct vol.

Add time to struct mc, remove KVA crud.

Add debug flags DEBUG_EOFINFO and DEBUG_MEMFREE.
1999-03-13 07:40:52 +00:00
Greg Lehey
f9976b8861 Part of removing vol->opencount: now we just use a flag. 1999-03-13 07:39:17 +00:00
Greg Lehey
63052eb444 Add DEBUG_EOFINFO log messages. 1999-03-13 07:38:27 +00:00
Greg Lehey
cadf346d84 Remove antique crud.
MMalloc: save the time at which the request was granted, remove more
crud.

FFree: add a circular buffer of the last 64 Free requests if
DEBUG_MEMFREE is set.
1999-03-13 07:37:44 +00:00
Greg Lehey
5c6d2cb543 lock_drive: report on and recover from an obscure situation where the
daemon can deadlock against itself.
1999-03-13 07:35:40 +00:00
Greg Lehey
301851b630 VINUM_RESETCONFIG: do the reset even if the config is open (as it has
to be for us to issue the ioctl :-).  Also remove the opencount
parameter of the config, which just never worked.
1999-03-13 07:34:56 +00:00
Greg Lehey
1a049f96ab Don't frob vp->v_usecount, it scares the hell out of the driver under
certain circumstances.
1999-03-13 07:33:37 +00:00
Greg Lehey
b1356c97c6 Change the way of recognizing whether a plex was given to a volume
after the volume had been fully operational; involves a change in the
use of the VF_NEWBORN flag.  Now if you add a plex to a volume which
is up, the plex will be down and the subdisks stale.  You need to
explicitly start the subdisks, which copies data from the good
subdisks to the uninitialized ones.

Stumbled-over-by: Ludwig Pummer <ludwigp@bigfoot.com>

give_sd_to_drive:
   correct method to give the entire largest chunk of drive to the
   subdisk.  Now it's enough to specify a length, and vinum will give
   you as much as it can.  Not to be recommended except for empty
   drives.

   Correct a bogon which made vinum refuse to give the last sector of
   a drive to a subdisk.

   Last-reported-by: Ludwig Pummer <ludwigp@bigfoot.com>

Change %q formats to %ll before the former go away.  This doesn't make
much difference, since kernel kvprintf currently doesn't support
either, and the messages in question are just error messages.
1999-03-13 07:32:40 +00:00
Greg Lehey
e80e86a302 vinum_inactive: distinguish whether we care whether the config
is open or not.
1999-03-13 07:22:00 +00:00
Greg Lehey
b8d3ec490d Change SAVECONFIG ioctl: it now writes an int parameter. 1999-03-02 22:00:19 +00:00
Greg Lehey
587ce8d9ae Correct some diagrams
Remove pid field from struct sd, struct plex and struct volume

Add flags VF_STOPPING, VF_OPEN and VF_DAEMONOPEN
1999-03-02 06:58:09 +00:00
Greg Lehey
57f9112565 sizespec: allow negative values (which signal error conditions).
catch missing (NULL) parameters.
1999-03-02 06:57:48 +00:00
Greg Lehey
a11c3a2c73 Change the name of drive state "uninit" to "referenced": it only
occurs if we have a dangling pointer to a drive.
1999-03-02 06:57:30 +00:00
Greg Lehey
75fff3fead Change printf() calls to log() calls.
set_sd_state: allow stop command to stop a reborn subdisk.
1999-03-02 06:57:08 +00:00
Greg Lehey
72dec6f286 Change printf() calls to log() calls. 1999-03-02 06:56:39 +00:00
Greg Lehey
80035a4cf1 Add keywords "size", synonym for "length", and "max".
Check for NULL name parameters.
1999-03-02 06:56:05 +00:00
Greg Lehey
39ce6e429e Change printf() calls to log() calls.
expand_table: Zero out newly allocated tables
1999-03-02 06:55:44 +00:00
Greg Lehey
1e14d0037d Add keywords "size", synonym for "length", and "max". 1999-03-02 06:55:18 +00:00
Greg Lehey
33e00380bc Change printf() calls to log() calls.
Change VINUM_SAVECONFIG: it now requires a parameter.  0 means
"configuration updates are finished, please save", and 1 means "please
just save the config".  This second meaning is invoked by the new
"saveconfig" command to vinum(8).
1999-03-02 06:54:57 +00:00
Greg Lehey
f569eff522 Change printf() calls to log() calls.
Recognize "referenced" drives by the lack of a slash in the device
name, not by a NUL character.

vinum_scandisk: return error indication (ENOENT if we can't find any
vinum drive, otherwise 0).

VINUM_SAVECONFIG: change parameters.
1999-03-02 06:54:30 +00:00
Greg Lehey
02dbb6666a New function return_drive_space
Add definitions of vinum_inactive and free_vinum, formerly local to
vinum.c

vinum_scandisk now returns int (error number)
1999-03-02 06:53:42 +00:00
Greg Lehey
e0e19a088b change printf() calls to log() calls.
Don't save config while we're reading it from disk.

Change the way we handle the daemon: if we can't communicate with it
for 1 second (which is possible), start a new one.  The daemon saves
its pid in daemonpid; on each iteration of the main loop the daemon
checks whether it's still in favour.  If not, it silently exits.
Also, when trying to communicate with the daemon, check daemonpid
first.  If it's set to 0, don't even try.
1999-03-02 06:53:15 +00:00
Greg Lehey
a0a8b3768e Change printf() calls to log() calls.
Rename the VF_KERNELOP to VF_DISKCONFIG and checkkernel () to
checkdiskconfig (), which better describes their function.

Disable configuration updates if we have an error reading in the
configuration.  This stops a "shoot-in-foot" problem where a mistake
can cause the configuration to be obliterated.

Tidy up some messages, which included superfluous \ns.

Recognize RAID-5 configuration information even in the non-RAID-5
version.  This fixes shoot-in-foot problems where starting the wrong
version of vinum would kill RAID-5 plexes.

Recognize drives that have been referenced, but for which no physical
location is known.  This is part of a modification which will
ultimately allow incrementally reading configurations.  Such drives
will have a device name "unknown".

New function return_drive_space () returns space to a drive.
Previously this was part of free_sd ().

give_sd_to_drive: don't do it if the subdisk needs more space than the
drive has available.

config_sd: if reading config from disk, accept plex offset, drive
offset and length specs of -1 to indicate error conditions.

parse_config: return ENOENT if the "read" command doesn't find any
drives.

remove_sd_entry: don't do it, even by force, if it's open.

If the size of a striped or RAID-5 plex is not an integral multiple of
the stripe size, trim the size until it is.

reinstate update_volume_config, which had atrophied, to recalculate
the size of a volume if a plex has shrunk due to stripe size
considerations.
1999-03-02 06:52:47 +00:00
Greg Lehey
571aa87170 Change printf() calls to log() calls.
vinumattach: Zero out tables after allocating them

Modify procedure at unload: if a vinum(8) has the superdev open, don't
close down.  If only the daemon has it open, send the daemon a stop
request and wait for it to close the superdev, then unload.

In order to do this, create a second superdev which is opened by the
daemon.  The open and close routines set a different bit in
vinum_conf.flags; otherwise the treatment is identical.

Remove opencount field in vol structure; replace by a flag bit, since
we can't count the number of opens.

Remove dead LKM grunge.
1999-03-02 06:52:11 +00:00
Greg Lehey
88c8f9c911 Change the name of drive state "uninit" to "referenced": it only
occurs if we have a dangling pointer to a drive.
1999-03-02 06:51:48 +00:00
Greg Lehey
9e0aa8e9b8 Correct some indentation
Implicitly-desired-by: bde

update_plex_state:  Handle empty RAID-5 plexes correctly
1999-02-11 06:44:46 +00:00
Greg Lehey
e8b3affb8e build_write_request: correct logic for handling writes to volumes with
failed plexes.

allocrqg: Remove dead code
1999-02-11 06:44:12 +00:00
Greg Lehey
8093cf90f1 check_drive: Make sure that we don't open two different drives with
the same name.  Silently return EEXIST if this happens.

vinum_scandisk: Collect drive numbers, not pointers, to avoid problems
of relocated drives.

Tripped-over-by:  Bernd Walter <ticso@cicely.de>
1999-02-11 06:43:15 +00:00
Greg Lehey
cc902735df In some cases, it's possible that I/O errors will cause the daemon to
time out on an operation.  Under these circumstances, vinum(8) will
automatically start another daemon.  Add a pid for the daemon, so that
an overtaken daemon will discover that it's no longer in favour, and
will crawl into a corner and die.
1999-02-11 06:42:39 +00:00
Greg Lehey
3f8d2678bc Remove some dead debug code
build_write_request: get the check for failure right
1999-02-05 05:09:22 +00:00
Greg Lehey
7f1050341c Change multiline comments to start with a lone /* and end with a */,
apparently in accordance with style(9).

Complained-about-by: bde
1999-01-29 01:17:54 +00:00
Greg Lehey
6fe15bff6e Change multiline comments to start with a lone /* and end with a */,
apparently in accordance with style(9).

Complained-about-by: bde

vinumopen: Change check for root user to a call to suser(9)
vinumclose: Remove check for root user.

Nitpicked-by: phk
1999-01-29 01:16:18 +00:00
Greg Lehey
bb1d6cfa3c build_write_request: only fail if all plexes are down, instead of if
any of them are down.

Reported-by: dg
1999-01-28 07:00:55 +00:00
Greg Lehey
a1c1b26d88 Fix some format breakage before bde finds out
vinum_scandisk: check not only drive error, but also drive state,
  before accessing the drive.

drivecmp: Remove warning messages by Backing out overly constant
  declarations in revision 1.9.
1999-01-28 06:59:27 +00:00
Matthew Dillon
b4e36adf1c Fix warnings preparing for -Wall -Wcast-qual
Also disable one usb module in LINT due to fatal compilation errors,
    temporary.
1999-01-27 20:09:21 +00:00
Greg Lehey
ac4cd383ca Correct #include in vinumioctl.c to compile correctly
without VINUMDEBUG

Submitted-by: peter
1999-01-24 05:14:39 +00:00
Peter Wemm
e5ca2df920 Minor tweak to fix 'pseudo-device vinum'. One of these got lost before,
the other is a new file.
1999-01-23 01:29:05 +00:00
Peter Wemm
013b59f2cb Remove stray Makefile that Greg initially imported. 1999-01-23 00:09:07 +00:00
Greg Lehey
33953e5e97 Include Peter Wemm's renaming and restructuring
Change from lkm to kld

Add field plexsdno to sd struct

Add flag VF_NEWBORN to drive, sd, plex and volume structs, indicating
that the object has just been created.

Add object types for raw (unattached) plexes and subdisks

Remove definitions of VOLNO, PLEXNO and SDNO (now functions Volno,
Plexno and Sdno)

Move revive parameters from struct plex to struct sd.

struct plex:
  maintain a count of the number of inaccessible subdisks.
  remove defective and unmapped regions.

Debug flags: make an enum (previously #define)

Set default revive block size to 64kB (was 32 kB)
1999-01-21 00:41:58 +00:00
Greg Lehey
5d6f3129b1 Retain some of the RAID5 texts even in the non-RAID5 versions.
Previously, accidentally starting the wrong version could corrupt
  the RAID5 configuration.

  Add functions Volno, Plexno and Sdno to replace the old defines
  VOLNO, PLEXNO and SDNO.
1999-01-21 00:41:31 +00:00
Greg Lehey
8a2cba6003 Remove states:
plex_reviving (now we revive subdisks)
  drive_coming_up (never happened)

Add state sd_reviving.
1999-01-21 00:40:50 +00:00
Greg Lehey
6d930639c3 Include Peter Wemm's renaming and restructuring
Change from lkm to kld

Serious rewrite.  No longer call set_<foo>_state to set the state
based only on other objects; instead, add functions
update_<foo>_state, which determine what the state should be by
themselves.  This allows the set_<foo>_state functions to shrink
enough to be almost intelligible.

Remove flags setstate_recurse and setstate_recursing.

Remove plex defective regions and unmapped regions, which were
maintained but not used.

Change code to allow daemon to perform operations formerly kludged
into an interrupt context.  Remove the DIRTYCONFIG kludge.
1999-01-21 00:40:32 +00:00
Greg Lehey
2178c45997 Change the style of revive: revive subdisks instead of plexes. This
makes it easier to keep track of which parts of a plex need reviving.

Use sdio, not vinumstrategy, to write to the subdisk.
1999-01-21 00:40:03 +00:00
Greg Lehey
7d077233f8 Include Peter Wemm's renaming and restructuring
Change from lkm to kld

Remove #ifdefs for FreeBSD 2.c

vinumstrategy:
  Support anonymous (`raw') subdisks and plexes.
  Change code to allow daemon to perform operations formerly kludged
  into an interrupt context.  Remove the DIRTYCONFIG kludge.

No longer set B_ORDERED for reviving subdisks.  I suspect this
wouldn't work correctly, and it should be done in a different manner
in vinumrevive.c

sdio: set subdisk state correctly on error
      start to remove code that doesn't make any sense any more.
1999-01-21 00:39:36 +00:00
Greg Lehey
09c265ba75 Add keywords help, makedev, quit and setdaemon 1999-01-21 00:39:01 +00:00
Greg Lehey
cb4547a333 MMalloc: remove directory part of name correctly 1999-01-21 00:37:56 +00:00