summaryrefslogtreecommitdiffstats
path: root/sys/geom
Commit message (Collapse)AuthorAgeFilesLines
* MFC r261618:delphij2014-02-221-0/+1
| | | | | | | | | | | | | In g_eli_crypto_hmac_init(), zero out after using the ipad buffer, k_ipad. Note that the two consumers in geli(4) are not affected by this issue because the way the code is constructed and as such, we believe there is no security impact with or without this change with geli(4)'s usage. Reported by: Serge van den Boom <serge vdboom.org> Reviewed by: pjd
* MFC r258448:marcel2014-02-161-5/+15
| | | | Have the GPT probe return a lower priority when the MBR is not a PMBR.
* MFC r258779,r258780,r258787,r258822:eadler2014-02-041-3/+3
| | | | | | | | | | | | | Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this shifts into the sign bit. Instead use (1U << 31) which gets the expected result. Similar to the (1 << 31) case it is not defined to do (2 << 30). This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD.
* MFC r260883:mav2014-02-021-1/+0
| | | | | Remove unneeded and dangerous assignment. It would probably cause NULL refererence panic if compiler not optimize it out.
* MFC r261084:ae2014-01-301-33/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | malloc() with M_WAITOK doesn't return NULL. MFC r261085: Fix typo in r261084. Add to the gctl_error() an ability to specify error description even if numeric error code is already specified. Also by default set error code to EINVAL. PR: 185852 MFC r261086: In gctl_copyin() remove unused error variable. geom_alloc_copyin() can't return ENOMEM, so describe its fail as bad control request. Add check for NULL pointer in gctl_dump(), since it can be NULL when geom_alloc_copyin() failed. MFC r261089: Remove another unneeded NULL check from geom_alloc_copyin(). Do copyout in case of gctl version mismatch and fix sbuf leak in g_ctl_ioctl_ctl(). MFC r261091: Always free sbuf in gctl_free().
* MFC r259925-259926:marck2014-01-213-0/+4
| | | | | | Add GPT UUID for VMware vSAN meta-data partition. Approved by: ae
* MFC r259634:ae2014-01-103-5/+25
| | | | | | | | | | | | | | | | | | Prevent users from deactivating the last component of a mirror. MFC r259929: Add an ability to stop gmirror and clear its metadata in one command. This fixes the problem, when gmirror starts again just after stop. The problem occurs when gmirror's component has geom label with equal size. E.g. gpt and gptid have the same size as partition, diskid has the same size as entire disk. When gmirror's geom has been destroyed, glabel creates its providers and this initiate retaste. Now "gmirror destroy" command is available. It destroys geom and also erases gmirror's metadata. PR: 184985
* MFC r258357:ae2014-01-102-5/+106
| | | | | | | Add "resize" verb to gmirror(8) and such functionality to geom_mirror(4). Now it is easy to expand the size of the mirror when all its components are replaced. Also add g_resize method to geom_mirror class. It will write updated metadata to new last sector, when parent provider is resized.
* MFC r258683:mav2014-01-093-22/+42
| | | | Escape special XML chars, returned by some devices, confusing XML parsers.
* MFC r258220, r258251:mav2014-01-092-26/+118
| | | | | | | | | | | | Implement automatic live resize support for GEOM MULTIPATH class. In "manual" mode just automatically resize provider in any direction. In "automatic" mode allow growth (with new metadata write); in case of shrinking check if there is already valid metadata found at the new location. This should allow easy transparent recovery if first resize was done by mistake. While there, unify metadata write code and fix minor memory leak.
* MFC Alexander Motin's GEOM direct dispatch work:scottl2014-01-0734-271/+532
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r256603: Introduce new function devstat_end_transaction_bio_bt(), adding new argument to specify present time. Use this function to move binuptime() out of lock, substantially reducing lock congestion when slow timecounter is used. r256606: Move g_io_deliver() out of the lock, as required for direct dispatch. Move g_destroy_bio() out too to reduce lock scope even more. r256607: Fix passing uninitialized bio_resid argument to g_trace(). r256610: Add unmapped I/O support to GEOM RAID. r256830: Restore BIO_UNMAPPED and BIO_TRANSIENT_MAPPING in biodonne() when unmapping temporary mapped buffer. That fixes double unmap if biodone() called twice for the same BIO (but with different done methods). r256880: Merge GEOM direct dispatch changes from the projects/camlock branch. When safety requirements are met, it allows to avoid passing I/O requests to GEOM g_up/g_down thread, executing them directly in the caller context. That allows to avoid CPU bottlenecks in g_up/g_down threads, plus avoid several context switches per I/O. r259247: Fix bug introduced at r256607. We have to recalculate bp_resid here since sizes of original and completed requests may differ due to end of media. Testing of the stable/10 merge was done by Netflix, but all of the credit goes to Alexander and iX Systems. Submitted by: mav Sponsored by: iX Systems
* MFC r257965:ae2013-12-141-2/+2
| | | | | | Add missing line breaks. PR: 181900
* MFC r256724:trasz2013-12-132-1/+13
| | | | | | | | | | | | Make geom_label(4) resize-aware. This fixes a situation when "gpart resize" would resize a partition, but label providers - e.g. /dev/gptid/XXX - would stay the same size. MFC r256766: Fix build with gcc by spelling unused format string as "unused" instead of NULL. Sponsored by: The FreeBSD Foundation
* MFC r256951:mjg2013-11-231-1/+1
| | | | | | | | | gnop: make sure that newly allocated memory for softc is zeroed This prevents mtx_init from encountering non-zeros and panicking the kernel as a result. Approved by: re
* MFC r257539:delphij2013-11-051-4/+4
| | | | | | | | | | | | | | | | | When zero'ing out a buffer, make sure we are using right size. Without this change, in the worst but unlikely case scenario, certain administrative operations, including change of configuration, set or delete key from a GEOM ELI provider, may leave potentially sensitive information in buffer allocated from kernel memory. We believe that it is not possible to actively exploit these issues, nor does it impact the security of normal usage of GEOM ELI providers when these operations are not performed after system boot. Security: possible sensitive information disclosure Submitted by: Clement Lecigne <clecigne google com> Approved by: re (glebius)
* Introduce a kern.geom.notaste sysctl that can be used to temporarilydes2013-09-243-1/+8
| | | | | | | | | | disable GEOM tasting to avoid the "bouncing GEOM" problem where, when you shut down the consumer of a provider which can be viewed in multiple ways (typically a mirror whose members are labeled partitions), GEOM will immediately taste that provider's alter ego and reattach the consumer. Approved by: re (glebius)
* Remove stub implementation.ae2013-09-051-11/+0
| | | | MFC after: 1 week
* Make ELI destruction (including orphanization) less aggressive, making itmav2013-09-021-10/+12
| | | | | | | always wait for provider close. Old algorithm was reported to cause NULL dereference panic on attempt to close provider after softc destruction. If not global workaroung in GEOM, that could even cause destruction with requests still in flight.
* MFprojects/camlock r254895:mav2013-08-261-4/+28
| | | | Add unmapped BIO support to GEOM ZERO if kern.geom.zero.clear is cleared.
* Add new attribute lunname to report only textual LUN-specific device IDs.mav2013-08-241-0/+6
| | | | | While lunid attribute prefers to report numeric ones, having both may be useful in some situations.
* Change the way that unmapped I/O capability is advertised.ken2013-08-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous method was to set the D_UNMAPPED_IO flag in the cdevsw for the driver. The problem with this is that in many cases (e.g. sa(4)) there may be some instances of the driver that can handle unmapped I/O and some that can't. The isp(4) driver can handle unmapped I/O, but the esp(4) driver currently cannot. The cdevsw is shared among all driver instances. So instead of setting a flag on the cdevsw, set a flag on the cdev. This allows drivers to indicate support for unmapped I/O on a per-instance basis. sys/conf.h: Remove the D_UNMAPPED_IO cdevsw flag and replace it with an SI_UNMAPPED cdev flag. kern_physio.c: Look at the cdev SI_UNMAPPED flag to determine whether or not a particular driver can handle unmapped I/O. geom_dev.c: Set the SI_UNMAPPED flag for all GEOM cdevs. Since GEOM will create a temporary mapping when needed, setting SI_UNMAPPED unconditionally will work. Remove the D_UNMAPPED_IO flag. nvme_ns.c: Set the SI_UNMAPPED flag on cdevs created here if NVME_UNMAPPED_BIO_SUPPORT is enabled. vfs_aio.c: In aio_qphysio(), check the SI_UNMAPPED flag on a cdev instead of the D_UNMAPPED_IO flag on the cdevsw. sys/param.h: Bump __FreeBSD_version to 1000045 for the switch from setting the D_UNMAPPED_IO flag in the cdevsw to setting SI_UNMAPPED in the cdev. Reviewed by: kib, jimharris MFC after: 1 week Sponsored by: Spectra Logic
* Return error when opening read-only volumes (like RAID4/5/...) for writing.mav2013-08-133-1/+8
| | | | | | | Previously opens succeeded, but actual write operations returned errors. Requested by: peter MFC after: 2 weeks
* Oops, wrong constant at r254269.mav2013-08-131-1/+1
|
* Fix reasonable but safe Clang warnings.mav2013-08-131-2/+6
|
* Fix the formatting of the error message.ed2013-08-121-2/+2
| | | | | The G_MIRROR_DEBUG() macro already appends a newline. Also, most of the log messages emitted by gmirror start with an uppercase letter.
* gpt_entries is used as limit for the number of partition entries inae2013-08-081-2/+3
| | | | | | | | the GEOM_PART. Instead of just using number of entries from the GPT header, calculate this limit based on the reserved space between GPT header and first available LBA. MFC after: 2 weeks
* Change <sys/diskpc98.h> to not redefine the same symbols that aremarcel2013-08-072-19/+20
| | | | | | | | | | | | | | | | being defined in <sys/diskmbr.h>. Instead give the symbols here a "PC98_" prefix. This way, both <sys/diskmbr.h> and <sys/diskpc98.h> can be included in the same C source file. The renaming is trivial. The only gotcha is that DOSBBSECTOR is also redefined from 0 to 1. This because DOSBBSECTOR was always used in conjunction with an addition of 1. The PC98_BBSECTOR symbol is defined as 1 and the expression is simplified. Note: it is not believed that ports are seriously impacted; or at all for that matter. Approved by: nyan@
* Remove inclusion of <sys/diskmbr.h>. We have no business knowingmarcel2013-08-042-2/+0
| | | | anything related to MBR in this file.
* Introduce 3 seconds timeout on `graid stop` command (mostly with -f flag).mav2013-07-272-11/+8
| | | | | Since completion waiting goes in g_event thread, it may cause GEOM deadlock if consumer on top (for example, ZFS) uses g_event thread for closing.
* When panicing due to the gjournal overflow, print the geom metadatakib2013-07-101-1/+3
| | | | | | | journal id. Requested by: Andreas Longwitz <longwitz@incore.de> MFC after: 1 week
* There are several code sequences likekib2013-07-091-1/+1
| | | | | | | | | | | | | | | | | | | vfs_busy(mp); vfs_write_suspend(mp); which are problematic if other thread starts unmount between two calls. The unmount starts a write, while vfs_write_suspend() drain writers. On the other hand, unmount drains busy references, causing the deadlock. Add a flag argument to vfs_write_suspend and require the callers of it to specify VS_SKIP_UNMOUNT flag, when the call is performed not in the mount path, i.e. the covered vnode is not locked. The suspension is not attempted if VS_SKIP_UNMOUNT is specified and unmount is in progress. Reported and tested by: Andreas Longwitz <longwitz@incore.de> Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
* Bump disk(9) ABI version to signify the addition of d_delmaxsize by r249940.smh2013-07-032-9/+8
| | | | | | | | | | | Ensure that d_delmaxsize is always set, removing init to 0 which could cause future issues if use cases change. Allow kern.cam.da.X.delete_max (which maps to d_delmaxsize) to be increased up to the calculated max after being reduced. MFC after: 1 day X-MFC-With: r249940
* - Add a general purpose resource allocator, vmem, from NetBSD. It wasjeff2013-06-281-12/+3
| | | | | | | | | | | | | | originally inspired by the Solaris vmem detailed in the proceedings of usenix 2001. The NetBSD version was heavily refactored for bugs and simplicity. - Use this resource allocator to allocate the buffer and transient maps. Buffer cache defrags are reduced by 25% when used by filesystems with mixed block sizes. Ultimately this may permit dynamic buffer cache sizing on low KVA machines. Discussed with: alc, kib, attilio Tested by: pho Sponsored by: EMC / Isilon Storage Division
* Fix a mystery cut-n-paste corruption from the previous commit.scottl2013-06-191-1/+1
| | | | Submitted by: Brenden Fabeny
* Mark geom_mirror as capable of unmapped i/oscottl2013-06-191-5/+18
| | | | | Obtained from: Netflix MFC after: 3 days
* Make CAM return and GEOM DISK pass through new GEOM::lunid attribute.mav2013-06-121-1/+24
| | | | | | | | | | | | | | | | | | SPC-4 specification states that serial number may be property of device, but not a specific logical unit. People reported about FC storages using serial number in that way, making it unusable for purposes of LUN multipath detection. SPC-4 states that designators associated with logical unit from the VPD page 83h "Device Identification" should be used for that purpose. Report first of them in the new attribute in such preference order: NAA, EUI-64, T10 and SCSI name string. While there, make GEOM DISK properly report GEOM::ident in XML output also using d_getattr() method, if available. This fixes serial numbers reporting for SCSI disks in `geom disk list` output and confxml. Discussed with: gibbs, ken Sponsored by: iXsystems, Inc. MFC after: 2 weeks
* Don't update provider properties and don't set DISKFLAG_OPEN if d_open()mav2013-06-111-0/+2
| | | | | disk method call returned error. GEOM considers devices in such case as still closed, and won't call symmetric d_close() for them.
* Change the set and unset ctlreqs by making the index argument optional.marcel2013-06-095-35/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows setting attributes on tables. One simply does not provide an index in that case. Otherwise the entry corresponding the index has the attribute set or unset. Use this change to fix a relatively longstanding bug in our GPT scheme that's the result of rev 198097 (relatively harmless) followed by rev 237057 (damaging). The damaging part being that our GPT scheme always has the active flag set on the PMBR slice. This is in violation with EFI. Existing EFI implementions for both x86 and ia64 reject the GPT. As such, GPT disks created by us aren't usable under EFI because of that. After this change, GPT disks never have the active flag set on the PMBR slice. In order to make the GPT disk bootable under some x86 BIOSes, the reason of rev 198097, one must now set the active attribute on the gpt table. The kernel will apply this to the PMBR slice For (S)ATA: gpart set -a active ada0 To fix an existing GPT disk that has the active flag set in the PMBR, and that does not need the flag, use (again for (S)ATA): gpart unset -a active ada0 The EBR, MBR & PC98 schemes, which also impement at least 1 attribute, now check to make sure the entry passed is valid. They do not have attributes that apply to the table.
* Remove stub implementation.marcel2013-06-091-11/+0
|
* MFP4 @222836brooks2013-05-301-2/+5
| | | | | | Add support for partitioning CFI disks from FDT using geom_flashmap. Sponsored by: DARPA, AFRL
* Remove an extra semicolon from the DOT language output.jh2013-05-211-1/+1
| | | | | | PR: kern/178540 Submitted by: Trond Endrestol MFC after: 1 week
* Fix vdc->Secondary_Element_Count metadata field access from 16 to 8 bit.mav2013-05-201-1/+1
| | | | | | | In some cases it could cause kernel panic during failed drive replacement. Reported by: trasz MFC after: 1 week
* - Use int8_t type for the mftrecsz field in g_label_ntfs. char typestas2013-05-051-3/+4
| | | | | | | | used previously caused probe failure on platforms where char is unsigned (e.g. ARM), as mftrecsz can be negative. Submitted by: Ilya Bakulin <ilya@bakulin.de> MFC after: 2 weeks
* Return "descr" field alike to "Intel RAID1 volume" for GEOM RAID to makemav2013-04-271-0/+4
| | | | it look better in bsdinstall.
* Teach GEOM and CAM about the difference between the max "size" of r/w and deletesmh2013-04-262-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | requests. sys/geom/geom_disk.h: - Added d_delmaxsize which represents the maximum size of individual device delete requests in bytes. This can be used by devices to inform geom of their size limitations regarding delete operations which are generally different from the read / write limits as data is not usually transferred from the host to physical device. sys/geom/geom_disk.c: - Use new d_delmaxsize to calculate the size of chunks passed through to the underlying strategy during deletes instead of using read / write optimised values. This defaults to d_maxsize if unset (0). - Moved d_maxsize default up so it can be used to default d_delmaxsize sys/cam/ata/ata_da.c: - Added d_delmaxsize calculations for TRIM and CFA sys/cam/scsi/scsi_da.c: - Added re-calculation of d_delmaxsize whenever delete_method is set. - Added kern.cam.da.X.delete_max sysctl which allows the max size for delete requests to be limited. This is useful in preventing timeouts on devices who's delete methods are slow. It should be noted that this limit is reset then the device delete method is changed and that it can only be lowered not increased from the device max. Reviewed by: mav Approved by: pjd (mentor)
* Added a sysctl (kern.geom.dev.delete_max_sectors) to control the maximumsmh2013-04-261-5/+22
| | | | | | | | | | | | | | | | | | | | | | size of a delete request sent to the providing device performed by g_dev_ioctl. This allows the kernel and apps via ioctl e.g. newfs -E to request large LBA deletes which siginificantly improves performance. Previously this was hard coded to 65536 sectors, the new default is 262144 which doubles the throughput of deletes on commonly available SSD's. In tests on a Intel 520 120GB FW: 400i disk it improved the delete throughput from 1.6GB/s to over 2.6GB/s on a full disk delete such as that done via newfs -E For some SSD's where delete time is pretty much constant, no matter what the request, setting this to 0 will provide significantly better throughput e.g. Samsung 840 240GB FW DXT07B0Q @ 262144 = 79G/s, @ 0 = 2259G/s Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
* Comment typo fix.ivoras2013-04-161-2/+2
| | | | Is aware of the importance of comments: dim
* Fix the buffer-overflow-fixing fixes.ivoras2013-04-161-15/+19
| | | | | | Pointy-hat to: me, for not realizing snprintf() is available in kernel. Thanks to: jh, for bringing me the good news of snprintf(), Pawel Worach, for noting that the panic can be provoked in i386 and not in amd64
* Partial MFP4 of 222836:brooks2013-04-161-1/+1
| | | | | | | | | | | Only look for FDT partitions if our potential parent is a DISK device. Excluding direct recursion on the flashmap geoms was insufficient because it did not prevent the underlying device from being retrieved if flashmap geoms were further partitioned. Reviewed by: imp Sponsored by: DARPA, AFRL
* Introduce glabel labels based on GEOM ident attributes. In this initialivoras2013-04-153-1/+87
| | | | | | | | implementation, error on the side of conservatism and only create labels for GEOMs of classes DISK and MULTIPATH. Discussed with: trasz Approved by: silence from freebsd-geom@
OpenPOWER on IntegriCloud