Commit Graph

1351 Commits

Author SHA1 Message Date
Ivan Voras
f7b16839ba Create GEOM labels from UFS IDs, e.g. /dev/ufsid/49c97b1faa2adc43. UFS IDs
are always present and can be used to identify file systems (useful if
hardware devices move often).

Actually-by:	pjd
Approved by:	gnn (mentor)
2009-03-25 20:38:57 +00:00
Ivan Voras
15c48b9a20 Be more explicit and complain if kernel dumps are perfomed on unsupported
partition types. This is to help users used to the old behaviour.

Reviewed by:	marcel
Approved by:	gnn (mentor)
2009-03-22 00:29:48 +00:00
Ivan Voras
94dd506d54 Make GEOM provider names starting with "/dev/" acceptable as well as their
"raw" names. While there, change the formatting of extended MSDOS partitions
so that the dot (".") is not used to separate two numbers (which kind of
looks like the whole is a decimal number). Use "+" instead, which also
hints that the second part of the name is the offset from the start of
the partition in the first part of the name. Also change the offset from
decimal to hexadecimal notation, simply for aesthetic reasons and future
compatibility.

GEOM_PART is the default in 8-CURRENT but not yet in 7-STABLE so this
changeset can be MFC-ed without causing major problems from the second
part.

Reviewed by:	marcel
Approved by:	gnn (mentor)
MFC after:	2 weeks
2009-03-19 14:23:17 +00:00
Pawel Jakub Dawidek
c5d387d010 Detach GELI providers on shutdown/reboot, which will allow providers underneath
to close properly.

Reported, reviewed and tested by:	guido
MFC after:	1 week
2009-03-16 19:31:08 +00:00
Guido van Rooij
921eec2694 Backout this commit whil a better solution is developed 2009-03-13 08:13:51 +00:00
Yoshihiro Takahashi
8753b93d95 Move the PC98_[MS]ID_* defines from g_part_pc98.c to diskpc98.h.
Reviewed by:	marcel
2009-03-11 13:15:42 +00:00
Sam Leffler
664c0b48bf o disallow write to RedBoot and FIS directory partitions; these are painful
to resurrect (maybe honor foot shooting bit in kern.geom_debugflags)
o fix match macro so we now recognize we want to merge FIS dir with RedBoot
  config parameters even if we don't actually do it
2009-03-11 01:12:52 +00:00
Guido van Rooij
c5f79858ff When attaching a geli on boot make sure that it is detached
upon last close. (needed for a gmirror to properly shutdown
upon reboot when a geli is on top the gmirror)
2009-03-10 15:23:43 +00:00
Yoshihiro Takahashi
9541ada9a0 Restore the return statement. It was accidentally removed by rev 188429. 2009-03-10 11:14:03 +00:00
Sam Leffler
443f1e7991 add geom_redboot, a geom module that exports RedBoot FIS partitions as named
slices in dev/redboot/*
2009-03-09 23:18:36 +00:00
Marcel Moolenaar
232c8bf888 o When creating the EBR scheme, set the number of entries
properly. Otherwise the minimum of 1 is used and you can
   only insert a single partition/slice and only at sector
   0 (index 1).
o  When adding a partition/slice, recalculate the index after
   the start and size of the partition/slice are adjusted to
   make them a multiple of the track size. Since the precheck
   method sets the index based on the start of the partition
   as provided by the user, we know that we're off by at most
   1 and adjusting the index is safe.
2009-02-21 19:25:13 +00:00
Marcel Moolenaar
4dedfc44e7 Add bootcode handling. 2009-02-21 07:01:21 +00:00
Marcel Moolenaar
59c532c500 Provide compatibility symlink for logical partitions:
1.  Extend geom_dev by having it create the symlink (i.e. call
    make_dev_alias) based on the DIOCGPROVIDERALIAS ioctl.
    In this way the functionaility is generic and thus usable
    by any geom/provider.
2.  Have g_part handle said ioctl through the devalias method,
    so that it's under control of the scheme itself. By design
    the alias will not be created for newly added partitions.
2009-02-20 04:48:40 +00:00
Marcel Moolenaar
507a0d4a6c Fix an infinite loop created when the last logical partition is
removed.
2009-02-20 04:10:31 +00:00
Marcel Moolenaar
09a278e14d Add a default implementation for pre-check. It should
always succeed if not implemented.

Pointy hat: marcel
2009-02-17 18:24:58 +00:00
Marcel Moolenaar
832cdc2ca7 Remove gpt_offset and related code. It was introduced for use
by the BSD scheme, ended up not to be needed. Remove to avoid
abuse and to keep the bloat to a minimum.
2009-02-17 04:12:10 +00:00
Marcel Moolenaar
e24c8a3fb8 Add support to add, delete and modify logical partitions, as well
as to create and destroy the extended partitioning scheme. In
other words: full support.
2009-02-16 03:54:28 +00:00
Marcel Moolenaar
7ca4fa83ec Add method precheck to the g_part interface. The precheck
method allows schemes to reject the ctl request, pre-check
the parameters and/or modify/set parameters. There are 2
use cases that triggered the addition:
1.  When implementing a R/O scheme, deletes will still
    happen to the in-memory representation. The scheme is
    not involved in that operation. The pre-check method
    can be used to fail the delete up-front. Without this
    the write to disk will typically fail, but at that
    time the delete already happened.
2.  The EBR scheme uses a linked list to record slices.
    There's no index. The EBR scheme defines the index
    as a function of the start LBA of the partition. The
    add verb picks an index for the range and then invokes
    the add method of the scheme to fill in the blanks. It
    is too late for the add method to change the index.
    The pre-check is used to set the index up-front. This
    also (silently) overrides/nullifies any (pointless)
    user-specified index value.
2009-02-15 22:18:16 +00:00
Ulf Lilleengen
af2c6a1332 - Use the correct argument when determining the buffer size.
PR:		kern/131575
MFC after:	2 days
2009-02-11 18:13:20 +00:00
Warner Losh
51f53a08e0 Fix g_part_dumpconf and g_part_name prototpyes.
Submitted by:	marcel@
2009-02-10 02:43:07 +00:00
Marcel Moolenaar
5d68db5bc8 Add the EBR scheme. The EBR scheme supports the Extended Boot Records
found inside extended partitions and used to create logical partitions.
At this time write/modify support is not (yet) present.
The EBR and MBR schemes both check the parent scheme. The MBR will
back-off when nested under another MBR, whereas the EBR only nests
under a MBR.
2009-02-08 23:51:44 +00:00
Marcel Moolenaar
665557a4ec Allow gpe_offset to be set by the scheme. When gpe_offset is zero,
or invalid, initialize it to the start of the partition. Adjust
the mediasize when the offset lies somewhere inside the partition.
2009-02-08 23:39:30 +00:00
Marcel Moolenaar
165651a553 o Add the "PART::scheme" attribute that returns the name of the
underlying partitioning scheme.
o  Put the start and end of the partition in the XML configuration.
   The start and end are the LBAs of the first and last sector
   (resp.) of the partition. They are currently identical to the
   offset and size attributes, which describe the partition as an
   offset and size in bytes, but may not in the future. The start
   and end will be used for the logical partition boundaries and
   may include metadata. The offset and size will always represent
   the useful storage space within the partition. Typically these
   two notions are the same, but for logical partitions in an
   extended partition, the EBR is more naturally treated as being
   part of the partition.
2009-02-08 20:15:08 +00:00
Warner Losh
f4fddf53c7 Fix g_part_*dumpconf to return void to match kobj definition.
Fix g_part_*name to return a const char * rather than a char *.
2009-02-08 07:05:23 +00:00
Marcel Moolenaar
da3ee90988 In g_handleattr(), set bp->bio_completed also for the case
where len is 0. Otherwise g_getattr() will never succeed
when it is handled by g_handleattr_str().
2009-02-03 07:07:13 +00:00
Marcel Moolenaar
709a626613 Constify val in g_handleattr() and str in g_handleattr_str().
This allows passing string constants to g_handleattr_str().
2009-02-01 01:50:09 +00:00
Ed Schouten
739b705c7e Remove unused unrhdr from GEOM character device module.
Now that make_dev() doesn't require unit numbers to be unique, there is
no need to use an unrhdr here to generate the numbers. Remove the entire
init-routine, because it is optional.
2009-01-24 18:23:19 +00:00
Edward Tomasz Napierala
38153e80f7 Prevent a panic that happens on SMP machines when removing a disk with
many writes queued up.

Reviewed by:	phk, scottl
Approved by:	rwatson (mentor)
Sponsored by:	FreeBSD Foundation
2009-01-11 13:51:04 +00:00
Marius Strobl
c825397790 - Don't enforce an upper-bound to the number of sectors or heads,
allowing the full 16-bit width of the corresponding fields in the
  VTOC8 label to be used. The removed limits basically only held
  true for providers labeled using the synthetic geometry provided
  by cam_calc_geometry(9) but neither SCSI disks labeled with Solaris
  nor sufficiently large ATA disks.
- Given that providers (originally) labeled with Solaris typically
  use the native geometry as reported by the target while FreeBSD
  typically uses a synthetic one put the message complaining about
  mismatching geometries between what the label indicates and what
  GEOM thinks the provider has, which we generally can't help,
  under bootverbose in order to not unnecessarily scare users.
- For informational purposes add the non-matching values to the
  message complaining about them, similar to what r186501 did for
  g_part_bsd_read() except also indicating the origin of the
  values.
- Make it clear that the messages emitted by this code refer to
  the VTOC8 support rather than to another existing scheme or to
  VTOC32.
2009-01-06 14:10:10 +00:00
Marcel Moolenaar
3d556594df Don't enforce an upper-bound to the number of sectors or heads
that that the provider has. The limits we imposed were PC BIOS
specific and not always applicable.
2009-01-06 06:47:53 +00:00
Marcel Moolenaar
90886ebcc2 Improve probing.
o   Don't check the dummy fields.
o   The entry is unused if either dp_mid is 0 or dp_sid is 0.
o   The start or end cylinder cannot be 0.
o   The start CHS cannot be equal to the end CHS.

Submitted by:	nyan
2009-01-04 07:32:06 +00:00
Ulf Lilleengen
2155338ac1 - Fix an issue with access permissions to underlying disks used by a gvinum
plex. If the plex is a raid5 plex, and is being written to, parity data might
  have to be read from the underlying disks, requiring them to be opened for
  reading as well as writing.

MFC after:	1 week
2008-12-27 14:32:39 +00:00
David E. O'Brien
62a353c0bd When the geometry does not match the label, print out the values. 2008-12-26 20:27:32 +00:00
Edward Tomasz Napierala
ce8be7b8b0 Implement g_vfs_orphan(). Without it, the filesystem never closes
the device, which means refcount on periph drivers never drops,
which means cam_sim_free() never returns, which results in umass
sleeping there ad infinitum.

Submitted by:	pjd
Reviewed by:	scottl, pjd
Approved by:	rwatson (mentor)
Sponsored by:	FreeBSD Foundation
2008-12-16 17:04:52 +00:00
Ulf Lilleengen
fa13e9bb0b - Add missing word in comment. 2008-12-08 17:09:02 +00:00
Edward Tomasz Napierala
d27a975f72 Make it possible to use gjournal for the root filesystem. Previously,
an unclean shutdown would make it impossible to mount rootfs at boot.

PR:		kern/128529
Reviewed by:	pjd
Approved by:	rwatson (mentor)
Sponsored by:	FreeBSD Foundation
2008-12-06 11:33:10 +00:00
Ivan Voras
499c86ebd5 Trivial patch to show on which geom has the error been detected.
Submitted by:	Rick C. Petty
Approved by:	gnn (mentor)
MFC after:	1 month
2008-12-01 15:02:00 +00:00
Marcel Moolenaar
6647711279 Allow boot code to be smaller than what the scheme expects.
This effectively changes the boot code size to be an upper
bound and makes the interface more flexible.
2008-12-01 00:07:17 +00:00
Marcel Moolenaar
95fc269897 Allow dumpon to a partition of type FS_UNUSED as well. 2008-11-26 05:18:27 +00:00
Ulf Lilleengen
251048a1ab - Fix a potential NULL pointer reference. Note that this should not happen in
practice, but it is a good programming practice and allows the kernel to not
  depend on userland correctness.
- While there, make sizeof usage match the rest of the code.

Found with:	Coverity Prevent(tm)
CID:		660, 662
2008-11-25 20:28:33 +00:00
Ulf Lilleengen
7e11b694f4 - Fix a potential NULL pointer reference. Note that this cannot happen in
practice, but it is a good programming practice nontheless and it allows the
  kernel to not depend on userland correctness.

Found with:   Coverity Prevent(tm)
CID:          655-659, 664-667
2008-11-25 19:13:58 +00:00
Marcel Moolenaar
1a696559de Partition type FS_UNUSED does not mean the partition entry
is unused. Unused partition entries have a partition size
of zero. Therefore, partitions can have type FS_UNUSED.

MFC after:	3 days
2008-11-18 05:55:58 +00:00
Marcel Moolenaar
dd0db05da2 Fix a panic caused by a corrupted table when the header is
still valid. We were checking the state of the header and
not the table.

PR:		119868
Based on a patch from:	Jaakko Heinonen <jh@saunalahti.fi>
MFC after: 1 week
2008-11-06 16:51:33 +00:00
Attilio Rao
83b3bdbc8a Improve VFS locking:
- Implement real draining for vfs consumers by not relying on the
  mnt_lock and using instead a refcount in order to keep track of lock
  requesters.
- Due to the change above, remove the mnt_lock lockmgr because it is now
  useless.
- Due to the change above, vfs_busy() is no more linked to a lockmgr.
  Change so its KPI by removing the interlock argument and defining 2 new
  flags for it: MBF_NOWAIT which basically replaces the LK_NOWAIT of the
  old version (which was unlinked from the lockmgr alredy) and
  MBF_MNTLSTLOCK which provides the ability to drop the mountlist_mtx
  once the mnt interlock is held (ability still desired by most consumers).
- The stub used into vfs_mount_destroy(), that allows to override the
  mnt_ref if running for more than 3 seconds, make it totally useless.
  Remove it as it was thought to work into older versions.
  If a problem of "refcount held never going away" should appear, we will
  need to fix properly instead than trust on such hackish solution.
- Fix a bug where returning (with an error) from dounmount() was still
  leaving the MNTK_MWAIT flag on even if it the waiters were actually
  woken up. Just a place in vfs_mount_destroy() is left because it is
  going to recycle the structure in any case, so it doesn't matter.
- Remove the markercnt refcount as it is useless.

This patch modifies VFS ABI and breaks KPI for vfs_busy() so manpages and
__FreeBSD_version will be modified accordingly.

Discussed with:	kib
Tested by:	pho
2008-11-02 10:15:42 +00:00
Warner Losh
0952268ecd Add support for reading Tivo Series 1 partitioning. This likely needs
a little refinement, but is good enough to commit as is.

# Should look to see if I should move swab(3) into the kernel or just
# provide the unoptimized routine here.

Reviewed by:	marcel@
2008-11-02 03:02:56 +00:00
Konstantin Belousov
f5dfdb519f Revert r184136. Instead, push the check for crashdumpmap overflow into the
MD i386 and amd64 dump code.

Requested by:	jhb
Retested by:	pho
MFC after:	3 days (+ 176304 + 184136)
2008-10-31 10:11:35 +00:00
Ulf Lilleengen
86b3c6f5bc - Import macros used in gmirror for printing gvinum debug messages and making
the output more standardized.
- Add a sysctl to set the verbosity of the debug messages.
- While there, fixup typos and wording in the messages.
2008-10-26 17:20:37 +00:00
Marcel Moolenaar
38a2db2eb0 Invalid BSD disklabels have been created by sysinstall and
are possibly still being created. The d_secperunit field
contains the number of sectors of the disk and not of the
slice/partition to which the disklabel applies.
Rather than reject the disklabel, we now silently adjust
the field. Existing code, like bslabel(8), does not seem
to check the label that extensively and seems to adjust
fields as a side-effect as well.
In other words, it's not that important apparently, so
gpart should not be too strict about it.

Reported by: nyan@
Reported by: Andriy Gapon <avg@icyb.net.ua>
2008-10-25 17:21:46 +00:00
Marcel Moolenaar
66fedfca7b Allow dumps to partitions with a tag of 0. The legacy
sunlabel implementation in FreeBSD does not use VTOC
information and as such as no partition types.
2008-10-22 02:08:54 +00:00
Konstantin Belousov
7a882637fe Do not overflow crashdumpmap.
Reported and tested by:	pho
Reviewed by:	jhb
MFC after:	1 week
2008-10-21 18:52:38 +00:00