2002-03-27 09:58:14 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2002 Poul-Henning Kamp
|
|
|
|
.\" Copyright (c) 2002 Networks Associates Technology, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This software was developed for the FreeBSD Project by Poul-Henning Kamp
|
|
|
|
.\" and NAI Labs, the Security Research Division of Network Associates, Inc.
|
|
|
|
.\" under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
|
|
|
|
.\" DARPA CHATS research program.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. The names of the authors may not be used to endorse or promote
|
|
|
|
.\" products derived from this software without specific prior written
|
|
|
|
.\" permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2006-05-25 13:39:27 +00:00
|
|
|
.Dd May 25, 2006
|
2002-12-11 15:57:40 +00:00
|
|
|
.Os
|
2002-03-27 09:58:14 +00:00
|
|
|
.Dt GEOM 4
|
|
|
|
.Sh NAME
|
|
|
|
.Nm GEOM
|
2005-11-18 10:56:28 +00:00
|
|
|
.Nd "modular disk I/O request transformation framework"
|
2002-03-27 09:58:14 +00:00
|
|
|
.Sh DESCRIPTION
|
2005-11-18 10:56:28 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
framework provides an infrastructure in which
|
|
|
|
.Dq classes
|
2002-03-27 09:58:14 +00:00
|
|
|
can perform transformations on disk I/O requests on their path from
|
|
|
|
the upper kernel to the device drivers and back.
|
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
Transformations in a
|
|
|
|
.Nm
|
|
|
|
context range from the simple geometric
|
2003-05-05 17:36:57 +00:00
|
|
|
displacement performed in typical disk partitioning modules over RAID
|
2002-03-27 09:58:14 +00:00
|
|
|
algorithms and device multipath resolution to full blown cryptographic
|
|
|
|
protection of the stored data.
|
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
Compared to traditional
|
|
|
|
.Dq "volume management" ,
|
|
|
|
.Nm
|
|
|
|
differs from most
|
2002-03-27 09:58:14 +00:00
|
|
|
and in some cases all previous implementations in the following ways:
|
2002-03-28 12:57:48 +00:00
|
|
|
.Bl -bullet
|
2002-03-27 09:58:14 +00:00
|
|
|
.It
|
2005-11-18 10:56:28 +00:00
|
|
|
.Nm
|
|
|
|
is extensible.
|
2004-07-03 18:29:24 +00:00
|
|
|
It is trivially simple to write a new class
|
|
|
|
of transformation and it will not be given stepchild treatment.
|
|
|
|
If
|
2002-03-27 09:58:14 +00:00
|
|
|
someone for some reason wanted to mount IBM MVS diskpacks, a class
|
|
|
|
recognizing and configuring their VTOC information would be a trivial
|
|
|
|
matter.
|
|
|
|
.It
|
2005-11-18 10:56:28 +00:00
|
|
|
.Nm
|
|
|
|
is topologically agnostic.
|
2004-07-03 18:29:24 +00:00
|
|
|
Most volume management implementations
|
2002-03-27 09:58:14 +00:00
|
|
|
have very strict notions of how classes can fit together, very often
|
2005-11-18 10:56:28 +00:00
|
|
|
one fixed hierarchy is provided, for instance, subdisk - plex -
|
2002-03-27 09:58:14 +00:00
|
|
|
volume.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Being extensible means that new transformations are treated no differently
|
|
|
|
than existing transformations.
|
|
|
|
.Pp
|
|
|
|
Fixed hierarchies are bad because they make it impossible to express
|
|
|
|
the intent efficiently.
|
2005-11-18 10:56:28 +00:00
|
|
|
In the fixed hierarchy above, it is not possible to mirror two
|
2002-06-09 10:25:51 +00:00
|
|
|
physical disks and then partition the mirror into subdisks, instead
|
2002-03-27 09:58:14 +00:00
|
|
|
one is forced to make subdisks on the physical volumes and to mirror
|
2005-11-18 10:56:28 +00:00
|
|
|
these two and two, resulting in a much more complex configuration.
|
|
|
|
.Nm
|
|
|
|
on the other hand does not care in which order things are done,
|
2002-03-27 09:58:14 +00:00
|
|
|
the only restriction is that cycles in the graph will not be allowed.
|
2005-11-18 10:56:28 +00:00
|
|
|
.Sh "TERMINOLOGY AND TOPOLOGY"
|
|
|
|
.Nm
|
|
|
|
is quite object oriented and consequently the terminology
|
2002-06-09 10:25:51 +00:00
|
|
|
borrows a lot of context and semantics from the OO vocabulary:
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
A
|
|
|
|
.Dq class ,
|
|
|
|
represented by the data structure
|
|
|
|
.Vt g_class
|
|
|
|
implements one
|
2004-07-03 18:29:24 +00:00
|
|
|
particular kind of transformation.
|
|
|
|
Typical examples are MBR disk
|
2002-06-09 10:25:51 +00:00
|
|
|
partition, BSD disklabel, and RAID5 classes.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
An instance of a class is called a
|
|
|
|
.Dq geom
|
|
|
|
and represented by the data structure
|
|
|
|
.Vt g_geom .
|
|
|
|
In a typical i386
|
|
|
|
.Fx
|
|
|
|
system, there
|
2002-03-27 09:58:14 +00:00
|
|
|
will be one geom of class MBR for each disk.
|
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
A
|
|
|
|
.Dq provider ,
|
|
|
|
represented by the data structure
|
|
|
|
.Vt g_provider ,
|
|
|
|
is the front gate at which a geom offers service.
|
|
|
|
A provider is
|
|
|
|
.Do
|
|
|
|
a disk-like thing which appears in
|
|
|
|
.Pa /dev
|
|
|
|
.Dc - a logical
|
2002-03-27 09:58:14 +00:00
|
|
|
disk in other words.
|
2005-11-18 10:56:28 +00:00
|
|
|
All providers have three main properties:
|
|
|
|
.Dq name ,
|
|
|
|
.Dq sectorsize
|
|
|
|
and
|
|
|
|
.Dq size .
|
|
|
|
.Pp
|
|
|
|
A
|
|
|
|
.Dq consumer
|
|
|
|
is the backdoor through which a geom connects to another
|
2002-06-09 10:25:51 +00:00
|
|
|
geom provider and through which I/O requests are sent.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
|
|
|
The topological relationship between these entities are as follows:
|
|
|
|
.Bl -bullet
|
|
|
|
.It
|
|
|
|
A class has zero or more geom instances.
|
|
|
|
.It
|
|
|
|
A geom has exactly one class it is derived from.
|
|
|
|
.It
|
|
|
|
A geom has zero or more consumers.
|
|
|
|
.It
|
2002-06-09 10:25:51 +00:00
|
|
|
A geom has zero or more providers.
|
2002-03-27 09:58:14 +00:00
|
|
|
.It
|
|
|
|
A consumer can be attached to zero or one providers.
|
|
|
|
.It
|
|
|
|
A provider can have zero or more consumers attached.
|
|
|
|
.El
|
|
|
|
.Pp
|
2002-06-09 10:25:51 +00:00
|
|
|
All geoms have a rank-number assigned, which is used to detect and
|
2004-07-03 18:29:24 +00:00
|
|
|
prevent loops in the acyclic directed graph.
|
|
|
|
This rank number is
|
2002-03-27 09:58:14 +00:00
|
|
|
assigned as follows:
|
|
|
|
.Bl -enum
|
|
|
|
.It
|
2005-11-18 10:56:28 +00:00
|
|
|
A geom with no attached consumers has rank=1.
|
2002-03-27 09:58:14 +00:00
|
|
|
.It
|
2002-06-09 10:25:51 +00:00
|
|
|
A geom with attached consumers has a rank one higher than the
|
2002-03-27 09:58:14 +00:00
|
|
|
highest rank of the geoms of the providers its consumers are
|
|
|
|
attached to.
|
|
|
|
.El
|
2002-12-27 12:15:40 +00:00
|
|
|
.Sh "SPECIAL TOPOLOGICAL MANEUVERS"
|
2002-06-09 10:25:51 +00:00
|
|
|
In addition to the straightforward attach, which attaches a consumer
|
2002-12-27 12:15:40 +00:00
|
|
|
to a provider, and detach, which breaks the bond, a number of special
|
|
|
|
topological maneuvers exists to facilitate configuration and to
|
2002-03-27 09:58:14 +00:00
|
|
|
improve the overall flexibility.
|
2005-11-18 10:56:28 +00:00
|
|
|
.Bl -inset
|
|
|
|
.It Em TASTING
|
2002-06-09 10:25:51 +00:00
|
|
|
is a process that happens whenever a new class or new provider
|
2005-11-18 10:56:28 +00:00
|
|
|
is created, and it provides the class a chance to automatically configure an
|
2006-05-24 11:01:16 +00:00
|
|
|
instance on providers which it recognizes as its own.
|
2002-06-09 10:25:51 +00:00
|
|
|
A typical example is the MBR disk-partition class which will look for
|
2005-11-18 10:56:28 +00:00
|
|
|
the MBR table in the first sector and, if found and validated, will
|
2002-03-27 09:58:14 +00:00
|
|
|
instantiate a geom to multiplex according to the contents of the MBR.
|
|
|
|
.Pp
|
2002-06-09 10:25:51 +00:00
|
|
|
A new class will be offered to all existing providers in turn and a new
|
2002-03-27 09:58:14 +00:00
|
|
|
provider will be offered to all classes in turn.
|
|
|
|
.Pp
|
|
|
|
Exactly what a class does to recognize if it should accept the offered
|
2005-11-18 10:56:28 +00:00
|
|
|
provider is not defined by
|
|
|
|
.Nm ,
|
|
|
|
but the sensible set of options are:
|
2002-03-27 09:58:14 +00:00
|
|
|
.Bl -bullet
|
|
|
|
.It
|
|
|
|
Examine specific data structures on the disk.
|
|
|
|
.It
|
2005-11-18 10:56:28 +00:00
|
|
|
Examine properties like
|
|
|
|
.Dq sectorsize
|
|
|
|
or
|
|
|
|
.Dq mediasize
|
|
|
|
for the provider.
|
2002-03-27 09:58:14 +00:00
|
|
|
.It
|
2002-06-09 10:25:51 +00:00
|
|
|
Examine the rank number of the provider's geom.
|
2002-03-27 09:58:14 +00:00
|
|
|
.It
|
2002-06-09 10:25:51 +00:00
|
|
|
Examine the method name of the provider's geom.
|
2002-03-27 09:58:14 +00:00
|
|
|
.El
|
2005-11-18 10:56:28 +00:00
|
|
|
.It Em ORPHANIZATION
|
2002-03-27 09:58:14 +00:00
|
|
|
is the process by which a provider is removed while
|
2002-06-09 10:25:51 +00:00
|
|
|
it potentially is still being used.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
2003-03-09 09:48:50 +00:00
|
|
|
When a geom orphans a provider, all future I/O requests will
|
2005-11-18 10:56:28 +00:00
|
|
|
.Dq bounce
|
|
|
|
on the provider with an error code set by the geom.
|
2004-07-03 18:29:24 +00:00
|
|
|
Any
|
2002-03-27 09:58:14 +00:00
|
|
|
consumers attached to the provider will receive notification about
|
2006-05-24 11:01:16 +00:00
|
|
|
the orphanization when the event loop gets around to it, and they
|
2003-05-05 17:36:57 +00:00
|
|
|
can take appropriate action at that time.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
2002-06-09 10:25:51 +00:00
|
|
|
A geom which came into being as a result of a normal taste operation
|
2006-05-24 11:01:16 +00:00
|
|
|
should self-destruct unless it has a way to keep functioning whilst
|
|
|
|
lacking the orphaned provider.
|
|
|
|
Geoms like disk slicers should therefore self-destruct whereas
|
|
|
|
RAID5 or mirror geoms will be able to continue as long as they do
|
|
|
|
not lose quorum.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
2003-03-09 09:48:50 +00:00
|
|
|
When a provider is orphaned, this does not necessarily result in any
|
|
|
|
immediate change in the topology: any attached consumers are still
|
2003-05-21 15:55:40 +00:00
|
|
|
attached, any opened paths are still open, any outstanding I/O
|
2003-03-09 09:48:50 +00:00
|
|
|
requests are still outstanding.
|
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
The typical scenario is:
|
|
|
|
.Pp
|
2003-03-09 09:48:50 +00:00
|
|
|
.Bl -bullet -offset indent -compact
|
|
|
|
.It
|
|
|
|
A device driver detects a disk has departed and orphans the provider for it.
|
|
|
|
.It
|
2003-05-21 15:55:40 +00:00
|
|
|
The geoms on top of the disk receive the orphanization event and
|
2006-05-24 11:01:16 +00:00
|
|
|
orphan all their providers in turn.
|
|
|
|
Providers which are not attached to will typically self-destruct
|
2003-03-09 09:48:50 +00:00
|
|
|
right away.
|
|
|
|
This process continues in a quasi-recursive fashion until all
|
2006-05-24 11:01:16 +00:00
|
|
|
relevant pieces of the tree have heard the bad news.
|
2003-03-09 09:48:50 +00:00
|
|
|
.It
|
|
|
|
Eventually the buck stops when it reaches geom_dev at the top
|
|
|
|
of the stack.
|
|
|
|
.It
|
2005-11-18 10:56:28 +00:00
|
|
|
Geom_dev will call
|
|
|
|
.Xr destroy_dev 9
|
2006-05-24 11:01:16 +00:00
|
|
|
to stop any more requests from
|
2003-03-09 09:48:50 +00:00
|
|
|
coming in.
|
2006-05-24 11:01:16 +00:00
|
|
|
It will sleep until any and all outstanding I/O requests have
|
2003-03-09 09:48:50 +00:00
|
|
|
been returned.
|
2005-11-18 10:56:28 +00:00
|
|
|
It will explicitly close (i.e.: zero the access counts), a change
|
2003-03-09 09:48:50 +00:00
|
|
|
which will propagate all the way down through the mesh.
|
|
|
|
It will then detach and destroy its geom.
|
|
|
|
.It
|
|
|
|
The geom whose provider is now attached will destroy the provider,
|
|
|
|
detach and destroy its consumer and destroy its geom.
|
|
|
|
.It
|
|
|
|
This process percolates all the way down through the mesh, until
|
|
|
|
the cleanup is complete.
|
|
|
|
.El
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
2002-06-09 10:25:51 +00:00
|
|
|
While this approach seems byzantine, it does provide the maximum
|
2003-03-09 09:48:50 +00:00
|
|
|
flexibility and robustness in handling disappearing devices.
|
|
|
|
.Pp
|
2006-05-24 11:01:16 +00:00
|
|
|
The one absolutely crucial detail to be aware of is that if the
|
2003-03-09 09:48:50 +00:00
|
|
|
device driver does not return all I/O requests, the tree will
|
2003-05-05 17:36:57 +00:00
|
|
|
not unravel.
|
2005-11-18 10:56:28 +00:00
|
|
|
.It Em SPOILING
|
2002-03-27 09:58:14 +00:00
|
|
|
is a special case of orphanization used to protect
|
|
|
|
against stale metadata.
|
|
|
|
It is probably easiest to understand spoiling by going through
|
|
|
|
an example.
|
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
Imagine a disk,
|
2006-05-24 11:01:16 +00:00
|
|
|
.Pa da0 ,
|
2005-11-18 10:56:28 +00:00
|
|
|
on top of which an MBR geom provides
|
|
|
|
.Pa da0s1
|
|
|
|
and
|
|
|
|
.Pa da0s2 ,
|
|
|
|
and on top of
|
|
|
|
.Pa da0s1
|
|
|
|
a BSD geom provides
|
|
|
|
.Pa da0s1a
|
|
|
|
through
|
|
|
|
.Pa da0s1e ,
|
2006-05-24 11:01:16 +00:00
|
|
|
and that both the MBR and BSD geoms have
|
2002-03-27 09:58:14 +00:00
|
|
|
autoconfigured based on data structures on the disk media.
|
2005-11-18 10:56:28 +00:00
|
|
|
Now imagine the case where
|
|
|
|
.Pa da0
|
|
|
|
is opened for writing and those
|
|
|
|
data structures are modified or overwritten: now the geoms would
|
2002-03-27 09:58:14 +00:00
|
|
|
be operating on stale metadata unless some notification system
|
|
|
|
can inform them otherwise.
|
2003-05-05 17:36:57 +00:00
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
To avoid this situation, when the open of
|
|
|
|
.Pa da0
|
|
|
|
for write happens,
|
2006-05-24 11:01:16 +00:00
|
|
|
all attached consumers are told about this and geoms like
|
2005-11-18 10:56:28 +00:00
|
|
|
MBR and BSD will self-destruct as a result.
|
|
|
|
When
|
|
|
|
.Pa da0
|
2006-05-24 11:01:16 +00:00
|
|
|
is closed, it will be offered for tasting again
|
|
|
|
and, if the data structures for MBR and BSD are still there, new
|
2002-03-27 09:58:14 +00:00
|
|
|
geoms will instantiate themselves anew.
|
|
|
|
.Pp
|
|
|
|
Now for the fine print:
|
|
|
|
.Pp
|
|
|
|
If any of the paths through the MBR or BSD module were open, they
|
2006-05-24 11:01:16 +00:00
|
|
|
would have opened downwards with an exclusive bit thus rendering it
|
2005-11-18 10:56:28 +00:00
|
|
|
impossible to open
|
|
|
|
.Pa da0
|
2006-05-24 11:01:16 +00:00
|
|
|
for writing in that case.
|
|
|
|
Conversely,
|
2002-03-27 09:58:14 +00:00
|
|
|
the requested exclusive bit would render it impossible to open a
|
2005-11-18 10:56:28 +00:00
|
|
|
path through the MBR geom while
|
|
|
|
.Pa da0
|
|
|
|
is open for writing.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
|
|
|
From this it also follows that changing the size of open geoms can
|
2003-05-05 17:36:57 +00:00
|
|
|
only be done with their cooperation.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
|
|
|
Finally: the spoiling only happens when the write count goes from
|
2006-05-24 11:01:16 +00:00
|
|
|
zero to non-zero and the retasting happens only when the write count goes
|
2003-05-05 17:36:57 +00:00
|
|
|
from non-zero to zero.
|
2005-11-18 10:56:28 +00:00
|
|
|
.It Em INSERT/DELETE
|
2006-05-24 11:01:16 +00:00
|
|
|
are very special operations which allow a new geom
|
2002-03-27 09:58:14 +00:00
|
|
|
to be instantiated between a consumer and a provider attached to
|
|
|
|
each other and to remove it again.
|
|
|
|
.Pp
|
2006-05-24 11:01:16 +00:00
|
|
|
To understand the utility of this, imagine a provider
|
2002-12-12 17:26:04 +00:00
|
|
|
being mounted as a file system.
|
2006-05-24 11:01:16 +00:00
|
|
|
Between the DEVFS geom's consumer and its provider we insert
|
2002-06-09 10:25:51 +00:00
|
|
|
a mirror module which configures itself with one mirror
|
2002-03-27 09:58:14 +00:00
|
|
|
copy and consequently is transparent to the I/O requests
|
|
|
|
on the path.
|
|
|
|
We can now configure yet a mirror copy on the mirror geom,
|
2002-06-09 10:25:51 +00:00
|
|
|
request a synchronization, and finally drop the first mirror
|
2002-03-27 09:58:14 +00:00
|
|
|
copy.
|
2006-05-24 11:01:16 +00:00
|
|
|
We have now, in essence, moved a mounted file system from one
|
2002-03-27 09:58:14 +00:00
|
|
|
disk to another while it was being used.
|
|
|
|
At this point the mirror geom can be deleted from the path
|
2006-05-24 11:01:16 +00:00
|
|
|
again; it has served its purpose.
|
2005-11-18 10:56:28 +00:00
|
|
|
.It Em CONFIGURE
|
2002-03-27 09:58:14 +00:00
|
|
|
is the process where the administrator issues instructions
|
2004-07-03 18:29:24 +00:00
|
|
|
for a particular class to instantiate itself.
|
|
|
|
There are multiple
|
2006-05-24 11:01:16 +00:00
|
|
|
ways to express intent in this case - a particular provider may be
|
|
|
|
specified with a level of override forcing, for instance, a BSD
|
2002-03-27 09:58:14 +00:00
|
|
|
disklabel module to attach to a provider which was not found palatable
|
|
|
|
during the TASTE operation.
|
|
|
|
.Pp
|
2006-05-24 11:01:16 +00:00
|
|
|
Finally, I/O is the reason we even do this: it concerns itself with
|
2002-03-27 09:58:14 +00:00
|
|
|
sending I/O requests through the graph.
|
2006-05-24 11:01:16 +00:00
|
|
|
.It Em "I/O REQUESTS" ,
|
2005-11-18 10:56:28 +00:00
|
|
|
represented by
|
|
|
|
.Vt "struct bio" ,
|
|
|
|
originate at a consumer,
|
2006-05-24 11:01:16 +00:00
|
|
|
are scheduled on its attached provider and, when processed, are returned
|
2002-03-27 09:58:14 +00:00
|
|
|
to the consumer.
|
2005-11-18 10:56:28 +00:00
|
|
|
It is important to realize that the
|
|
|
|
.Vt "struct bio"
|
|
|
|
which enters through the provider of a particular geom does not
|
|
|
|
.Do
|
|
|
|
come out on the other side
|
|
|
|
.Dc .
|
2002-03-27 09:58:14 +00:00
|
|
|
Even simple transformations like MBR and BSD will clone the
|
2005-11-18 10:56:28 +00:00
|
|
|
.Vt "struct bio" ,
|
|
|
|
modify the clone, and schedule the clone on their
|
2002-03-27 09:58:14 +00:00
|
|
|
own consumer.
|
2005-11-18 10:56:28 +00:00
|
|
|
Note that cloning the
|
|
|
|
.Vt "struct bio"
|
|
|
|
does not involve cloning the
|
|
|
|
actual data area specified in the I/O request.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
In total, four different I/O requests exist in
|
|
|
|
.Nm :
|
|
|
|
read, write, delete, and
|
|
|
|
.Dq "get attribute".
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
2002-06-09 10:25:51 +00:00
|
|
|
Read and write are self explanatory.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
|
|
|
Delete indicates that a certain range of data is no longer used
|
|
|
|
and that it can be erased or freed as the underlying technology
|
|
|
|
supports.
|
|
|
|
Technologies like flash adaptation layers can arrange to erase
|
|
|
|
the relevant blocks before they will become reassigned and
|
2002-06-09 10:25:51 +00:00
|
|
|
cryptographic devices may want to fill random bits into the
|
2002-03-27 09:58:14 +00:00
|
|
|
range to reduce the amount of data available for attack.
|
|
|
|
.Pp
|
|
|
|
It is important to recognize that a delete indication is not a
|
|
|
|
request and consequently there is no guarantee that the data actually
|
|
|
|
will be erased or made unavailable unless guaranteed by specific
|
2004-07-03 18:29:24 +00:00
|
|
|
geoms in the graph.
|
2005-11-18 10:56:28 +00:00
|
|
|
If
|
|
|
|
.Dq "secure delete"
|
|
|
|
semantics are required, a
|
2002-03-27 09:58:14 +00:00
|
|
|
geom should be pushed which converts delete indications into (a
|
|
|
|
sequence of) write requests.
|
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
.Dq "Get attribute"
|
|
|
|
supports inspection and manipulation
|
2002-03-27 09:58:14 +00:00
|
|
|
of out-of-band attributes on a particular provider or path.
|
2005-11-18 10:56:28 +00:00
|
|
|
Attributes are named by
|
|
|
|
.Tn ASCII
|
|
|
|
strings and they will be discussed in
|
2002-03-27 09:58:14 +00:00
|
|
|
a separate section below.
|
2005-11-18 10:56:28 +00:00
|
|
|
.El
|
2002-03-27 09:58:14 +00:00
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
(Stay tuned while the author rests his brain and fingers: more to come.)
|
2005-04-07 19:59:28 +00:00
|
|
|
.Sh DIAGNOSTICS
|
2005-11-18 10:56:28 +00:00
|
|
|
Several flags are provided for tracing
|
|
|
|
.Nm
|
|
|
|
operations and unlocking
|
2005-04-07 19:59:28 +00:00
|
|
|
protection mechanisms via the
|
|
|
|
.Va kern.geom.debugflags
|
|
|
|
sysctl.
|
|
|
|
All of these flags are off by default, and great care should be taken in
|
|
|
|
turning them on.
|
2005-11-18 10:56:28 +00:00
|
|
|
.Bl -tag -width indent
|
2005-06-15 13:31:23 +00:00
|
|
|
.It 0x01 Pq Dv G_T_TOPOLOGY
|
2005-04-07 19:59:28 +00:00
|
|
|
Provide tracing of topology change events.
|
2005-06-15 13:31:23 +00:00
|
|
|
.It 0x02 Pq Dv G_T_BIO
|
2005-04-07 19:59:28 +00:00
|
|
|
Provide tracing of buffer I/O requests.
|
2005-06-15 13:31:23 +00:00
|
|
|
.It 0x04 Pq Dv G_T_ACCESS
|
2005-04-07 19:59:28 +00:00
|
|
|
Provide tracing of access check controls.
|
|
|
|
.It 0x08 (unused)
|
|
|
|
.It 0x10 (allow foot shooting)
|
|
|
|
Allow writing to Rank 1 providers.
|
|
|
|
This would, for example, allow the super-user to overwrite the MBR on the root
|
2005-06-15 13:31:23 +00:00
|
|
|
disk or write random sectors elsewhere to a mounted disk.
|
|
|
|
The implications are obvious.
|
|
|
|
.It 0x40 Pq Dv G_F_DISKIOCTL
|
2006-05-25 13:39:27 +00:00
|
|
|
This is unused at this time.
|
2005-06-15 13:31:23 +00:00
|
|
|
.It 0x80 Pq Dv G_F_CTLDUMP
|
2005-04-07 19:59:28 +00:00
|
|
|
Dump contents of gctl requests.
|
|
|
|
.El
|
2002-03-27 09:58:14 +00:00
|
|
|
.Sh HISTORY
|
2005-11-18 10:56:28 +00:00
|
|
|
This software was developed for the
|
|
|
|
.Fx
|
|
|
|
Project by
|
|
|
|
.An Poul-Henning Kamp
|
2005-06-15 13:31:23 +00:00
|
|
|
and NAI Labs, the Security Research Division of Network Associates, Inc.\&
|
2005-11-18 10:56:28 +00:00
|
|
|
under DARPA/SPAWAR contract N66001-01-C-8035
|
|
|
|
.Pq Dq CBOSS ,
|
|
|
|
as part of the
|
2002-03-27 09:58:14 +00:00
|
|
|
DARPA CHATS research program.
|
|
|
|
.Pp
|
2005-11-18 10:56:28 +00:00
|
|
|
The first precursor for
|
|
|
|
.Nm
|
|
|
|
was a gruesome hack to Minix 1.2 and was
|
2004-07-03 18:29:24 +00:00
|
|
|
never distributed.
|
|
|
|
An earlier attempt to implement a less general scheme
|
2005-11-18 10:56:28 +00:00
|
|
|
in
|
|
|
|
.Fx
|
|
|
|
never succeeded.
|
2002-03-27 09:58:14 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
.An "Poul-Henning Kamp" Aq phk@FreeBSD.org
|