geom_gate: Distinguish between classes of errorsThe geom_gate API provides 2 distinct paths for exchanging errordetails between the kernel and the userland client: Including an errorcode in the g
geom_gate: Distinguish between classes of errorsThe geom_gate API provides 2 distinct paths for exchanging errordetails between the kernel and the userland client: Including an errorcode in the g_gate_ctl_io structure passed in the ioctl(2) call orhaving the ioctl(2) call return -1 with an error code in errno. Thelatter reflects errors in the ioctl(2) call itself whilst the formerreflects errors within the geom_gate instance.The G_GATE_CMD_START ioctl blocks waiting for an I/O request to bedirected to the geom_gate instance and the wait can fail(necessitating an error return) if the geom_gate instance is destroyedor if the msleep(9) fails. The code previously treated both errorcases indentically: Returning ECANCELED as a geom_gate instance error(which the ggatec treats as a fatal error). Whilst this is the correctbehaviour if the geom_gate instance is destroyed, a msleep(9) failureis unrelated to the geom_gate instance itself and should be reportedas an ioctl(2) "failure". The distinction is important becausemsleep(9) can return ERESTART, which means the system call should beretried (and this will occur automatically as part of the genericsyscall return processing).This change alters the msleep(9) handling to directly return the errorcode from msleep(9), which ensures ERESTART is correctly handled,rather than being treated as a fatal error.Reviewed by: Johannes Totz <[email protected]>Differential Revision: https://reviews.freebsd.org/D33996(cherry picked from commit afcd1210246bebd8ed9bdaf31bd5218630af4cdc)
show more ...
Various fixes for ggatec and ggatedDynamically size buffers in ggatec. Instead of static size on the stack.Add flush support.Submitted by: Johannes Totz <[email protected]>Reviewed by: asomers
Various fixes for ggatec and ggatedDynamically size buffers in ggatec. Instead of static size on the stack.Add flush support.Submitted by: Johannes Totz <[email protected]>Reviewed by: asomersDifferential Revision: https://reviews.freebsd.org/D31722(cherry picked from commit 6226477a462f5ffbeacafdc9461524c95a7eb154)geom_gate: ensure readprov is null-terminatedWith crafted input to the G_GATE_CMD_CREATE ioctl, geom_gate can be madeto print kernel memory to the system console, potentially revealingsensitive data from whatever was previously in that memory page.But but but: this is a case of the sys admin misconfiguring, and you'dneed root privileges to do this.Submitted By: Johannes Totz <[email protected]>Reviewed By: asomersDifferential Revision: https://reviews.freebsd.org/D31727(cherry picked from commit f284bed200b04e48c4ae87a50f4a8a957b0a10ad)
geom: clean up empty lines in .c and .h files
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that arestill not MPSAFE (or already are but aren’t properly mark
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that arestill not MPSAFE (or already are but aren’t properly marked).Use it in preparation for a general review of all nodes.This is non-functional change that adds annotations to SYSCTL_NODE andSYSCTL_PROC nodes using one of the soon-to-be-required flags.Mark all obvious cases as MPSAFE. All entries that haven't been markedas MPSAFE before are by default marked as NEEDGIANTApproved by: kib (mentor, blanket)Commented by: kib, gallatin, melifaroDifferential Revision: https://reviews.freebsd.org/D23718
Pass BIO_SPEEDUP through all the geom layersWhile some geom layers pass unknown commands down, not all do. For the ones thatdon't, pass BIO_SPEEDUP down to the providers that constittue the geom,
Pass BIO_SPEEDUP through all the geom layersWhile some geom layers pass unknown commands down, not all do. For the ones thatdon't, pass BIO_SPEEDUP down to the providers that constittue the geom, asapplicable. No changes to vinum or virstor because I was unsure how to add thissupport, and I'm also unsure how to test these. gvinum doesn't implementBIO_FLUSH either, so it may just be poorly maintained. gvirstor is for testingand not supportig BIO_SPEEDUP is fine.Reviewed by: chsDifferential Revision: https://reviews.freebsd.org/D23183
Fix GEOM_GATE orphanization.Previous code closed and destroyed direct read consumer even with I/O stillin progress. This patch adds locking and request counting to postpone theclose till the las
Fix GEOM_GATE orphanization.Previous code closed and destroyed direct read consumer even with I/O stillin progress. This patch adds locking and request counting to postpone theclose till the last of running requests completes.MFC after: 2 weeksSponsored by: iXsystems, Inc.
GEOM: Reduce unnecessary log interleaving with sbufsSimilar to what was done for device_printfs in r347229.Convert g_print_bio() to a thin shim around g_format_bio(), which acts on ansbuf; docum
GEOM: Reduce unnecessary log interleaving with sbufsSimilar to what was done for device_printfs in r347229.Convert g_print_bio() to a thin shim around g_format_bio(), which acts on ansbuf; documented in g_bio.9.Reviewed by: markjDiscussed with: rlibbySponsored by: Dell EMC IsilonDifferential Revision: https://reviews.freebsd.org/D21165
geom_gate: enable resizeReviewed By: pjdApproved By: pjdDifferential Revision: https://reviews.freebsd.org/D11531
Annotate geom modules with MODULE_VERSIONGEOM ELI may double ask the password during boot. Once at loader time, andonce at init time.This happens due a module loading bug. By default GEOM ELI ca
Annotate geom modules with MODULE_VERSIONGEOM ELI may double ask the password during boot. Once at loader time, andonce at init time.This happens due a module loading bug. By default GEOM ELI caches thepassword in the kernel, but without the MODULE_VERSION annotation, thekernel loads over the kernel module, even if the GEOM ELI was compiled intothe kernel. In this case, the newly loaded modulepurges/invalidates/overwrites the GEOM ELI's password cache, which causesthe double asking.MFC Note: There's a pc98 component to the original submission that isomitted here due to pc98 removal in head. This part will need to be revivedupon MFC.Reviewed by: impSubmitted by: opObtained from: opBSDMFC after: 1 weekDifferential Revision: https://reviews.freebsd.org/D14992
sys/geom: adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone
sys/geom: adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - errorprone - task.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.
Use g_wither_provider() where applicable.It is just a helper function combining G_PF_WITHER setting withg_orphan_provider().
g_gate: for pointers replace 0 with NULL.These are mostly cosmetical, no functional change.Found with devel/coccinelle.
CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than tenyears for head. However, it is continuously misused as the mpsafe argumentfor callout_init(9). Deprecate the flag and cle
CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than tenyears for head. However, it is continuously misused as the mpsafe argumentfor callout_init(9). Deprecate the flag and clean up callout_init() callsto make them more consistent.Differential Revision: https://reviews.freebsd.org/D2613Reviewed by: jhbMFC after: 2 weeks
Pull in r267961 and r267973 again. Fix for issues reported will follow.
Revert r267961, r267973:These changes prevent sysctl(8) from returning proper output,such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1
Revert r267961, r267973:These changes prevent sysctl(8) from returning proper output,such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory
Extend the meaning of the CTLFLAG_TUN flag to automatically check ifthere is an environment variable which shall initialize the SYSCTLduring early boot. This works for all SYSCTL types both statica
Extend the meaning of the CTLFLAG_TUN flag to automatically check ifthere is an environment variable which shall initialize the SYSCTLduring early boot. This works for all SYSCTL types both statically anddynamically created ones, except for the SYSCTL NODE type and SYSCTLswhich belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added tobe used in the case a tunable sysctl has a custom initialisationfunction allowing the sysctl to still be marked as a tunable. Thekernel SYSCTL API is mostly the same, with a few exceptions for somespecial operations like iterating childrens of a static/extern SYSCTLnode. This operation should probably be made into a factored outcommon macro, hence some device drivers use this. The reason forchanging the SYSCTL API was the need for a SYSCTL parent OID pointerand not only the SYSCTL parent OID list pointer in order to quicklygenerate the sysctl path. The motivation behind this patch is to avoidparameter loading cludges inside the OFED driver subsystem. Instead ofadding special code to the OFED driver subsystem to post-load tunablesinto dynamically created sysctls, we generalize this in the kernel.Other changes:- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"to "hw.pcic.intr_mask".- Removed redundant TUNABLE statements throughout the kernel.- Some minor code rewrites in connection to removing not neededTUNABLE statements.- Added a missing SYSCTL_DECL().- Wrapped two very long lines.- Avoid malloc()/free() inside sysctl string handling, in case it iscalled to initialize a sysctl from a tunable, hence malloc()/free() isnot ready when sysctls from the sysctl dataset are registered.- Bumped FreeBSD version to indicate SYSCTL API change.MFC after: 2 weeksSponsored by: Mellanox Technologies
Merge GEOM direct dispatch changes from the projects/camlock branch.When safety requirements are met, it allows to avoid passing I/O requeststo GEOM g_up/g_down thread, executing them directly in
Merge GEOM direct dispatch changes from the projects/camlock branch.When safety requirements are met, it allows to avoid passing I/O requeststo 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 avoidseveral context switches per I/O.The defined now safety requirements are: - caller should not hold any locks and should be reenterable; - callee should not depend on GEOM dual-threaded concurency semantics; - on the way down, if request is unmapped while callee doesn't support it, the context should be sleepable; - kernel thread stack usage should be below 50%.To keep compatibility with GEOM classes not meeting above requirementsnew provider and consumer flags added: - G_CF_DIRECT_SEND -- consumer code meets caller requirements (request); - G_CF_DIRECT_RECEIVE -- consumer code meets callee requirements (done); - G_PF_DIRECT_SEND -- provider code meets caller requirements (done); - G_PF_DIRECT_RECEIVE -- provider code meets callee requirements (request).Capable GEOM class can set them, allowing direct dispatch in cases whereit is safe. If any of requirements are not met, request is queued tog_up or g_down thread same as before.Such GEOM classes were reviewed and updated to support direct dispatch:CONCAT, DEV, DISK, GATE, MD, MIRROR, MULTIPATH, NOP, PART, RAID, STRIPE,VFS, ZERO, ZFS::VDEV, ZFS::ZVOL, all classes based on g_slice KPI (LABEL,MAP, FLASHMAP, etc).To declare direct completion capability disk(9) KPI got new flag equivalentto G_PF_DIRECT_SEND -- DISKFLAG_DIRECT_COMPLETION. da(4) and ada(4) diskdrivers got it set now thanks to earlier CAM locking work.This change more then twice increases peak block storage performance onsystems with manu CPUs, together with earlier CAM locking changes reachingmore then 1 million IOPS (512 byte raw reads from 16 SATA SSDs on 4 HBAs to256 user-level threads).Sponsored by: iXsystems, Inc.MFC after: 2 months
Remove extra bio_data and bio_length copying to child request after callingg_clone_bio(), that already copied them.
We don't need buffer to handle BIO_DELETE, so don't check buffer size for it.This fixes handling BIO_DELETE larger than MAXPHYS.
In g_gate_dumpconf() always check the result of g_gate_hold().This fixes "Negative sc_ref" panic possible when sysctl_kern_geom_confxml()is run simultaneously with destroying GATE device.Reviewe
In g_gate_dumpconf() always check the result of g_gate_hold().This fixes "Negative sc_ref" panic possible when sysctl_kern_geom_confxml()is run simultaneously with destroying GATE device.Reviewed by: pjdMFC after: 3 days
Reorder things in g_gate_create() so at the moment when g_new_geomf()is called name is properly initialized.Discussed with: pjdMFC after: 2 weeks
Extend GEOM Gate class to handle read I/O requests directly within the kernel.This will allow HAST to read directly from the local component withouteven communicating userland daemon.Sponsored by
Extend GEOM Gate class to handle read I/O requests directly within the kernel.This will allow HAST to read directly from the local component withouteven communicating userland daemon.Sponsored by: Panzura, http://www.panzura.comMFC after: 1 month
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.The SYSCTL_NODE macro defines a list that stores all child-elements ofthat node. If there's no SYSCTL_DECL macro anywhere else,
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.The SYSCTL_NODE macro defines a list that stores all child-elements ofthat node. If there's no SYSCTL_DECL macro anywhere else, there's noreason why it shouldn't be static.
Include sys/sbuf.h directly.Reviewed by: pjd
Recognize BIO_FLUSH requests and pass them to userland.MFC after: 1 week
123