Commit Graph

1235 Commits

Author SHA1 Message Date
John Birrell
18b0b6d137 On some arches, openssl is built with OPENSSL_NO_CAMELLIA, so the
code here needs to depend on that too.
2007-11-19 08:59:32 +00:00
Maxim Konovalov
e70553c775 o s/resiserfs_sb/reiserfs_sb/.
Submitted by:	Ighighi
2007-11-16 19:43:26 +00:00
Pawel Jakub Dawidek
b656c1b836 Save stack only when KTR_GEOM is both compiled into the kernel and enabled
in debug.ktr.mask. Because saving stack is very expensive, it's better only
to do it when one really wants to.

Reported by:	Dan Nelson
2007-10-26 06:55:00 +00:00
John Baldwin
f352a0d45f First cut at support for booting a GPT labeled disk via the BIOS bootstrap
on i386 and amd64 machines.  The overall process is that /boot/pmbr lives
in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for
locating and loading /boot/gptboot.  /boot/gptboot is similar to /boot/boot
except that it groks GPT rather than MBR + bsdlabel.  Unlike /boot/boot,
/boot/gptboot lives in its own dedicated GPT partition with a new
"FreeBSD boot" type.  This partition does not have a fixed size in that
/boot/pmbr will load the entire partition into the lower 640k.  However,
it is limited in that it can only be 545k.  That's still a lot better than
the current 7.5k limit for boot2 on MBR.  gptboot mostly acts just like
boot2 in that it reads /boot.config and loads up /boot/loader.  Some more
details:
- Include uuid_equal() and uuid_is_nil() in libstand.
- Add a new 'boot' command to gpt(8) which makes a GPT disk bootable using
  /boot/pmbr and /boot/gptboot.  Note that the disk must have some free
  space for the boot partition.
  - This required exposing the backend of the 'add' function as a
    gpt_add_part() function to the rest of gpt(8).  'boot' uses this to
    create a boot partition if needed.
- Don't cripple cgbase() in the UFS boot code for /boot/gptboot so that
  it can handle a filesystem > 1.5 TB.
- /boot/gptboot has a simple loader (gptldr) that doesn't do any I/O
  unlike boot1 since /boot/pmbr loads all of gptboot up front.  The
  C portion of gptboot (gptboot.c) has been repocopied from boot2.c.
  The primary changes are to parse the GPT to find a root filesystem
  and to use 64-bit disk addresses.  Currently gptboot assumes that the
  first UFS partition on the disk is the / filesystem, but this algorithm
  will likely be improved in the future.
- Teach the biosdisk driver in /boot/loader to understand GPT tables.
  GPT partitions are identified as 'disk0pX:' (e.g. disk0p2:) which is
  similar to the /dev names the kernel uses (e.g. /dev/ad0p2).
- Add a new "freebsd-boot" alias to g_part() for the new boot UUID.

MFC after:	1 month
Discussed with:	marcel (some things might still change, but am committing
			what I have so far)
2007-10-24 21:33:00 +00:00
Marcel Moolenaar
a1fedf914f Add the freebsd-zfs alias. Both APM and GPT have ZFS partition
types.
2007-10-21 20:02:57 +00:00
Julian Elischer
3745c395ec Rename the kthread_xxx (e.g. kthread_create()) calls
to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0  so that we can eventually MFC the
new kthread_xxx() calls.
2007-10-20 23:23:23 +00:00
Pawel Jakub Dawidek
3ea5d7ec24 When orphaning a provider, cancel events related to it.
Without this change the following situation was possible:

1. Provider is orphaned from within class' access() method on last write
   close - orphan provider event is send.
2. GEOM detects last write close on a provider and sends new provider event.
3. g_orphan_register() is called, and calls all orphan methods of attached
   consumers.
4. New provider event is executed on orphaned provider, all classes can
   taste already orphaned provider, and some may attach consumers to it.
   Those consumers will never go away, because the g_orphan_register()
   was already called.

We end up with a zombie provider.

With this change, at step 3, we will cancel new provider event.

How to repeat this problem:

	# mdconfig -a -t malloc -s 10m
	# geli init -i 0 md0
	# geli attach md0
	# newfs -L test /dev/md0.eli
	# mount /dev/ufs/test /mnt/tmp
	# geli detach -l md0.eli
	# umount /mnt/tmp
	# glabel status
            Name  Status  Components
        ufs/test  N/A     N/A

Reviewed by:	phk
Approved by:	re (kensmith)
2007-09-27 20:18:34 +00:00
Pawel Jakub Dawidek
17a0c19020 LINT compiled just fine for me, but it seems it breaks tinerbox way of
compiling LINT.

Approved by:	re (implicitly)
2007-09-23 15:10:48 +00:00
Pawel Jakub Dawidek
f854db0bf5 Bring in the GEOM Virtualisation class, which allows to create huge GEOM
providers with limited physical storage and add physical storage as
needed.

Submitted by:	Ivan Voras
Sponsored by:	Google Summer of Code 2006
Approved by:	re (kensmith)
2007-09-23 07:34:23 +00:00
Pawel Jakub Dawidek
864cba9669 Add support for Camellia encryption algorithm.
PR:		kern/113790
Submitted by:	Yoshisato YANAGISAWA <yanagisawa@csg.is.titech.ac.jp>
Approved by:	re (bmah)
2007-09-01 06:33:02 +00:00
Marcel Moolenaar
0081f96ecd Have gpart synthesize a disk geometry if the underlying provider
don't have it. Some partitioning schemes, as well as file systems,
operate on the geometry and without it such schemes (e.g. MBR)
and file systems (e.g. FAT) can't be created. This is useful for
memory disks.
2007-06-17 22:19:19 +00:00
Marcel Moolenaar
6bc5044561 Add the MBR partitioning scheme to g_part. This does not yet
support the ability to install boot code.
2007-06-13 04:27:36 +00:00
Marcel Moolenaar
cf23147053 Prefix unknown (i.e. un-aliased) partition types with '!'. This is
how they had to be given with ctlreq.
2007-06-06 05:06:14 +00:00
Marcel Moolenaar
33a558c7e9 Call sbuf_finish() before sbuf_data() and sbuf_len(). 2007-06-06 05:01:41 +00:00
Jeff Roberson
982d11f836 Commit 14/14 of sched_lock decomposition.
- Use thread_lock() rather than sched_lock for per-thread scheduling
   sychronization.
 - Use the per-process spinlock rather than the sched_lock for per-process
   scheduling synchronization.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-05 00:00:57 +00:00
David Malone
041b706b2f Despite several examples in the kernel, the third argument of
sysctl_handle_int is not sizeof the int type you want to export.
The type must always be an int or an unsigned int.

Remove the instances where a sizeof(variable) is passed to stop
people accidently cut and pasting these examples.

In a few places this was sysctl_handle_int was being used on 64 bit
types, which would truncate the value to be exported.  In these
cases use sysctl_handle_quad to export them and change the format
to Q so that sysctl(1) can still print them.
2007-06-04 18:25:08 +00:00
Marcel Moolenaar
ce3498bd83 Fix a dereference in KASSERT. 2007-05-15 23:29:57 +00:00
Marcel Moolenaar
35fe9df032 o Implement automatic commit. It's enabled when the flags parameter
exists and contains the 'C' flag.
o  The partition label can be the empty string. It's how labels are
   cleared.
o  When an action fails, lower permissions when they were raised
   in order to allow the action. A failed action will not result
   in any uncommitted changes.
o  Allow the flags paremeter to be present but empty. It's the
   equivalent of not being present.
2007-05-15 20:14:55 +00:00
Marcel Moolenaar
5100f9e95b Write the output parameter (if present) for the add, create, delete
destroy and modify verbs.
2007-05-09 05:37:53 +00:00
Marcel Moolenaar
c8dffc524a When reverting the creation of a partitioning scheme on a provider,
the failure to probe an existing partitioning scheme means that no
previous partitioning scheme existed. Don't error. Just destroy the
geom.
2007-05-09 01:46:42 +00:00
Marcel Moolenaar
d287f59062 MFp4:
119373:	o  Remove the query verb, along with the request and response
	   parameters.
	o  Add the version and output parameters.
119390: [APM,GPT] Properly clear deleted entries.
119394:	o  Make the alias the standard and use the '!' to prefix
	   literal partition types.
	o  Treat schemes and partition types as case insensitive.
119462: [GPT] Fix a page fault caused when modifying a partition entry
	without a new partition type.
2007-05-08 20:18:17 +00:00
Pawel Jakub Dawidek
f0256e71f1 When deleting key, flush write cache after each overwrite, so we don't
overwrite data N times in cache and only once on disk.
2007-05-06 14:56:03 +00:00
Pawel Jakub Dawidek
4887800305 Allow to use ':' in d_ident, which is quite handy character. 2007-05-05 18:09:17 +00:00
Pawel Jakub Dawidek
a04c28bdd9 Handle GEOM::ident attribute by attaching 'sX' string at the end of ident
received from the underlying provider, where X is pp->index value.

OK'ed by:	phk
2007-05-05 17:52:22 +00:00
Pawel Jakub Dawidek
5e16a4866f Because there are many strange hardware out there, allow to use only
[a-zA-Z0-9-_@#%.] characters in d_ident field.
2007-05-05 17:47:20 +00:00
Pawel Jakub Dawidek
d0c11f9eb7 - Extend disk structure to allow to store disk's serial number, which can be
retrieved via GEOM::ident attribute.
- Bump disk(9) ABI version.

OK'ed by:	phk
2007-05-05 17:12:15 +00:00
Pawel Jakub Dawidek
0589353ac7 Implement three new ioctls that can be used with GEOM provider:
DIOCGFLUSH - Flush write cache (sends BIO_FLUSH).

	DIOCGDELETE - Delete data (mark as unused) (sends BIO_DELETE).

	DIOCGIDENT - Get provider's uniqe and fixed identifier (asks for
		GEOM::ident attribute).

First two are self-explanatory, but the last one might not be. Here are
properties of provider's ident:

- ident value is preserved between reboots,
- provider can be detached/attached and ident is preserved,
- provider's name can change - ident can't,
- ident value should not be based on on-disk metadata; in other words
  copying whole data from one disk to another should not yield the same
  ident for the other disk,
- there could be more than one provider with the same ident, but only if
  they point at exactly the same physical storage, this is the case for
  multipathing for example,
- GEOM classes that consumes single providers and provide single providers,
  like geli, gbde, should just attach class name to the ident of the
  underlying provider,
- ident is an ASCII string (is printable),
- ident is optional and applications can't relay on its presence.

The main purpose for this is that application and remember provider's ident
and once it tries to open provider by its name again, it may compare idents
to be sure this is the right provider. If it is not (idents don't match),
then it can open provider by its ident.

OK'ed by:	phk
2007-05-05 17:02:19 +00:00
Pawel Jakub Dawidek
2b17fb9514 Implement g_delete_data() similar to g_read_data() and g_write_data().
OK'ed by:	phk
2007-05-05 16:35:22 +00:00
Pawel Jakub Dawidek
d19dbf4a23 - Implement helper g_handleattr_str() function for string attributes
handling.
- Extend g_handleattr() to treat attribute as string when len=0.

OK'ed by:	phk
2007-05-05 16:33:44 +00:00
Marcel Moolenaar
e8e1f54462 Put the scheme (APM, GPT, etc) in the XML. 2007-04-27 05:58:10 +00:00
Hidetoshi Shimokawa
33018fbdff If compressed length is zero, return a zero-filled block.
MFC after: 1 week
2007-04-24 06:30:06 +00:00
Lukas Ertl
a2237c41fc -) Correct sdcount for a plex when removing or adding subdisks.
-) Set correct sizes for plexes and volumes a subdisk has been removed.

Submitted by:   Ulf Lilleengen <lulf_AT_freebsd.org>
2007-04-12 17:54:35 +00:00
Lukas Ertl
9e357b05da Avoid infinite loop if the device string given for a drive
only consists of "/".

Submitted by:  Ulf Lilleengen <lulf_AT_freebsd.org>
2007-04-12 17:40:44 +00:00
Pawel Jakub Dawidek
df3aed4f96 Use root_mounted(). 2007-04-08 23:54:23 +00:00
Hidetoshi Shimokawa
54911451d5 Fix a bug for over 4GB media.
MFC after: 3 days
2007-04-07 02:52:13 +00:00
Pawel Jakub Dawidek
68474f1930 Sysctl description is not a format string, so one % is enough. 2007-04-06 12:53:54 +00:00
Xin LI
a92b7d4982 - Be more verbose when saying "foo" not found.
- In gctl_get_geom(), don't issue error when we were not
   provided with an parameter, like gctl_get_provider() did.

Reviewed by:	pjd
2007-03-30 16:32:08 +00:00
Kris Kennaway
17e910a261 make_dev(9) can be (and is) called without Giant, so there is no need to
drop the topology lock and acquire Giant around this call.

Reviewed by:	phk
2007-03-26 21:47:03 +00:00
Pawel Jakub Dawidek
52b509e738 Add missing \n. 2007-03-22 15:42:13 +00:00
Sam Leffler
6810ad6f2a Overhaul driver/subsystem api's:
o make all crypto drivers have a device_t; pseudo drivers like the s/w
  crypto driver synthesize one
o change the api between the crypto subsystem and drivers to use kobj;
  cryptodev_if.m defines this api
o use the fact that all crypto drivers now have a device_t to add support
  for specifying which of several potential devices to use when doing
  crypto operations
o add new ioctls that allow user apps to select a specific crypto device
  to use (previous ioctls maintained for compatibility)
o overhaul crypto subsystem code to eliminate lots of cruft and hide
  implementation details from drivers
o bring in numerous fixes from Michale Richardson/hifn; mostly for
  795x parts
o add an optional mechanism for mmap'ing the hifn 795x public key h/w
  to user space for use by openssl (not enabled by default)
o update crypto test tools to use new ioctl's and add cmd line options
  to specify a device to use for tests

These changes will also enable much future work on improving the core
crypto subsystem; including proper load balancing and interposing code
between the core and drivers to dispatch small operations to the s/w
driver as appropriate.

These changes were instigated by the work of Michael Richardson.

Reviewed by:	pjd
Approved by:	re
2007-03-21 03:42:51 +00:00
Pawel Jakub Dawidek
97a669a3b2 Warn when user use sectorsize bigger than the page size, which will lead
to problems when the geli device is used with file system or as a swap.

Hopefully will prevent problems like kern/98742 in the future.

MFC after:	1 week
2007-03-05 12:41:44 +00:00
Pawel Jakub Dawidek
b942093961 Fix geli after last commit for UP systems that are running SMP kernel.
Submitted by:	Hyo geol, Lee <hyogeollee@gmail.com>
MFC after:	1 week
2007-03-02 09:38:16 +00:00
John Baldwin
4d70511ac3 Use pause() rather than tsleep() on stack variables and function pointers. 2007-02-27 17:23:29 +00:00
Matt Jacob
e770bc6bf5 First cut at GEOM based multipath. This is an active/passive{/passive...}
arrangement that has no intrinsic internal knowledge of whether devices
it is given are truly multipath devices. As such, this is a simplistic
approach, but still a useful one.

The basic approach is to (at present- this will change soon) use camcontrol
to find likely identical devices and and label the trailing sector of the
first one. This label contains both a full UUID and a name. The name is
what is presented in /dev/multipath, but the UUID is used as a true
distinguishor at g_taste time, thus making sure we don't have chaos
on a shared SAN where everyone names their data multipath as "Fred".

The first of N identical devices (and N *may* be 1!) becomes the active
path until a BIO request is failed with EIO or ENXIO. When this occurs,
the active disk is ripped away and the next in a list is picked to
(retry and) continue with.

During g_taste events new disks that meet the match criteria for existing
multipath geoms get added to the tail end of the list.

Thus, this active/passive setup actually does work for devices which
go away and come back, as do (now) mpt(4) and isp(4) SAN based disks.

There is still a lot to do to improve this- like about 5 of the 12
recommendations I've received about it,  but it's been functional enough
for a while that it deserves a broader test base.

Reviewed by: pjd
Sponsored by: IronPort Systems
MFC: 2 months
2007-02-27 04:01:58 +00:00
John Baldwin
6e50e38fcc Use tsleep() rather than msleep() with a NULL mtx parameter. 2007-02-23 23:06:10 +00:00
Nick Hibma
55fe33a350 Reduce the noise when plugging in (USB) mass storage devices, like a 4 port
flash card reader.
Also remove an 'Opened da0 -> <random number>' which is not needed on a daily
basis (available through bootverbose).

Reviewed by:	phk, ken
MFC after:	1 week
2007-02-21 07:45:02 +00:00
Craig Rodrigues
898b5f434b #include <sys/systm.h> before <sys/geom.h> to get KASSERT(), and fix LINT build. 2007-02-08 04:02:56 +00:00
Marcel Moolenaar
1d3aed33e8 Evolve the ctlreq interface added to geom_gpt into a generic
partitioning class that supports multiple schemes. Current
schemes supported are APM (Apple Partition Map) and GPT.
Change all GEOM_APPLE anf GEOM_GPT options into GEOM_PART_APM
and GEOM_PART_GPT (resp).

The ctlreq interface supports verbs to create and destroy
partitioning schemes on a disk; to add, delete and modify
partitions; and to commit or undo changes made.
2007-02-07 18:55:31 +00:00
Pawel Jakub Dawidek
1ded77b222 We expect 'bio_data != NULL' for BIO_{READ,WRITE,GETATTR}, but for
BIO_{DELETE,FLUSH} we expect 'bio_data == NULL'.

Reviewed by:	phk
2007-01-28 23:36:07 +00:00
Pawel Jakub Dawidek
a1ea1a22e9 It is possible that GEOM taste provider before SMP is started.
We can't bind to a CPU which is not yet on-line, so add code that wait for
CPUs to go on-line before binding to them.

Reported by:	Alin-Adrian Anton <aanton@spintech.ro>
MFC after:	2 weeks
2007-01-28 20:29:12 +00:00