PR lib/60677 strfmon() - remove some (harmless) lint
Avoid using a var name that overrides an external func name
from a standard header (func not used) for a short block
(harmless change).
Remove a func param that ended up no longer being used
(just got forgotten) from two (very similar) functions.
The rest of what lint complains about is idiotic. Won't fix.
PR lib/60677 strfmon() gcc lunacy fix
Deal with gcc stupidity when chars are unsigned.
If I need to check that a char pointer points to a
char that is between 0 and N (for any N <= 127)
I should be able to just write
if (*p >= 0 && *p <= N)
and on signed char hosts, that works just fine.
On unsigned char hosts, the test *p >= 0 is
always true, so gcc decides I don't know what I
am doing, and complains.
Idiotic. It is irrelevant if *p can never be < 0
on such a host, the code is still correct, does exactly
what is needed, and ...
[12 lines not shown]
Rename the pmap_completion structure to pmap_garbage, and include a copy
in each pmap. We now try to defer releasing freed resources until a
pmap_update() call (with some exceptions; RTFS), laying the groundwork
for some future ATC-related optimizations.
rdate.8: note RFC 868 is obsolescent
From OpenBSD, specifically a mailing list post, which corrects the
maximum effective date.
https://marc.info/?l=openbsd-bugs&m=177447243611195&w=2
US NIST still supports RFC 868 queries via time.nist.gov. (For
comparison, the Canadian equivalent via NRC dropped support, citing
security concerns.)
PR lib/60677 major strfmon() overhaul
This update should get strfmon() to the state currently specified in the
expected update to the POSIX specification in the first TC for Issue 8
(whenever that appears):
https://austingroupbugs.net/view.php?id=2000
More work might be needed, as there are some issues for
which there is yet to a decision on what should be produced.
The man page is updated to better explain what is required,
and what that all means. Some minor grammar fixes, etc, as well.
The tests are updated for the results as specified, with some
new tests added. More tests are needed (to appear later).
As strfmon() is such a little used function, no pullups planned.
autoconf(9): Take device references in iteration for detach.
This avoids a race with concurrent detach that can lead to tripping
KASSERT(!dv->dv_detach_done) in config_detach -> device_acquire, even
if the device_t itself remains stable while the device iteration is
ongoing (because alldev_nwrite or alldev_nread is raised).
While here, add:
- deviter_first_acquire
- deviter_next_acquire
- device_find_by_xname_acquire
- device_find_by_driver_unit_acquire
Prompted by:
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Revoke vnodes when unconfiguring.
This way, if you unconfigure an fss instance and reconfigure it,
anything that had it open (e.g., a file system mounted from it) won't
suddenly start mixing old cached data with new data -- instead, new
I/O operations will fail.
Not perfect -- see comments.
Prompted by:
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Use LK_SHARED, not LK_EXCLUSIVE, to read out mount point.
No need to exclude other readers.
Prompted by:
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Nix needless sc == NULL conditionals.
fss_strategy and fss_ioctl can be reached only after fss_open has
returned and (now that fss_cancel exists) before fss_close has been
called (on both block _and_ all character devices that have been
opened); between (first) open and (last) close, the autoconf unit
must exist.
Prompted by:
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Tighten fss_close a bit.
Clear last FSS_CDEV_OPEN/FSS_BDEV_OPEN in fss_close so we can assert
it in fss_detach, and pass DETACH_FORCE to fss_detach so it knows
when to expect the flags to be cleared.
Prompted by:
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Install a cancel handler.
This way, fss_close doesn't run until all concurrent I/O operations
(read, write, ioctl, strategy) have returned. Note that this applies
independently to the bdev and the cdev, so (e.g.) fss_close may run
on the cdev while there's still an fss_strategy running in parallel.
But in that case, sc->sc_flags will have FSS_BDEV_OPEN set, so
fss_close won't try to detach it too soon.
Prompted by:
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Ensure newly attached autoconf unit matches dev_t minor.
Setting cf->cf_fstate = FSTATE_STAR means autoconf(9) may select any
unit from cf->cf_unit onward, rather than only cf->cf_unit. Since
the attach is always serialized by fss_device_lock, this proably
doesn't make a difference in practice -- and we can't get rid of
fss_device_lock without a config_intern_pseudo_acquire or something
that atomically acquires the existing unit or if there is none
attaches a new one. But let's make the intent clearer in case any of
that changes.
Prompted by:
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Gather module init/fini logic into one place.
Fixes some little-used error branches and avoids duplication that can
get out of sync.
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Avoid races with drvctl detach.
Attach and detach by opening and closing /dev/fssN is serialized by
fss_device_lock, but concurrent `drvctl -d fssN' can cause an fss
instance to be detached and freed while fss_open or fss_close is
still trying to use it.
Prevent concurrent detach during other operations like fss_ioctl or
fss_strategy by making fss_detach fail if sc_flags shows it is held
open.
Prompted by:
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Rework creation path to avoid various races.
1. Look up each vnode exactly once; the identity of the vnode may
change between lookups otherwise.
2. Don't read v_vflag or v_mount without holding the vnode lock;
otherwise they may be changed by concurrent revoke.
3. Hold vfs_busy(mp) while we don't have one of its vnode's locked
and we haven't committed the fss instance to FSS_ACTIVE (at which
point fss_unmount_hook will take care of it).
4. Set sc->sc_uflags at the same time the transition to FSS_ACTIVE,
and loosen assertion after fss_create_snapshot, to avoid a race
between FSSIOCSET and FSSIOCCLR. See comments in FSSIOCSET for
details.
XXX Should consider using namei and VOP_REMOVE instead of
do_sys_unlink to remove only the vnode that we actually looked up,
[3 lines not shown]
fss(4): Handle fss_softc_alloc failure.
Shouldn't successfully transition to FSS_ACTIVE in that case; should
instead back out and fail.
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Initialize sc_state in fss_attach, not fss_open.
Access without sc_slock is forbidden.
Prompted by:
PR kern/60986: fssconfig panics on bad backing store type
fss(4): Close vn_open with vn_close, not with vrele.
Fixes
# fssconfig fss0 / /dev/ld4
...
panic: vrelel: bad ref count
(The mistake is using the block device /dev/ld4 instead of the
character device /dev/rld4, but this ought to be handled gracefully,
not by panicking.)
PR kern/60986: fssconfig panics on bad backing store type
PR/61017: Juan Manuel Mendez Rey: regexec reads past the string after a
multibyte character. Provide a prevchar() function that fetches the previous
multibyte character.