Eric Joyner [Thu, 2 Jan 2020 23:16:27 +0000 (23:16 +0000)]
MFC r354977: bitstring: add functions to find contiguous set/unset bit sequences
This MFC also includes extra commits that improve on the original:
r355032: bitstring: Fix error messages in tests for area functions
r355377: Improve bit_ffc_area and bit_ffs_area_at implementation
r355400: bitstring: avoid gcc -Wsign-compare
Ian Lepore [Thu, 2 Jan 2020 19:52:01 +0000 (19:52 +0000)]
MFC r347828 (by cem):
xdma(4): Fix invalid pointer use (breaks arm.SOCFPGA build)
In xdma_handle_mem_node(), vmem_size_t and vmem_addr_t pointers were passed to
an FDT API that emits u_long values to the output parameter pointer. This
broke on systems with both xdma and 32-bit vmem size/addr types (SOCFPGA).
Rick Macklem [Tue, 31 Dec 2019 18:10:34 +0000 (18:10 +0000)]
MFC: r356066
Fix nfsmount() so that it will return NFSERR_MINORVERMISMATCH.
If nfsrpc_getdirpath() returns NFSERR_MINORVERMISMATCH, it would erroneously
get mapped to EIO. This was not particularily harmful, but would make it
hard for sysadmins to diagnose why an NFSv4 mount is failing.
mount_nfs.c still needs to be fixed so that it does not report
NFSERR_MINORVERMISMATCH as an unknown error 10021.
Kyle Evans [Mon, 30 Dec 2019 00:16:58 +0000 (00:16 +0000)]
MFC r356103: cron(8): use proper variable to determine mailer process status
While the mailer is normally opened/set if the mailto is set, this is not
the case if the grandchild actually didn't produce any output. This change
corrects the situation to only attempt to kill/close the mail process if it
was actually opened in the first place.
The reporter initially stumbled on the -n (suppress mail on success) flag
leading to a SIGKILL of the process group, but simultaneously
discovered/reported the behavior with !-n jobs if MAILTO was set and no
output happened.
All of these places that are checking mailto should actually be checking
whether mail is set, so do that for consistency+correctness.
Rick Macklem [Sun, 29 Dec 2019 23:48:48 +0000 (23:48 +0000)]
MFC: r355509
Fix kernel handling of a NFSERR_MINORVERSMISMATCH NFSv4 server reply.
When an NFSv4 server replies NFSERR_MINORVERSMISMATCH, it does not generate
a status result for the first operation in the compound. Without this
patch, this will result in a bogus EBADXDR error return.
Returning EBADXDR is relatively harmless, but a correct reply of
NFSERR_MINORVERSMISMATCH is needed by the pNFS client to select the correct
minor version to use for a File Layout DS now that there can be NFSv4.2
DS servers.
mount_nfs.c still needs to be fixed for this, although how the mount fails
is only useful to help sysadmins isolate why a mount fails.
Found during testing of the NFSv4.2 client and server.
Rick Macklem [Sat, 28 Dec 2019 22:24:16 +0000 (22:24 +0000)]
MFC: r355194
Fix two races while handling nfsuserd daemon start/stop.
A crash was reported where the nr_client field was NULL during an upcall
to the nfsuserd daemon. Since nr_client == NULL only occurs when the
nfsuserd daemon is being shut down, it appeared to be caused by a race
between doing an upcall and the daemon shutting down.
By inspection two races were identified:
1 - The nfsrv_nfsuserd variable is used to indicate whether or not the
daemon is running. However it did not handle the intermediate phase
where the daemon is starting or stopping.
This was fixed by making nfsrv_nfsuserd tri-state and having the
functions that are called during start/stop to obey the intermediate
state.
2 - nfsrv_nfsuserd was checked to see that the daemon was running at
the beginning of an upcall, but nothing prevented the daemon from
being shut down while an upcall was still in progress.
This race probably caused the crash.
The patch fixes this by adding a count of upcalls in progress and
having the shut down function delay until this count goes to zero
before getting rid of nr_client and related data used by an upcall.
Kyle Evans [Fri, 27 Dec 2019 03:00:18 +0000 (03:00 +0000)]
MFC r355936, r356045: remove unused kbd drivers
r355936:
Kill off dummy kbd drivers
As far as I can tell, these are an artifact of times when linker sets
couldn't be empty, otherwise the kernel build would fail due to unresolved
symbols. hselasky fixed this in r268138, and I've audited the kbd portions
to make sure nothing would blow up due to the empty linker set and
successfully compiled+ran a kernel with no keyboard support at all.
Kill them off now since they're no longer required.
r356045:
terasic_mtl: kill off final dummy keyboard driver
The rest were removed in r355936, which speculated that the cause of this
phenomenon was due to an inability to have an empty linker set. The comment
included with this one shows that this was, in fact, not the reason.
Regardless, syscons no longer seems to have an issue with not having any
keyboard drivers and in-fact ignores the keyboard probe anyways.
MFC r355650:
Follow RFC 4443 p2.2 and always use own addresses for reflected ICMPv6
datagrams.
Previously destination address from original datagram was used. That
looked confusing, especially in the traceroute6 output.
Also honor IPSTEALTH kernel option and do TTL/HLIM decrementing only
when stealth mode is disabled.
Reported by: Marco van Tol <marco at tols org>
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D22631
Put sections into expected offset in binary format.
Calculate binary file offset using address field, bacause software know only offset to known data, not where to load segment.
With that patch, kernel .data section can have any alignment/offset - kernel boor fine.
With absolutely no keyboards attached and no kbdmux in kernel, we descend
down this error path. 0 is a valid keyboard index, so leaving
vd->vd_keyboard at 0 when there's no keyboard found is objectively wrong as
later attachment of a keyboard will fail -- it gets index 0, and vt thinks
it's already using that keyboard.
This is decidedly the corniest of corner cases, but it's easy enough to get
correct that we should do so.
Tested in a kernel without atkbdc, atkbd, psm, kbdmux, ukbd, hyperv then
loading ukbd post-boot and attaching a usb keyboard.
Rework tcpopts_parse() to be more strict. Use const pointer. Add length
checks for specific TCP options. The main purpose of the change is
avoiding of possible out of mbuf's data access.
Toomas Soome [Sun, 22 Dec 2019 20:36:57 +0000 (20:36 +0000)]
MFC r355844:
loader.efi: efi_readkey_ex needs to key despite the shift status or toggle status
From UEFI specification 2.8, page 434:
"It should also be noted that certain input devices may not be able to produce
shift or toggle state information, and in those cases the high order bit in
the respective Toggle and Shift state fields should not be active."
But we still need to check for ScanCode and UnicodeChar.
Ian Lepore [Sun, 22 Dec 2019 20:34:15 +0000 (20:34 +0000)]
MFC r355777:
Support --all-repeats in uniq(1) for compatibility with gnu coreutils.
This adds a new -D/--all-repeats option to uniq(1), which outputs each copy
of any repeated lines (as opposed to a single copy of a repeated line). You
can specify a separator option to output a blank line before or after each
group of repeated lines. This adds compatibility with the GNU coreutils
version of uniq(1).
This change also re-groups the -c, -d, -D, -u options in the usage display
and man page to indicate that they are mutally exclusive of each other. This
matches the posix/opengroup definition of uniq(1) command line args. Note
that this change does NOT actually enforce the mutual exclusion in the code,
for now, it simply documents that the arguments should be considered
exclusive with each other.
Ian Lepore [Sun, 22 Dec 2019 20:04:35 +0000 (20:04 +0000)]
MFC r355688:
If device_delete_children() returns an error, bail on the rest of the
detach work and return the error. Especially don't call iicbus_reset()
since the most likely cause of failing to detach children is that one
of them has IO in progress.
Ian Lepore [Sun, 22 Dec 2019 19:30:13 +0000 (19:30 +0000)]
MFC r355598, r355727, r355735, r355858
r355598:
Do not attach children of owc_gpiobus until interrupts are working.
The children of the bus need to do IO on the bus to probe for hardware
presence. Doing IO means timing the bus states using sbinuptime(), and
that requires working timecounters, which are not initialized until after
device attachment has completed.
PR: 242526
r355727 (by imp):
Create new wrapper function: bus_delayed_attach_children()
Delay the attachment of children, when requested, until after interrutps are
running. This is often needed to allow children to run transactions on i2c or
spi busses. It's a common enough idiom that it will be useful to have its own
wrapper.
Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D21465
r355735 (by imp):
Be consistent about checking return value from bus_delayed_attach_children.
Most places checked, but a couple last minute changes didn't. Make them all use
the return value.
Noticed by: rpokala@
r355858:
Update owc_gpiobus (one-wire over gpio) to the modern gpio_pin interface.
It used to be required that a device be a child of gpiobus(4) to manipulate
gpio pins. That requirement didn't work well for FDT-based systems with many
cross-hierarchy users of gpio, so a more modern framework was created that
removed the old hierarchy requirement.
These changes adapt the owc_gpiobus driver to use the newer gpio_pin_*
functions to acquire, release, and manipulate gpio pins. This allows a
single driver to work for both hinted-attachment and fdt-based systems, and
removes the requirement that any one-wire fdt nodes must appear at the root
of the devicetree.
Kyle Evans [Sun, 22 Dec 2019 19:06:45 +0000 (19:06 +0000)]
MFC r355206, r355212, r355257, r355271: tty nits
r355206: tty_pts: don't rely on tty header pollution for sys/mutex.h
r355212: tty_rel_gone: add locking assertion
r355257: usb: remove some extraneous tty.h includes
r355271: Remove more needless <sys/tty.h> includes
Ian Lepore [Sun, 22 Dec 2019 18:55:09 +0000 (18:55 +0000)]
MFC r355572:
Allow baud rates of 1,228,800 and 1,843,200 on CP2101/2/3 usb-serial adapters.
The datasheets for these chips claim the maximum is 921,600, but testing
shows these two higher rates also work (but no rates above 921,600 other
than these two work; these represent dividing the base buad clock by 3 and 2
respectively).
r355467:
Implement bus_rescan for gpiobus(4). This allows on-the-fly reconfiguration
of gpio devices by using kenv to add hints for a new device and then do
'devctl rescan gpiobus4' to make the new device(s) attach.
It's not particularly easy to detect whether the 'at' hint has been deleted
for a child device that's currently attached, so this doesn't handle that.
But the user can use devctl commands to manually detach an existing device.
r355499:
Add module build stuff for gpioths(4), a driver for DHT11/DHT22 sensors.
r355531:
Several small fixes for the gpioths (temp/humidity sensor) driver.
At the end of a read cycle, set the gpio pin to INPUT rather than OUTPUT.
The state of the single-wire "bus" when idle should be high; setting the
pin to input allows the external pullup to pull the line high. Setting it
to output (and leaving it driving low) was leading a good read cycle followed
by one that would fail, and it just continued like that forever, effectively
reading the sensor once every 10 seconds instead of 5.
In the attach function, do an initial read from the device before registering
the sysctls for accessing the last-read values, to prevent reading spurious
values for the first 5 seconds after the driver attaches.
Do a callout_drain() in the detach function to prevent crashes after
unloading the module.
r355532:
Simplify sysctl stuff in the gpioths driver. There is no need to use local
functions to handle the sysctls, they all just access simple readonly
integer variables. There's no need to track the oids of the ones we add,
since the teardown is done by newbus code, not the driver itself.
Also remove the DDB code, because it just provides access to the same data
that the sysctls already provide.
r355533:
Add support for more chips to the gpioths driver.
Previously the driver supported the DHT11 sensor. Now it supports
DHT11, DHT12, DHT21, DHT22, AM3201, AM3202.
All these chips are similar, differing primarily in supported temperature
and humidity ranges and accuracy (and, presumably, cost). There are two
basic data formats reported by the various chips, and it is possible to
figure out at runtime which format to use for decoding the data based on
the range of values in a single byte of the humidity measurement. (which
is detailed in a comment block, so I won't recapitulate it here).
r355535:
Add a MODULE_DEPEND() for the gpioths driver. Also, note that the prior commit
changed the sysctl format for the temperature from "I" to "IK", and
correspondingly changed the units from integer degrees C to decikelvin.
For access via sysctl(8) the output will be the same except that now
decimal fractions will be shown when available.
r355540:
Add FDT support to the gpioths driver. It now uses the newer gpio_pin_*()
API and can attach based on either hints or fdt data.
r355548:
Add a man page for the gpioths(4) driver.
r355549:
Add myself to the copyright list. Also add an SPDX tag. And finally, fix
a missing word and a spelling error in a comment.
r355550:
Paste things correctly so that I'm added to the *end* of the copyright list.
r355551:
Connect the gpioths(4) manpage to the build.
r355565:
Switch gpioths(4) from using a callout to a taskqueue for periodic polling
of the sensor hardware. Part of the polling process involves signalling
the chip then waiting 20 milliseconds. This was being done with DELAY(),
which is a pretty rude thing to do in a callout. Now a taskqueue_thread
task is scheduled to do the polling, and because sleeping is allowed in
the task context, pause_sbt() replaces DELAY() for the 20ms wait.
Ian Lepore [Sun, 22 Dec 2019 17:57:59 +0000 (17:57 +0000)]
MFC r355100:
Allow opt-out of automatic ntpd leapfile checking/fetching.
When a system has no internet connection, or when it is configured to obtain
ntpd leapfiles from some source other than the internet, or even when the
sysadmin has decided for some reason to customize ntp.conf to eliminate use
of the leapfile, the rc.d/ntpd script emits various error messages related
to the file.
This change allows setting the rc var ntp_db_leapfile to NONE to disable all
automatic processing related to that file in rc.d/ntpd.
Kyle Evans [Sun, 22 Dec 2019 17:15:48 +0000 (17:15 +0000)]
MFC r355796-r355797, r355799: kbd: defaults for get_fkeystr/diag
The genkbd version of these remains exposed for stable branches, but
keyboard drivers that just want to use the defaults can simply not provide
their own. There shouldn't be any unset in the wild.
r355796:
kbd: provide default implementations of get_fkeystr/diag
Most keyboard drivers are using the genkbd implementations as it is;
formally use them for any that aren't set.
This file was missed in r355796, but no harm would have come from this.
r355799:
kbd: patch linker set methods, too
This is needed after r355796. Some double-registration of kbd drivers needs
to be sorted out, then this sysinit will simply add these drivers into the
normal list and kill off any other bits in the driver that are aware of the
linker set, for simplicity.
Kyle Evans [Sun, 22 Dec 2019 17:04:16 +0000 (17:04 +0000)]
Fix kbdd_diag definition
This is a direct commit to stable branches as these have been converted to
inline functions in head, which will likely not get MFC'd due to limited
utility -- follow up locking assertions likely cannot be done in stable
branches.
The use of 'level' in the macro definition was truncated to 'leve', which
makes the macro unusable.
loader: we do not support booting from pool with log device
loader: factor out label and uberblock load from vdev_probe, add MMP checks
loader: populate nvl with data even when label_txg is 0
loader: clean up the noise around log device
loader: memory leak in vdev_label_read_config()
loader: zfsimpl.c cstyle cleanup
loader: rewrite zfs vdev initialization
In some cases the pool discovery will get stuck in infinite loop while setting
up the vdev children.
To fix, we split the vdev setup into two parts, first we create vdevs based on
configuration we do get from pool label, then, we process pool config from MOS
and update the pool config if needed.
This patch bundle is work leading to and including fix for issue when
in some cases the pool configuration build does end up in infinite loop.
Pedro F. Giffuni [Sat, 21 Dec 2019 02:40:40 +0000 (02:40 +0000)]
MFC r355828:
Double the size of ARG_MAX on LP64 platforms.
As modern software keeps growing in size, we get requests to update the
value of ARG_MAX in order to link the resulting object files. Other OSs
have much higher values but increasiong ARG_MAX has a multiplied effect on
KVA, so just bumping this value is dangerous in some archs like ARM32 that
can exhaust KVA rather easily.
While it would be better to have a unique value for all archs, other OSs
(Illumos in particular) can have different ARG_MAX limits depending on the
platform, For now we want to be really conservative so we are avoidng
the change on ILP32 and in the alternative case we only double it since that
seems to work well enough for recent Code Aster.
Rick Macklem [Fri, 20 Dec 2019 22:53:23 +0000 (22:53 +0000)]
MFC: r355157, r355161
Add a cap on credential lifetime for Kerberized NFS.
The kernel RPCSEC_GSS code sets the credential (called a client) lifetime
to the lifetime of the Kerberos ticket, which is typically several hours.
As such, when a user's credentials change such as being added to a new group,
it can take several hours for this change to be recognized by the NFS server.
This patch adds a sysctl called kern.rpc.gss.lifetime_max which can be set
by a sysadmin to put a cap on the time to expire for the credentials, so that
a sysadmin can reduce the timeout.
It also fixes a bug, where time_uptime is added twice when GSS_C_INDEFINITE
is returned for a lifetime. This has no effect in practice, since Kerberos
never does this.
Brooks Davis [Fri, 20 Dec 2019 22:07:05 +0000 (22:07 +0000)]
MFC r355830:
Avoid a tautological bitwise compare.
This looks like a bit of debugging code that sliped into the initial
import of the sos@ ATA framework. This changes the behavior to omit a
line of output that appears to have been intended for omission.
Toomas Soome [Fri, 20 Dec 2019 07:40:28 +0000 (07:40 +0000)]
MFC r355713:
loader: cd9660_open() warn: is 'buf' large enough for 'struct iso_primary_descriptor'?
We do allocate amount of memory (void * or char *), and then assign this
buffer to struct iso_primary_descriptor *vd. Make sure we do
allocate enough bytes.
In fact we do allocate enough, but it is good idea to make sure this really
is so.
Kyle Evans [Thu, 19 Dec 2019 02:29:15 +0000 (02:29 +0000)]
MFC r339955, r355590: sed test fix + \r, \n, \t
r339955:
usr.bin/sed/tests: fix one of the regression test cases by adding its
results file to the build.
r355590:
sed: process \r, \n, and \t
This is both reasonable and a common GNUism that a lot of ported software
expects.
Universally process \r, \n, and \t into carriage return, newline, and tab
respectively. Newline still doesn't function in contexts where it can't
(e.g. BRE), but we process it anyways rather than passing
UB \n (escaped ordinary) through to the underlying regex engine.
Adding a --posix flag to disable these was considered, but sed.1 already
declares this version of sed a super-set of POSIX specification and this
behavior is the most likely expected when one attempts to use one of these
escape sequences in pattern space.
This differs from pre-r197362 behavior in that we now honor the three
arguably most common escape sequences used with sed(1) and we do so outside
of character classes, too.
Other escape sequences, like \s and \S, will come later when GNU extensions
are added to libregex; sed will likely link against libregex by default,
since the GNU extensions tend to be fairly un-intrusive.
Kyle Evans [Thu, 19 Dec 2019 02:09:16 +0000 (02:09 +0000)]
Add sigsetop extensions commonly found in musl libc and glibc
These functions (sigandset, sigisemptyset, sigorset) are commonly available
in at least musl libc and glibc; sigorset, at least, has proven quite useful
in qemu-bsd-user work for tracking the current process signal mask in a more
self-documenting/aesthetically pleasing manner.
Kyle Evans [Thu, 19 Dec 2019 02:05:48 +0000 (02:05 +0000)]
stand: liblua: drop default buffer size to 128
Lua allocates LUAL_BUFFERSIZE buffers on the stack for various string
functions (string.format, string.gsub) -- this works out to be somewhat
significant and not necessary, based on how we use string operations.
Dropping it risks having to allocate per call to format/gsub, but this is
not the case for our usage. This simply stops allocating 8K buffers on the
stack when luaL_Buffer is used.
Kyle Evans [Thu, 19 Dec 2019 02:04:40 +0000 (02:04 +0000)]
usr.sbin/ntp: don't emit versions w/ make -s
<sys.mk> defines ECHO=echo when not using make -s, and ECHO=true when using
make -s.
export ECHO for ntp products and use it in the mkver script to echo the
version. This suppresses the output as appropriate. ECHO is given a default
value to make sure things still work as expected for anyone that isn't
redefining ECHO.
Alexander Motin [Thu, 19 Dec 2019 01:34:34 +0000 (01:34 +0000)]
MFC r355451: Remove some branching from GEOM_DISK hot path.
pp->private just can not be NULL in those places.
In g_disk_start() and g_disk_ioctl() both dp != NULL and !dp->d_destroyed
should always be true if disk_gone() and disk_destroy() are used properly,
since GEOM does not send requests to errored providers. If the protocol is
not followed, then no amount of additional checks here give real safety.
In g_disk_access() though the checks are useful, since GEOM blocks only
new opens for errored providers, but allows closes. It should not happen
if disk_gone() and disk_destroy() are used properly, but may otherwise.
To improve cases when disk_gone() is not used, call it from disk_destroy().
It does not give full guaranties, but it errors the provider and makes
GEOM block unwanted requests at least after some race.
Alexander Motin [Thu, 19 Dec 2019 01:32:15 +0000 (01:32 +0000)]
MFC r355438: Block ioctls for dying GEOM_DEV instances.
For normal I/Os consumer and provider statuses are checked by g_io_check().
But ioctl calls often do not go through it, being dispatched directly. This
change makes their semantics more alike, protecting lower levels.
Alexander Motin [Thu, 19 Dec 2019 01:25:44 +0000 (01:25 +0000)]
MFC r355410: Switch GEOM_DEV from make_dev_p() to make_dev_s().
It closes the race condition and so allows to remove few NULL checks.
Also while there, use dev->si_drv1 in addition to cp->private to store
softc pointer. For calls coming from the dev side it gives reliable cache
hit instead of often miss before.
Merge the first part of frag6.c changes from HEAD. Apart from moving the
sysctls into the local file these are mostly non-functional changes.
frag6.c: sort includes
frag6.c: move variables and sysctls into local file
frag6.c: remove dead code
frag6.c: rename malloc type
frag6.c: make compile with gcc
frag6.c: fix includes
frag6.c: re-order functions within file
frag6.c: rename ip6q[] to ipq6b[] and consistently use "bucket"
frag6.c: initial comment and whitespace cleanup.
frag6.c: cleanup varaibles and return statements.
Bjoern A. Zeeb [Wed, 18 Dec 2019 00:12:30 +0000 (00:12 +0000)]
MFC r350531:
IPv6 cleanup: kernel
Finish what was started a few years ago and harmonize IPv6 and IPv4
kernel names. We are down to very few places now that it is feasible
to do the change for everything remaining with causing too much disturbance.
Remove "aliases" for IPv6 names which confusingly could indicate
that we are talking about a different data structure or field or
have two fields, one for each address family.
Try to follow common conventions used in FreeBSD.
* Rename sin6p to sin6 as that is how it is spelt in most places.
* Remove "aliases" (#defines) for:
- in6pcb which really is an inpcb and nothing separate
- sotoin6pcb which is sotoinpcb (as per above)
- in6p_sp which is inp_sp
- in6p_flowinfo which is inp_flow
* Try to use ia6 for in6_addr rather than in6p.
* With all these gone also rename the in6p variables to inp as
that is what we call it in most of the network stack including
parts of netinet6.
The reasons behind this cleanup are that we try to further
unify netinet and netinet6 code where possible and that people
will less ignore one or the other protocol family when doing
code changes as they may not have spotted places due to different
names for the same thing.
No functional changes inteded.
Sponsored by: Netflix
Do not MFC the in_pcb.h changes for the stable branch.
This MFC is mostly only done in order to be able to MFC other changes
with less conflicts.
Kenneth D. Merry [Tue, 17 Dec 2019 20:29:47 +0000 (20:29 +0000)]
MFC r355299:
------------------------------------------------------------------------
r355299 | ken | 2019-12-02 14:57:39 -0500 (Mon, 02 Dec 2019) | 52 lines
Fix a hang introduced in r351599.
My changes in 351599 (kindly committed by avg) made the cd(4) media check
asynchronous to avoid a sleep while holding a mutex.
There was a difficult to reproduce bug with those changes that caused a
hang on boot on some single processor machines/VMs. Leandro Lupori
managed to reproduce the bug, diagnose it, and supplied a patch! Here is
his analysis, from the PR:
======
I was able to reproduce the problem described in comment#14.
Actually, I wasn't trying to reproduce it, I just started seeing it a few
weeks ago, in CURRENT.
I can reproduce it consistently, by using QEMU to run a PowerPC64 VM with a
single core/thread (-smp 1).
It happens only when there is no media in the emulated CD-ROM, a device
that QEMU adds by default, unless -nodefaults is specified in command line.
I've debugged it and this is what I've found:
1- After the CD probe is successful, GEOM will try to open the device,
which will end up calling cdcheckmedia(), that sets CD state to
CD_STATE_MEDIA_PREVENT.
2- Next, scsi_prevent() is executed and succeeds, the CD_FLAG_DISC_LOCKED
flag is set and CD state moves to CD_STATE_MEDIA_SIZE.
3- Next, scsi_read_capacity() is executed and fails, state is set to
CD_STATE_MEDIA_ALLOW, cdmediaprobedone() is called and wakes up
cdcheckmedia().
4- Then, when cdstart() is invoked to process CD_STATE_MEDIA_ALLOW, it
first checks if CD_FLAG_DISC_LOCKED is set, and if so skips directly to
CD_STATE_MEDIA_SIZE state. This will repeat the steps of bullet 3, entering
an infinite MEDIA_SIZE command loop.
When there is a least another core/thread, the GEOM thread that performed
the initial cdopen() will get scheduled again, closing the CD device, that
will call cdprevent(PR_ALLOW) that clears the CD_FLAG_DISC_LOCKED flag and
breaks the loop.
So, apparently, the problem is CD_STATE_MEDIA_ALLOW being skipped when
CD_FLAG_DISC_LOCKED is set. If I understand correctly, in this case, the
state should be advanced to CD_STATE_MEDIA size only when the current state
is CD_STATE_MEDIA_PREVENT.
=====
------------------------------------------------------------------------
After r343619 ipfw uses own locking for packets flow. PULLUP_LEN() macro
is used in ipfw_chk() to make m_pullup(). When m_pullup() fails, it just
returns via `goto pullup_failed`. There are two places where PULLUP_LEN()
is called with IPFW_PF_RLOCK() held.
Add PULLUP_LEN_LOCKED() macro to use in these places to be able release
the lock, when m_pullup() fails.
Sponsored by: Yandex LLC
NOTE: since r343619 was not merged, this commit is mostly NOP, but
it is needed to reduce code difference between stable and head/.
Emmanuel Vadot [Mon, 16 Dec 2019 18:00:05 +0000 (18:00 +0000)]
MFC r354115:
dtc: Allow multiple dts-v1 tag
Some dts are including dtsi that also contain a /dts-v1/ tag at the
top. GNU DTC doesn't seems to have a problem with that so fix our
dtc to behave the same.
Cy Schubert [Mon, 16 Dec 2019 02:38:47 +0000 (02:38 +0000)]
MFC r355670:
Rather than pass the address of the packet information control block to
ipf_pcksum6(), directly pass the adddress of the mbuf to it. This reduces
one pointer dereference. ipf_pcksum6() doesn't use the packet information
control block except to obtain the mbuf address.