Commit Graph

1641 Commits

Author SHA1 Message Date
Alexander Motin
733a1f3f52 Clarify disks/volumes above 2TiB support in geom_raid:
- add support for volumes above 2TiB with Promise metadata format;
 - enforse and document other limitations:
   - Intel and Promise metadata formats do not support disks above 2TiB;
   - NVIDIA metadata format does not support volumes above 2TiB.

Sponsored by:	iXsystems, Inc.
MFC after:	2 weeks
2011-10-26 21:50:10 +00:00
Pawel Jakub Dawidek
92f84a9fae Allow upper layers to discover than BIO_DELETE and/or BIO_FLUSH is not
supported by returning EOPNOTSUPP instead of 0 or ENODEV.

MFC after:	3 days
2011-10-25 14:07:17 +00:00
Pawel Jakub Dawidek
37f0f0a75e Improve style a bit.
MFC after:	3 days
2011-10-25 14:05:39 +00:00
Pawel Jakub Dawidek
9495476273 Simplify disk_alloc().
MFC after:	3 days
2011-10-25 14:04:59 +00:00
Pawel Jakub Dawidek
1f8c92e6fa Add support for creating GELI devices with older metadata version for use
with older FreeBSD versions:
- Add -V option to 'geli init' to specify version number. If no -V is given
  the most recent version is used.
- If -V is given don't allow to use features not supported by this version.
- Print version in 'geli list' output.
- Update manual page and add table describing which GELI version is
  supported by which FreeBSD version, so one can use it when preparing GELI
  device for older FreeBSD version.

Inspired by:	Garrett Cooper <yanegomi@gmail.com>
MFC after:	3 days
2011-10-25 13:57:50 +00:00
Pawel Jakub Dawidek
effb9912c7 When decoding metadata, check magic string, so we know this is not GELI device
before we check its version. We don't want to report that some garbage is
unsupported version if this is not even GELI provider.

MFC after:	3 days
2011-10-25 13:44:23 +00:00
Pawel Jakub Dawidek
0e236b6c47 Prefer G_ELI_VERSION_* defines for version numbers over plain digits.
MFC after:	3 days
2011-10-25 13:09:22 +00:00
Pawel Jakub Dawidek
038c55adcc Fit lines into 80 chars.
MFC after:	3 days
2011-10-25 13:08:03 +00:00
Pawel Jakub Dawidek
e880ff0062 When metadata is at newer version than the highest supported, return
EOPNOTSUPP when decoding.

MFC after:	3 days
2011-10-25 07:48:53 +00:00
Marcel Moolenaar
369fe59de8 Add support for Boot Camp. The support is defined as follows:
o   Detect when Boot Camp is enabled (i.e. the MBR mirrors the GPT).
o   When Boot Camp is enabled, update the MBR whenever we write the GPT.
o   Creation of a Boot Camp enabled GPT is not supported.
o   Automatically disable Boot Camp when the GPT has been changed so that
    there's either no EFI partition or no HFS+ partition.
o   The first 4 partitions (by index) get mirrored in the MBR.

Requested by, discussed with and tested by: kris@pcbsd.org
MFC after: 1 week
2011-10-23 02:51:23 +00:00
Marius Strobl
479a4ef021 Allow to dump on Solaris swap partitions.
PR:		161764
Submitted by:	Peter Jeremy
2011-10-18 20:16:02 +00:00
Pawel Jakub Dawidek
8d680f2cc9 Add some spare fields to the g_class and g_geom structures needed to implement
direct I/O handling and provider's property changes handling.
2011-07-17 20:35:30 +00:00
Andrey V. Elsukov
0857ee8cb8 Remove include of sys/sbuf.h from geom/geom.h.
sbuf support is not always required for geom/geom.h users, and no need to
depend from it.

PR:		kern/158398
2011-07-11 10:02:27 +00:00
Andrey V. Elsukov
5d807a0e1a Include sys/sbuf.h directly.
Reviewed by:	pjd
2011-07-11 05:22:31 +00:00
Kirk McKusick
8795189c98 Allow disk partitions associated with UFS read-only mounted
filesystems to be opened for writing. This functionality used to
be special-cased for just the root filesystem, but with this change
is now available for all UFS filesystems. This change is needed for
journaled soft updates recovery.

Discussed with: Jeff Roberson
2011-07-10 00:41:31 +00:00
Andrey V. Elsukov
2b9be05588 Initialize elements of state array when creating the GPT table.
This fixes the problem, when the secondary GPT header is not erased when
partition table destroyed. Move equal operations from g_part_gpt_create
and g_part_gpt_recover to the separate function g_gpt_set_defaults.

Reported by:	dwhite
MFC after:	1 week
2011-06-29 05:41:14 +00:00
Andrey V. Elsukov
671dfdbf11 EBR could contain an early stage of boot code. But we do not support it.
Remove message about non empty bootcode, we can not break something
while GEOM_PART_EBR_COMPAT is defined.

But without GEOM_PART_EBR_COMPAT any changes in EBR are allowed and we
can accidentally wipe the boot code. To do not break anything save
the first EBR chunk and keep it untouched each time when we are
changing EBR. Note that we are still not support boot code for EBR.

PR:		kern/141235
MFC after:	1 month
2011-06-27 12:42:48 +00:00
Andrey V. Elsukov
61162e857a MS Windows NT+ uses 4 bytes at offset 0x1b8 in the MBR to identify
disk drive. The boot0cfg(8) utility preserves these 4 bytes when is
writing bootcode to keep a multiboot ability.
Change gpart's bootcode method to keep DSN if it is not zero. Also
do not allow writing bootcode with size not equal to MBRSIZE.

PR:		kern/157819
Tested by:	Eir Nym
MFC after:	1 month
2011-06-27 10:42:06 +00:00
Andrey V. Elsukov
503e6682cd Change the way how we update bootcode for BSD scheme.
Since the only parameter that we check is size of bootcode, then
allow only two sizes: size of boot1 and size of /boot/boot.
This partially protects users from losing ability to boot if incorrect
bootcode is specified.

Requested by:	ru
2011-06-20 12:22:30 +00:00
Justin T. Gibbs
416494d7c9 Plumb device physical path reporting from CAM devices, through GEOM and
DEVFS, and make it accessible via the diskinfo utility.

Extend GEOM's generic attribute query mechanism into generic disk consumers.
sys/geom/geom_disk.c:
sys/geom/geom_disk.h:
sys/cam/scsi/scsi_da.c:
sys/cam/ata/ata_da.c:
	- Allow disk providers to implement a new method which can override
	  the default BIO_GETATTR response, d_getattr(struct bio *).  This
	  function returns -1 if not handled, otherwise it returns 0 or an
	  errno to be passed to g_io_deliver().

sys/cam/scsi/scsi_da.c:
sys/cam/ata/ata_da.c:
	- Don't copy the serial number to dp->d_ident anymore, as the CAM XPT
	  is now responsible for returning this information via
	  d_getattr()->(a)dagetattr()->xpt_getatr().

sys/geom/geom_dev.c:
	- Implement a new ioctl, DIOCGPHYSPATH, which returns the GEOM
	  attribute "GEOM::physpath", if possible.  If the attribute request
	  returns a zero-length string, ENOENT is returned.

usr.sbin/diskinfo/diskinfo.c:
	- If the DIOCGPHYSPATH ioctl is successful, report physical path
	  data when diskinfo is executed with the '-v' option.

Submitted by:	will
Reviewed by:	gibbs
Sponsored by:	Spectra Logic Corporation

Add generic attribute change notification support to GEOM.

sys/sys/geom/geom.h:
	Add a new attrchanged method field to both g_class
	and g_geom.

sys/sys/geom/geom.h:
sys/geom/geom_event.c:
	- Provide the g_attr_changed() function that providers
	  can use to advertise attribute changes.
	- Perform delivery of attribute change notifications
	  from a thread context via the standard GEOM event
	  mechanism.

sys/geom/geom_subr.c:
	Inherit the attrchanged method from class to geom (class instance).

sys/geom/geom_disk.c:
	Provide disk_attr_changed() to provide g_attr_changed() access
	to consumers of the disk API.

sys/cam/scsi/scsi_pass.c:
sys/cam/scsi/scsi_da.c:
sys/geom/geom_dev.c:
sys/geom/geom_disk.c:
	Use attribute changed events to track updates to physical path
	information.

sys/cam/scsi/scsi_da.c:
	Add AC_ADVINFO_CHANGED to the registered asynchronous CAM
	events for this driver.  When this event occurs, and
	the updated buffer type references our physical path
	attribute, emit a GEOM attribute changed event via the
	disk_attr_changed() API.

sys/cam/scsi/scsi_pass.c:
	Add AC_ADVINFO_CHANGED to the registered asynchronous CAM
	events for this driver.  When this event occurs, update
	the physical patch devfs alias for this pass instance.

Submitted by:	gibbs
Sponsored by:	Spectra Logic Corporation
2011-06-14 17:10:32 +00:00
Attilio Rao
d7073a2b3b MFC 2011-06-03 17:09:15 +00:00
Alexander Motin
0330cb3bf7 Update disk's stripesize and stripeoffset parameters on provider open.
They are media-dependent and may change in run-time, same as sectorsize
and/or mediasize.

SCSI devices return physical sector size and offset via READ CAPACITY(16)
command and so can not report it until media inserted or at least until
probe sequence completed. UNMAP support is also reported there.
2011-06-03 13:49:18 +00:00
Andrey V. Elsukov
38c64884ff Add diagnostic message about not aligned partitions.
Idea from:	ivoras
2011-06-03 06:58:24 +00:00
Attilio Rao
3bf1ec3a9a MFC 2011-06-02 14:09:30 +00:00
Andrey V. Elsukov
d15033b3f8 Do not hide stripeoffset from libgeom(3), it may be useful even when
stripesize is zero.

MFC after:	1 week
2011-06-02 12:49:45 +00:00
Attilio Rao
9cb46334ee MFC 2011-05-27 16:09:10 +00:00
Andrey V. Elsukov
9854b4eeee Some partitioning tools may have a different opinion about disk
geometry and partitions may start from withing the first track.
If we found such partitions, then do not reserve space of the
first track, only first sector.
2011-05-27 06:37:42 +00:00
Attilio Rao
7fcdc9a26f MFC 2011-05-26 17:38:00 +00:00
Andrey V. Elsukov
ceef8f2477 Prevent non-aligned reading from provider while tasting. Reject
providers with unsupported sectorsize.

Reported by:	Joerg Wunsch
MFC after:	1 week
2011-05-25 11:14:26 +00:00
Andrey V. Elsukov
6fd1e2e013 Do not truncate available disk space to the closest track boundary. 2011-05-25 09:45:13 +00:00
Andrey V. Elsukov
23a3490034 Do not truncate available disk space to the closest track boundary. 2011-05-25 09:38:12 +00:00
Andrey V. Elsukov
db48d4a92e Do not truncate available disk space to the closest track boundary. 2011-05-25 09:32:19 +00:00
Andrey V. Elsukov
49d12fd5be Remove unused variable.
MFC after:	1 week
2011-05-24 06:46:07 +00:00
Andrey V. Elsukov
e471361279 Remove unused variable.
MFC after:	1 week
2011-05-24 06:44:16 +00:00
Attilio Rao
3ac3f6002b MFC 2011-05-23 23:58:02 +00:00
Pawel Jakub Dawidek
204a4e196a Recognize BIO_FLUSH requests and pass them to userland.
MFC after:	1 week
2011-05-23 21:00:37 +00:00
Attilio Rao
7e7a34e520 MFC 2011-05-16 16:34:03 +00:00
Andrey V. Elsukov
d0c8ecb812 Make diagnostic messages more specific. With bootverbose print out
all inconsistencies of integrity in the partition table, not first
found only.

Requested by:	kib
2011-05-16 15:59:50 +00:00
Andrey V. Elsukov
b6c4978f6f Add diagnostic messages for integrity checks. 2011-05-16 12:00:32 +00:00
Andrey V. Elsukov
6e81b75a3c Add a sysctl kern.geom.part.check_integrity for those who has corrupt
partition tables and lost an ability to boot after r221788.
Also unhide an error message from bootverbose, this would help to
easier determine the problem.
2011-05-15 20:03:54 +00:00
Attilio Rao
447274a88b MFC 2011-05-15 15:47:16 +00:00
Mikolaj Golub
76cc7f6dd6 Fix a memory leak possible in g_eli_key_allocate() if the key with the
same keyno is added while we aren't holding the lock.

Approved by:	pjd (mentor)
MFC after:	1 week
2011-05-15 12:39:30 +00:00
Attilio Rao
ef607a6aa3 MFC 2011-05-12 14:01:40 +00:00
Andrew Thompson
b2901e999b Move the three geom kprocs as threads under a single pid.
Reviewed by:	julian
2011-05-11 21:47:30 +00:00
Andrey V. Elsukov
c63e8fe201 Add basic metadata integrity check. In case when partition table was
probed and read successfull, but it contains invalid values (e.g.
overlapped partitions, offset or size is out of bounds), then table
will be rejected.

MFC after:	1 month
2011-05-11 19:59:43 +00:00
Attilio Rao
521bd6b433 MFC 2011-05-08 14:56:02 +00:00
Andrey V. Elsukov
f30b6bcb60 Limit number of sectors that can be addressed.
MFC after:	1 week
2011-05-08 12:28:13 +00:00
Andrey V. Elsukov
284a82d0bb Limit number of sectors that can be addressed.
MFC after:	1 week
2011-05-08 12:20:30 +00:00
Andrey V. Elsukov
6017ae3fdd Limit number of sectors that can be addressed.
Reject table if blkcount from metadata is greater than provider.
2011-05-08 12:16:39 +00:00
Andrey V. Elsukov
2920db1713 Limit number of sectors that can be addressed.
MFC after:	1 week
2011-05-08 12:11:16 +00:00