dragonfly.git
17 months agoMerge branch 'vendor/AWK'
Antonio Huete Jimenez [Wed, 9 Nov 2022 11:15:27 +0000 (12:15 +0100)]
Merge branch 'vendor/AWK'

17 months agovendor/awk: upgrade from 20200702 to 20220912
Antonio Huete Jimenez [Wed, 9 Nov 2022 08:42:35 +0000 (09:42 +0100)]
vendor/awk: upgrade from 20200702 to 20220912

Bugfixes and maintenance:

- Clean up xfree, remove redundant NULL check.
- Stop leaking tempcells from extra arguments in format.
- Fix leak of qstring result in setclvar.
- Fix leak of regex string representations.
- Fix memory leak in string assignment to built-ins.
- Eliminate file management memory leak.
- When closing, don't flush input streams
- Heap buffer overflow from PR #83 fixed in #121.

For details, see FIXES, or commit history at
https://github.com/onetrueawk/awk/commits/master

17 months agojail.8 : update the manpage date
Pierre-Alain TORET [Tue, 8 Nov 2022 08:18:56 +0000 (09:18 +0100)]
jail.8 : update the manpage date

17 months agojail.8 : syscall net_raw_sockets has been renamed allow_raw_sockets
Pierre-Alain TORET [Mon, 7 Nov 2022 21:07:36 +0000 (22:07 +0100)]
jail.8 : syscall net_raw_sockets has been renamed allow_raw_sockets

17 months agosbin/hammer2: Fix build error on i386
Tomohiro Kusumi [Sun, 6 Nov 2022 02:04:46 +0000 (19:04 -0700)]
sbin/hammer2: Fix build error on i386

error: format specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]

17 months agosbin/hammer2: Apply fac0c41fdd to user space ondisk.c
Tomohiro Kusumi [Sat, 5 Nov 2022 06:47:14 +0000 (23:47 -0700)]
sbin/hammer2: Apply fac0c41fdd to user space ondisk.c

17 months agosys/vfs/hammer2: Fix many comments
Tomohiro Kusumi [Sat, 5 Nov 2022 05:30:18 +0000 (22:30 -0700)]
sys/vfs/hammer2: Fix many comments

* "lru_spin; /* inumber lookup */" -> lru_spin isn't for inode.

* "If an error occurred we eat the lock" -> "eat the lock" was
  removed in c603b86b77206805493fc181d3576ecd1786e056 in 2015.
  The rest of the comment (not removed) seems obsolete too.

* "removed from the parent's btree" -> Typo for rbtree.

* "pointing it to an embedded data structure and copying the data from the buffer"
  -> No longer implemented like this since
  01eabad4d93a8dc8f0f01a6209b384b1e010bb8c in 2012.

* "Called to clean up cached DIOs on umount" -> This isn't specific to
  unmount, called regularly if iofree_count > dio_limit.

* "voldata is not yet loaded" -> It's already loaded.

* "so do not pass cluster", etc -> "cluster" no longer appears
  here since b7add6753e221920947c96fab3314c39a2f67fe4 in 2015.

* "multiple hammer2_inode structures can be aliased to the same chain
  element, for example for hardlinks" -> This comment from 2013
  seems to only apply to hardlink mechanism back then, which was
  something completely different.

17 months agobin/ls: Fix mismatched parentheses.
Antonio Huete Jimenez [Sat, 5 Nov 2022 13:09:44 +0000 (14:09 +0100)]
bin/ls: Fix mismatched parentheses.

Submitted-by: piecuch (closes #3322)
17 months agodsynth - Implement a new 'add' directive
Matthew Dillon [Fri, 4 Nov 2022 23:52:57 +0000 (16:52 -0700)]
dsynth - Implement a new 'add' directive

* This directive allows adding additional port(s) to the build list
  of a running dsynth.  It can be useful when the user does not wish
  to interrupt the running dsynth but wishes to add more ports and then
  leave the dsynth unintended.  For example because it might be half
  way through building a huge package and interrupting it would be bad.

* dsynth will complete the current build as-per normal, including
  rebuilding the repository if it would normally do so (without asking
  interactively), and will then re-exec itself with the same options
  and directive for the additional ports that were added in the interim.

17 months agodsynth - Add Check_plist config file option
Matthew Dillon [Fri, 4 Nov 2022 21:54:05 +0000 (14:54 -0700)]
dsynth - Add Check_plist config file option

* dsynth -P turns on plist checking for builds.  Note that this
  feature is already automatically turned on when the 'everything'
  and 'test' directives are used.

* Add a Check_plist configuration file option that does the same thing
  so -P does not have to be specified if the developer wants to always do
  plist checking.

Requested-by: daftaupe
17 months agosys/vfs/hammer2: Rename HAMMER2_BREF_FLAG_ZERO -> HAMMER2_BREF_FLAG_UNUSED
Tomohiro Kusumi [Sat, 29 Oct 2022 11:15:40 +0000 (04:15 -0700)]
sys/vfs/hammer2: Rename HAMMER2_BREF_FLAG_ZERO -> HAMMER2_BREF_FLAG_UNUSED

Unused since 58898c0eb3f3dcaecea7216c70e96b4be4a3ff7f in 2020.
Rename it to UNUSED rather than "NO LONGER USED" comment.

17 months agosys/vfs/hammer2: Fix incorrect reservedXXX names in ondisk structure
Tomohiro Kusumi [Sat, 29 Oct 2022 10:59:25 +0000 (03:59 -0700)]
sys/vfs/hammer2: Fix incorrect reservedXXX names in ondisk structure

These names don't match comments right next to them.
Also fix typo UNMUSED -> UNUSED.

These aren't used by anyone in kernel or user space.

17 months agosys/vfs/hammer2: Minor cleanups for hammer2_disk.h
Tomohiro Kusumi [Sat, 29 Oct 2022 06:20:18 +0000 (23:20 -0700)]
sys/vfs/hammer2: Minor cleanups for hammer2_disk.h

17 months agosys/vfs/hammer2: Move HAMMER2_{CHECK,COMP}_STRINGS to sbin/hammer2
Tomohiro Kusumi [Sat, 29 Oct 2022 06:16:12 +0000 (23:16 -0700)]
sys/vfs/hammer2: Move HAMMER2_{CHECK,COMP}_STRINGS to sbin/hammer2

These are just arrays of names used by sbin/hammer2 directives,
so nothing directly to do with ondisk structure.

HAMMER2_CHECK_STRINGS also only reflects names used by sbin/hammer2 directives.

17 months agosys/vfs/hammer2: Move HAMMER2_METH_DEFAULT from hammer2_disk.h to hammer2.h
Tomohiro Kusumi [Sat, 29 Oct 2022 06:12:05 +0000 (23:12 -0700)]
sys/vfs/hammer2: Move HAMMER2_METH_DEFAULT from hammer2_disk.h to hammer2.h

As the comment explains, this is just a flag for HAMMER2 function,
so nothing directly to do with ondisk structure.

makefs(8) also needs this change as it depends on hammer2_disk.h.

17 months agosys/vfs/hammer2: Fix a typo in a source code comment
Tomohiro Kusumi [Fri, 28 Oct 2022 06:40:06 +0000 (23:40 -0700)]
sys/vfs/hammer2: Fix a typo in a source code comment

- s/Miscellanious/Miscellaneous/

taken-from FreeBSD c254580cc2616ca7049a9afb06382025d4d21300

18 months agosys/vfs/hammer2: Fix "already initialized" multi-volumes error message
Tomohiro Kusumi [Thu, 27 Oct 2022 06:46:30 +0000 (23:46 -0700)]
sys/vfs/hammer2: Fix "already initialized" multi-volumes error message

It's not "path" that's already initialized,
but rather same "volume id" (likely from a different device path)
that's already initialized and registered to the volumes list.

18 months agosys/vfs/hammer2: Remove redundant error check in hammer2_vfs_mount()
Tomohiro Kusumi [Mon, 24 Oct 2022 07:24:37 +0000 (00:24 -0700)]
sys/vfs/hammer2: Remove redundant error check in hammer2_vfs_mount()

The error is always 0 at this point, and devvps must always be opened.
While here zero initialize error on update mount.

18 months agosys/vfs/hammer2: Make fchain/vchain dump on last drop consistent
Tomohiro Kusumi [Thu, 13 Oct 2022 08:10:05 +0000 (01:10 -0700)]
sys/vfs/hammer2: Make fchain/vchain dump on last drop consistent

fchain/vchain are both non kmalloc'd chains, but hammer2_dump_chain()
should be called either before or after last drop for both.

It currently results in showing inconsistent refs (0 and 1).

18 months agosys/vfs/hammer2: Remove comments on removed stuff
Tomohiro Kusumi [Tue, 11 Oct 2022 07:30:16 +0000 (00:30 -0700)]
sys/vfs/hammer2: Remove comments on removed stuff

HAMMER2_XOP_SYNCHRONIZER appeared only in this comment in
c847e8387ad749d611d395742d337213aefef3b9 in 2015, and never actually existed.

ECHECK appeared only in this comment in
f3bfcc3fda3d70dd80cbb0440b5b8649ca2d07de in 2022, and never actually existed.

"layerq" was removed in 8138a154be31c3db1d8bd046ca7b003a6c79c01c in 2014.

io_complete() was removed in 85b1f267a5c33386e0761edb93a486fce13e8e88 in 2017.

18 months agosys/vfs/hammer2: Remove obsolete comment on HAMMER2_RESOLVE_RDONLY
Tomohiro Kusumi [Wed, 5 Oct 2022 04:30:40 +0000 (21:30 -0700)]
sys/vfs/hammer2: Remove obsolete comment on HAMMER2_RESOLVE_RDONLY

HAMMER2_RESOLVE_RDONLY was removed in
d2a410239c107d0aeceaf0a17417e92b75be24ed in 2018.

18 months agosys/vfs/hammer2: Remove obsolete comment in hammer2_vop_readdir()
Tomohiro Kusumi [Tue, 4 Oct 2022 06:12:05 +0000 (23:12 -0700)]
sys/vfs/hammer2: Remove obsolete comment in hammer2_vop_readdir()

This comment from around 2014 no longer matches the code.
e.g. There is no "parent" in hammer2_vop_readdir().

18 months agosys/vfs/hammer2: #if0 hammer2_chain_lock_unhold()/hammer2_chain_unlock_hold()
Tomohiro Kusumi [Mon, 3 Oct 2022 06:47:04 +0000 (23:47 -0700)]
sys/vfs/hammer2: #if0 hammer2_chain_lock_unhold()/hammer2_chain_unlock_hold()

for clarity.
These two functions were never used since first appeared in
6d51e13ade73a84bc976316303593a37f14a3753 in 2016.

18 months agosys/vfs/hammer2: Use correct XOP struct in hammer2_xop_{lookup,delete}
Tomohiro Kusumi [Mon, 3 Oct 2022 06:27:44 +0000 (23:27 -0700)]
sys/vfs/hammer2: Use correct XOP struct in hammer2_xop_{lookup,delete}

Callers of these XOP use hammer2_xop_lookup_t,
but the XOP implementation takes it as hammer2_xop_scanlhc_t.
It was working as the definition of these structs are the same.

Apparently hammer2_xop_lookup() should be using hammer2_xop_lookup_t.
hammer2_xop_delete() should be using hammer2_xop_lookup_t too given
similarity in its implementation (i.e. caller side is correct).

18 months agosys/vfs/hammer2: hammer2_dump_chain() should belong to hammer2_chain.c
Tomohiro Kusumi [Mon, 3 Oct 2022 06:12:38 +0000 (23:12 -0700)]
sys/vfs/hammer2: hammer2_dump_chain() should belong to hammer2_chain.c

18 months agosys/vfs/hammer2: Use HAMMER2_PFSTYPE_NONE rather than 0
Tomohiro Kusumi [Thu, 29 Sep 2022 04:01:19 +0000 (21:01 -0700)]
sys/vfs/hammer2: Use HAMMER2_PFSTYPE_NONE rather than 0

19 months agosys/vfs/hammer2: Make sure PFS exists after chain lookup on mount
Tomohiro Kusumi [Tue, 27 Sep 2022 08:02:52 +0000 (01:02 -0700)]
sys/vfs/hammer2: Make sure PFS exists after chain lookup on mount

If pmp is NULL at this point, it panics, so return EINVAL.

What makes the existing code complicated is pmp could have already
been found via @label matching about 300 lines above, regardless of
chain lookup result right before this diff.

So return EINVAL on `pmp == NULL` rather than `chain->error != 0`.
In any case, something is wrong if chain lookup failed despite pmp.

19 months agosys/vfs/hammer2: hammer2_ioctl_inode_{get,set} never returns error
Tomohiro Kusumi [Tue, 27 Sep 2022 04:13:40 +0000 (21:13 -0700)]
sys/vfs/hammer2: hammer2_ioctl_inode_{get,set} never returns error

No need to do hammer2_error_to_errno(error).

19 months agosys/vfs/hammer2: Add include guard for hammer2_xxhash.h
Tomohiro Kusumi [Tue, 27 Sep 2022 04:10:24 +0000 (21:10 -0700)]
sys/vfs/hammer2: Add include guard for hammer2_xxhash.h

19 months agosbin/hammer2: Remove HAMMER1 comment from dirhash()
Tomohiro Kusumi [Sun, 25 Sep 2022 09:20:05 +0000 (02:20 -0700)]
sbin/hammer2: Remove HAMMER1 comment from dirhash()

and sync with hammer2_dirhash() which doesn't have this comment.
The latter half of the comment doesn't apply.

19 months agosys/vfs/hammer2: Rename hammer2_chain_core_init() -> hammer2_chain_init()
Tomohiro Kusumi [Sat, 24 Sep 2022 08:11:08 +0000 (01:11 -0700)]
sys/vfs/hammer2: Rename hammer2_chain_core_init() -> hammer2_chain_init()

Currently this function is just a common function to initialize chains.
What it initializes are no longer limited to chain->core as opposed to
when it first appeared in 0dea3156dc9c037aae4fd9fb00c631a401f62e5a in 2013.

Remove "core" for clarity and remove irrelevant comment.

19 months agosys/vfs/hammer2: Change readonly purpose sysctls to CTLFLAG_RD
Tomohiro Kusumi [Sat, 24 Sep 2022 06:12:10 +0000 (23:12 -0700)]
sys/vfs/hammer2: Change readonly purpose sysctls to CTLFLAG_RD

read/write/allocation/process counters shouldn't be writable.

19 months agosys/vfs/hammer2: Use __debugvar for RB_INSERT() result only used in KKASSERT
Tomohiro Kusumi [Fri, 23 Sep 2022 07:10:12 +0000 (00:10 -0700)]
sys/vfs/hammer2: Use __debugvar for RB_INSERT() result only used in KKASSERT

19 months agosys/vfs/hammer2: Use __debugvar rather than trying to use it outside KASSERT
Tomohiro Kusumi [Wed, 21 Sep 2022 03:05:13 +0000 (20:05 -0700)]
sys/vfs/hammer2: Use __debugvar rather than trying to use it outside KASSERT

Redo 9944926ceb4c39de216e512f60f1841d25e267f1.

suggested-by: swildner

19 months agosys/vfs/hammer2: Avoid unused warning when !INVARIANTS
Tomohiro Kusumi [Sun, 18 Sep 2022 10:15:12 +0000 (03:15 -0700)]
sys/vfs/hammer2: Avoid unused warning when !INVARIANTS

Use xchain local variable.
error: variable 'xchain' set but not used [-Werror,-Wunused-but-set-variable]

19 months agousr.sbin/makefs: Sync with sys/vfs/hammer2
Tomohiro Kusumi [Sun, 18 Sep 2022 01:11:28 +0000 (18:11 -0700)]
usr.sbin/makefs: Sync with sys/vfs/hammer2

Sync with following sys/vfs/hammer2 commits.

 $ git log --pretty="%h %s" 8a656edff0678e34ac00175186cb6850eadc9441.. -- sys/vfs/hammer2/
 b18a596227 Revert "sys/vfs/hammer2: Properly set rdonly flag for PFS"
 617766ee20 sys/vfs/hammer2: Fix typo in error message
 b108516224 sys/vfs/hammer2: Fail mount if root volume was not specified
 e9ecf1728d sys/vfs/hammer2: Remove unused local variable bigread
 de2601344f sys/vfs/hammer2: Remove unused modify_tid argument in hammer2_pfsalloc()
 5f5122fa24 sys/vfs/hammer2: Properly set rdonly flag for PFS
 a5e418c0eb sys/vfs/hammer2: Fix incorrect hammer2_dump_chain() argument

19 months agonrelease - Copy `/etc/ssl/cert.pem` into ISOROOT
Michael Neumann [Sat, 17 Sep 2022 16:28:41 +0000 (18:28 +0200)]
nrelease - Copy `/etc/ssl/cert.pem` into ISOROOT

Otherwise it fails when using target `binpkg`:

```
9984868:error:14FFF086:SSL routines:(UNKNOWN)SSL_internal:certificate verify failed:/usr/src/lib/libressl/../../crypto/libressl/ssl/tls13_client.c:617:
pkg-static: https://mirror-master.dragonflybsd.org/dports/dragonfly:6.4:x86:64/LATEST/packagesite.txz: Authentication error
Unable to update repository Avalon
Error updating repositories!
```

19 months agousr.sbin/makefs: Allow FIFO hardlink for HAMMER2
Tomohiro Kusumi [Sat, 17 Sep 2022 07:24:01 +0000 (00:24 -0700)]
usr.sbin/makefs: Allow FIFO hardlink for HAMMER2

since this is possible on actual HAMMER2 as well.

19 months agousr.sbin/makefs: Support hardlink (vop_nlink) for HAMMER2
Tomohiro Kusumi [Fri, 16 Sep 2022 08:04:36 +0000 (01:04 -0700)]
usr.sbin/makefs: Support hardlink (vop_nlink) for HAMMER2

Currently only regular file is allowed for hardlink.

19 months agousr.sbin/makefs: Support FIFO (vop_nmknod) for HAMMER2
Tomohiro Kusumi [Fri, 16 Sep 2022 03:30:30 +0000 (20:30 -0700)]
usr.sbin/makefs: Support FIFO (vop_nmknod) for HAMMER2

19 months agourtwn - Add support for Edimax EW-7811Un V2 (N150)
Michael Neumann [Wed, 14 Sep 2022 15:40:30 +0000 (17:40 +0200)]
urtwn - Add support for Edimax EW-7811Un V2 (N150)

19 months agoRevert "sys/vfs/hammer2: Properly set rdonly flag for PFS"
Tomohiro Kusumi [Tue, 13 Sep 2022 08:35:07 +0000 (01:35 -0700)]
Revert "sys/vfs/hammer2: Properly set rdonly flag for PFS"

This reverts commit 5f5122fa2471887600e87e29917d577f65d73a05.

pmp->ronly should be set properly, but hammer2_remount() implementation
is missing pmp handling.

19 months agosys/vfs/hammer2: Fix typo in error message
Tomohiro Kusumi [Tue, 13 Sep 2022 07:25:40 +0000 (00:25 -0700)]
sys/vfs/hammer2: Fix typo in error message

19 months agosys/vfs/hammer2: Fail mount if root volume was not specified
Tomohiro Kusumi [Mon, 12 Sep 2022 07:12:04 +0000 (00:12 -0700)]
sys/vfs/hammer2: Fail mount if root volume was not specified

If !rootvoldata->version, root volume was never specified which is invalid.
This prevents panic (in hammer2_verify_volumes_1() via vol->dev->path dereference)
on attempt to mount only non-root volumes.

19 months agosbin/newfs_hammer2: Fix -V option being required for multi-volumes
Tomohiro Kusumi [Sun, 11 Sep 2022 08:30:52 +0000 (01:30 -0700)]
sbin/newfs_hammer2: Fix -V option being required for multi-volumes

Since 2d60b848f2 ("usr.sbin/makefs: Add HAMMER2 support") creating multi-volumes
required explicit '-V 2' option, which wasn't the case before.

19 months agosbin/hammer2: Rename CountBlocks() -> count_blocks()
Tomohiro Kusumi [Sun, 11 Sep 2022 01:30:13 +0000 (18:30 -0700)]
sbin/hammer2: Rename CountBlocks() -> count_blocks()

This (and only this) static function has been camel case.

19 months agousr.sbin/makefs: Correct a typo in a source code comment
Tomohiro Kusumi [Sat, 10 Sep 2022 09:32:04 +0000 (02:32 -0700)]
usr.sbin/makefs: Correct a typo in a source code comment

taken-from FreeBSD 5f285d5537219932c12ce4e6149d1a4f26aa3457

19 months agosys/vfs/hammer2: Remove unused local variable bigread
Tomohiro Kusumi [Fri, 9 Sep 2022 08:05:56 +0000 (01:05 -0700)]
sys/vfs/hammer2: Remove unused local variable bigread

Warned on other platform.
error: variable 'bigread' set but not used [-Werror,-Wunused-but-set-variable]

19 months agodsynth: Call free() after asprintf() .
Antonio Huete Jimenez [Thu, 8 Sep 2022 23:49:38 +0000 (01:49 +0200)]
dsynth: Call free() after asprintf() .

19 months agodsynth - better error reporting for dependency parsing (5)
Alexandr Savca (chinarulezzz) [Thu, 8 Sep 2022 10:53:36 +0000 (13:53 +0300)]
dsynth - better error reporting for dependency parsing (5)

Fix typo.

19 months agosys/vfs/hammer2: Remove unused modify_tid argument in hammer2_pfsalloc()
Tomohiro Kusumi [Thu, 8 Sep 2022 03:30:05 +0000 (20:30 -0700)]
sys/vfs/hammer2: Remove unused modify_tid argument in hammer2_pfsalloc()

No longer used since 0057d3b85eefbd3e0309a08a0a41f2e438f3bf9b in 2015.

19 months agosys/vfs/hammer2: Properly set rdonly flag for PFS
Tomohiro Kusumi [Wed, 7 Sep 2022 07:11:28 +0000 (00:11 -0700)]
sys/vfs/hammer2: Properly set rdonly flag for PFS

VOP's check if PFS is rdonly mount, but pmp->ronly is always 0.

Note that VFS usually returns error for rdonly mount before
process even reaches there.

19 months agodsynth - better error reporting for dependency partsing (4)
Matthew Dillon [Tue, 6 Sep 2022 16:00:44 +0000 (09:00 -0700)]
dsynth - better error reporting for dependency partsing (4)

* Add even more information.  Print which dependency variable
  is having the trouble.

19 months agodsynth - better error reporting for dependency partsing (3)
Matthew Dillon [Tue, 6 Sep 2022 15:48:40 +0000 (08:48 -0700)]
dsynth - better error reporting for dependency partsing (3)

* Sigh

19 months agodsynth - better error reporting for dependency partsing (2)
Matthew Dillon [Tue, 6 Sep 2022 15:46:51 +0000 (08:46 -0700)]
dsynth - better error reporting for dependency partsing (2)

* Output original dependency string (its big) prior to strsep
  changes.

19 months agodsynth - add 'list-system' directive
Matthew Dillon [Tue, 6 Sep 2022 15:03:58 +0000 (08:03 -0700)]
dsynth - add 'list-system' directive

* Add a 'list-system' directive which generates a list of installed
  ports on the current machine that can then be used as a build list
  on another machine.

19 months agodsynth - better error reporting for dependency partsing
Matthew Dillon [Tue, 6 Sep 2022 15:03:18 +0000 (08:03 -0700)]
dsynth - better error reporting for dependency partsing

* Do a better job reporting problems parsing dependencies

Reported-by: tuxillo
19 months agosbin/newfs_hammer2: Remove reference to nonexistent HAMMER2(5)
Tomohiro Kusumi [Mon, 5 Sep 2022 10:10:09 +0000 (03:10 -0700)]
sbin/newfs_hammer2: Remove reference to nonexistent HAMMER2(5)

hammer(5) exists, but no such thing hammer2(5).

19 months agosys/vfs/hammer2: Fix incorrect hammer2_dump_chain() argument
Tomohiro Kusumi [Mon, 5 Sep 2022 09:17:59 +0000 (02:17 -0700)]
sys/vfs/hammer2: Fix incorrect hammer2_dump_chain() argument

The third argument is blockref index within parent,
so initial caller should always pass 0.

Currently i happens to be always 0.

19 months agosys/vfs/autofs: Include <sys/proc.h> for APRINTF()
Tomohiro Kusumi [Mon, 5 Sep 2022 01:40:51 +0000 (18:40 -0700)]
sys/vfs/autofs: Include <sys/proc.h> for APRINTF()

19 months agousr.sbin/makefs: Panic if fifo hits HAMMER2_XOPFIFO
Tomohiro Kusumi [Fri, 2 Sep 2022 17:40:06 +0000 (10:40 -0700)]
usr.sbin/makefs: Panic if fifo hits HAMMER2_XOPFIFO

tsleep() calls assert(0), but explicitly panic if feed detects
fifo limit. HAMMER2 in makefs has no dedicated XOP threads,
so it can't sleep and nobody can wake it up.

19 months agosys/vfs/autofs: Test if curproc is NULL in debug print
Tomohiro Kusumi [Fri, 2 Sep 2022 17:23:05 +0000 (10:23 -0700)]
sys/vfs/autofs: Test if curproc is NULL in debug print

20 months agosbin/newfs_hammer2: Don't fail to zero clear buffer for root inodes
Tomohiro Kusumi [Tue, 23 Aug 2022 08:14:52 +0000 (01:14 -0700)]
sbin/newfs_hammer2: Don't fail to zero clear buffer for root inodes

Seeing root inodes containing garbage on other platform.

20 months agosbin/hammer2: Fix comment mkpfs -> pfs-create
Tomohiro Kusumi [Wed, 17 Aug 2022 06:30:13 +0000 (23:30 -0700)]
sbin/hammer2: Fix comment mkpfs -> pfs-create

"mkpfs" existed only until ae183399278ee71fba31527cd18a7545ac9af2e4 in 2012.

20 months agousr.sbin/makefs: Sync with sys/vfs/hammer2
Tomohiro Kusumi [Fri, 12 Aug 2022 07:12:39 +0000 (00:12 -0700)]
usr.sbin/makefs: Sync with sys/vfs/hammer2

Sync with following sys/vfs/hammer2 commits.

 # git log --pretty="%h %s" 2d60b848f2503f28d840ceae174d07eb149ccce9.. -- sys/vfs/hammer2/
 668318c124 sys/vfs/hammer2: Remove comment on nonexistent hammer2_pfs_moderate()
 adbe992149 sys/vfs/hammer2: Remove unused pmp local variable
 ebb25fd8bc sys/vfs/hammer2: Remove redundant *dev local variable
 b9777b339d sys/vfs/hammer2: Remove no longer used hammer2_cluster_forcegood()
 e239545684 sys/vfs/hammer2: Fix indentation
 18aaa4b139 sys/vfs/hammer2: Remove unused local variables in hammer2_chain.c
 fc134ad976 sys/vfs/hammer2: Remove unused pmp local variable
 73503323eb sys/vfs/hammer2: Remove unused local variables in hammer2_primary_xops_thread()
 26ded3a850 sys/vfs/hammer2: Remove unused smpresent local variable
 353c2689d5 sys/vfs/hammer2: Remove unused local pmp variable

20 months agosys/vfs/hammer2: Remove comment on nonexistent hammer2_pfs_moderate()
Tomohiro Kusumi [Wed, 10 Aug 2022 07:12:36 +0000 (00:12 -0700)]
sys/vfs/hammer2: Remove comment on nonexistent hammer2_pfs_moderate()

hammer2_pfs_moderate() was removed in
d2a410239c107d0aeceaf0a17417e92b75be24ed in 2018.

20 months agosys/vfs/hammer2: Remove unused pmp local variable
Tomohiro Kusumi [Tue, 9 Aug 2022 07:12:07 +0000 (00:12 -0700)]
sys/vfs/hammer2: Remove unused pmp local variable

Never used since first appeared in
c92abd0f77ba75e840c762f6ac141f120ccb38dd in 2016.

Warned on other platform.
error: variable 'pmp' set but not used [-Werror,-Wunused-but-set-variable]

20 months agosys/vfs/hammer2: Remove redundant *dev local variable
Tomohiro Kusumi [Tue, 9 Aug 2022 04:30:39 +0000 (21:30 -0700)]
sys/vfs/hammer2: Remove redundant *dev local variable

Currently all it does is point to another local variable
and no pointer arithmetic.

20 months agosys/vfs/hammer2: Remove no longer used hammer2_cluster_forcegood()
Tomohiro Kusumi [Sat, 6 Aug 2022 08:30:06 +0000 (01:30 -0700)]
sys/vfs/hammer2: Remove no longer used hammer2_cluster_forcegood()

No longer used since "ends the major refactoring" from
01d71aa5538cba09383737ddbea2fb05e1e75e78 in 2015.

20 months agosys/vfs/hammer2: Fix indentation
Tomohiro Kusumi [Fri, 5 Aug 2022 08:30:12 +0000 (01:30 -0700)]
sys/vfs/hammer2: Fix indentation

21 months agosys/vfs/hammer2: Remove unused local variables in hammer2_chain.c
Tomohiro Kusumi [Thu, 28 Jul 2022 07:25:16 +0000 (00:25 -0700)]
sys/vfs/hammer2: Remove unused local variables in hammer2_chain.c

Remove lots of "set but not used" which get warned on other platform.

These variables mostly come from functions these are based on.

21 months agosys/vfs/hammer2: Remove unused pmp local variable
Tomohiro Kusumi [Wed, 27 Jul 2022 09:34:23 +0000 (02:34 -0700)]
sys/vfs/hammer2: Remove unused pmp local variable

Never used since first appeared in
b7add6753e221920947c96fab3314c39a2f67fe4 in 2015.

Warned on other platform.
error: variable 'pmp' set but not used [-Werror,-Wunused-but-set-variable]

21 months agosys/vfs/hammer2: Remove unused local variables in hammer2_primary_xops_thread()
Tomohiro Kusumi [Wed, 27 Jul 2022 05:37:33 +0000 (22:37 -0700)]
sys/vfs/hammer2: Remove unused local variables in hammer2_primary_xops_thread()

pmp was unused since 21a904588eeea78c4050292c4c477f008a38784f in 2015.
last_desc was never used since first appeared.

These get warned on other platform.
error: variable 'pmp' set but not used [-Werror,-Wunused-but-set-variable]
error: variable 'last_desc' set but not used [-Werror,-Wunused-but-set-variable]

21 months agosys/vfs/hammer2: Remove unused smpresent local variable
Tomohiro Kusumi [Mon, 25 Jul 2022 06:22:08 +0000 (23:22 -0700)]
sys/vfs/hammer2: Remove unused smpresent local variable

Unused since f3bfcc3fda3d70dd80cbb0440b5b8649ca2d07de in 2022
and this gets warned on other platform.
error: variable 'smpresent' set but not used [-Werror,-Wunused-but-set-variable]

21 months agoif_bridge - Fix a broadcast issue, cleanup
Matthew Dillon [Mon, 25 Jul 2022 00:19:58 +0000 (17:19 -0700)]
if_bridge - Fix a broadcast issue, cleanup

* Fix a broadcast issue in bridge_output().  This routine takes packets
  originated on the machine that are sent to an interface that is part
  of the bridge.  These are NOT forwarded packets, but packets originated
  on the machine.

  For all intents and purposes, these packets are being sent to the bridge
  and the interface on the bridge that the system looked-up should not be
  treated specially.

* This should fix issues with ARPs sometimes going into the bit-bucket.

* Distinguish between interfaces that are part of the same bonded set
  (i.e. go to the same place) from round-robin vs backup mode.

  Previously there was some confusion as to whether the interfaces were
  distinct or not.  All interfaces on the bridge with the same MAC are
  considered to be bonded for the purposes of packet rejection when
  forwarding and masking when broadcasting.  i.e. the multiple end-points
  go between the same two end-points.  The mode is then determined by
  the ifpriority of the highest-priority interfaces.  If the ifpriority
  is different, backup mode is assumed.  If the ifpriority for the highest
  priority bonded set is the same, round-robin mode is assumed.

* Clean-up documentation and adjust the syntax for multi-line if()
  statements for readability.

* These fixes do not address potential issues with loops in the
  spanning tree yet.

21 months agoUpdate the pciconf(8) database.
Sascha Wildner [Sat, 23 Jul 2022 00:54:35 +0000 (02:54 +0200)]
Update the pciconf(8) database.

July 17, 2022 snapshot from https://pci-ids.ucw.cz

21 months agolibc - Correct handling of non-hex sequences in strtol*() and related
Matthew Dillon [Wed, 13 Jul 2022 16:07:12 +0000 (09:07 -0700)]
libc - Correct handling of non-hex sequences in strtol*() and related

* The standard clarifies that non-hex sequences such as "0xy"
  should return 0 and a pointer to "xy".  Ours was returning
  0 and a pointer to "y".  Fixed.

* Unlikely to be any net effect on code other than improved
  standards conformity.

Reported-by: Herbert J. Skuhra
21 months agofetch - Fix -T timeout operation for additional cases
Matthew Dillon [Mon, 11 Jul 2022 03:40:46 +0000 (20:40 -0700)]
fetch - Fix -T timeout operation for additional cases

* The -T timeout flag does not always timeout the program.  The
  implementation only tested it during the initial connection and
  header fetch, not during data transfers.

* Makme the -T timeout apply to data transfers.  However, any progress
  on the transfer resets the timer.

* Volatilize several variables that need it, and add an interlock
  to deal with alarm() races.  Also, when the SIGALRM occurs, if
  still enabled it will be re-armed and fire off every second thereafter
  until processed, since the alarm might not catch a blocked system call
  in progress.

21 months agosys/vfs/hammer2: Remove unused local pmp variable
Tomohiro Kusumi [Sun, 10 Jul 2022 08:38:07 +0000 (01:38 -0700)]
sys/vfs/hammer2: Remove unused local pmp variable

Warned on other platform.
error: variable 'pmp' set but not used [-Werror,-Wunused-but-set-variable]

21 months agodrm: retry page fault handler on buffer data in transit
Sergey Zigachev [Fri, 8 Jul 2022 17:31:27 +0000 (22:31 +0500)]
drm: retry page fault handler on buffer data in transit

Fixes Xorg crash on a connect/disconnect monitor when using amdgpu with
modesetting driver. Crash occured because buffer object was in transit
state. Added retry loop that allows up to 100 iterations allowing buffer object
to "catch up". During testing around 30-40 iterations were observed.

Co-authored-by: Matthew Dillon <dillon@apollo.backplane.com>
21 months agoTest commit
Sergey Zigachev [Fri, 8 Jul 2022 17:19:51 +0000 (22:19 +0500)]
Test commit

21 months agousr.sbin/makefs: Cast daddr_t to off_t before multiplication
Tomohiro Kusumi [Wed, 6 Jul 2022 19:43:08 +0000 (12:43 -0700)]
usr.sbin/makefs: Cast daddr_t to off_t before multiplication

Apparently some large-file systems out there, such as my powerpc64le
Linux box, define daddr_t as a 32-bit type, which is sad and stymies
cross-building disk images.  Cast daddr_t to off_t before doing
arithmetic that overflows.

taken-from FreeBSD 7ef082733bf8989797b71025ba6d597a7d17d92b

21 months agousr.sbin/makefs: Allocate extra inodes in makefs when leaving free space in UFS images
Tomohiro Kusumi [Wed, 6 Jul 2022 05:31:01 +0000 (22:31 -0700)]
usr.sbin/makefs: Allocate extra inodes in makefs when leaving free space in UFS images

By default, makefs(8) has very few spare inodes in its output images,
which is fine for static filesystems, but not so great for VM images
where many more files will be added. Make makefs(8) use the same
default settings as newfs(8) when creating images with free space --
there isn't much point to leaving free space on the image if you
can't put files there. If no free space is requested, use current
behavior of a minimal number of available inodes.

taken-from FreeBSD afb6a168f8ee08ac74769464726c396fbef83d0b

21 months agousr.sbin/makefs: Fix calculation of file sizes
Tomohiro Kusumi [Wed, 6 Jul 2022 04:54:34 +0000 (21:54 -0700)]
usr.sbin/makefs: Fix calculation of file sizes

When a new FS image is created we need to calculate how much space each
file is going to consume.
Fix two bugs in that logic:

1) Count the space needed for indirect blocks for large files.
1) Normally the trailing data of a file is written to a block of frag
   size, 4 kB by default.

However for files that use indirect blocks a full block is allocated,
32kB by default.  Take that into account.

Adjust size calculations to match what is done in ffs_mkfs routine:

* Depending on the UFS version the superblock is stored at a different
  offset. Take that into account.
* Add the cylinder group block size.
* All of the above has to be aligned to the block size.

Finally, Remove "ncg" variable. It's always 1 and it was used to
multiply stuff.

taken-from FreeBSD ecdc04d006de93eb343ce3b77208abd937d4f8ac

21 months agodebug - more ncptrace enhancements
Matthew Dillon [Mon, 4 Jul 2022 07:40:55 +0000 (00:40 -0700)]
debug - more ncptrace enhancements

* Accumulate counts for unres, leafs, fache, and negative entries,
  and print at the end.

21 months agokernel - Attempt to fix broken vfs.cache.numunres tracker (2)
Matthew Dillon [Mon, 4 Jul 2022 07:39:32 +0000 (00:39 -0700)]
kernel - Attempt to fix broken vfs.cache.numunres tracker (2)

* The main culprit appears to be cache_allocroot() accounting
  for new root ncps differently than the rest of the module.
  So anything which mounts and umounts continuously, like
  dsynth, can seriously make the numbers whacky.

* Fix that and run an overnight test.

21 months agodebug - add nc_generation output from ncptrace
Matthew Dillon [Mon, 4 Jul 2022 05:28:00 +0000 (22:28 -0700)]
debug - add nc_generation output from ncptrace

* Adjust ncptrace to print the value of nc_generation

21 months agosh - Support writes to non-blocking descriptors
Matthew Dillon [Mon, 4 Jul 2022 03:54:42 +0000 (20:54 -0700)]
sh - Support writes to non-blocking descriptors

* Instead of reporting "write error on stdout", support writes
  to non-blocking sockets by having xwrite() use poll() to block
  when EAGAIN is returned.

* This is possibly related to such errors appearing in the dsynth
  logs.  Presumably (unverified), /bin/sh can wind up being executed
  with descriptor 1 set to non-blocking.  This works fine only as long
  as the other end of the pipe is able to drain it quickly enough.
  But under heavy loads, this might not happen.

21 months agokernel - check nc_generation in nlookup path
Matthew Dillon [Mon, 4 Jul 2022 03:47:32 +0000 (20:47 -0700)]
kernel - check nc_generation in nlookup path

* With nc_generation now operating in a more usable manner, we can
  use it in nlookup() to check for changes.  When a change is detected,
  the related lock will be cycled and the entire nlookup() will retry up
  to debug.nlookup_max_retries, which currently defaults to 4.

* Add debugging via debug.nlookup_debug.  Set to 3 for nc_generation
  debugging.

* Move "Parent directory lost" kprintfs into a debugging conditional,
  reported via (debug.nlookup_debug & 4).

* This fixes lookup/remove races which could sometimes cause open()
  and other system calls to return EINVAL or ENOTCONN.  Basically
  what happened was that nlookup() wound up on a NCF_DESTROYED entry.

* A few minutes worth of a dsynth bulk does not report any random
  generation number mismatches or retries, so the code in this commit
  is probably very close to correct.

21 months agokernel - Change ncp->nc_generation operation
Matthew Dillon [Mon, 4 Jul 2022 00:10:51 +0000 (17:10 -0700)]
kernel - Change ncp->nc_generation operation

* Change nc_generation operation.  Bit 0 is reserved.  The field is
  incremented by 2 whenever major changes are being made to the ncp
  (linking, unlinking, destruction, resolve, unresolve, vnode adjustment),
  and then incremented by 2 again when the operation is complete.

  The caller can test for a major gen change using:

  curr_gen = ncp->nc_generation & ~3;
  if ((orig_gen - curr_gen) & ~1)
      (retry needed)

* Allows unlocked/relocked code to determine whether the ncp has possibly
  changed or not (will be used in upcoming commits).

* Adjust the kern_rename() code to use the generation numbers.

* Bit 0 will be used to check for a combination of major changes and
  lock cycling inthe future.

21 months agokernel - Attempt to fix broken vfs.cache.numunres tracker
Matthew Dillon [Sun, 3 Jul 2022 23:31:00 +0000 (16:31 -0700)]
kernel - Attempt to fix broken vfs.cache.numunres tracker

* Try to fix a mis-count that can accumulate under heavy loads.

* In cache_setvp() and cache_setunresolved(), only adjust the
  unres count for namecache entries that are linked into the
  topology.

21 months agomanual - Silently accept any value for IPV6_V6ONLY sockopt
Matthew Dillon [Fri, 1 Jul 2022 02:41:15 +0000 (19:41 -0700)]
manual - Silently accept any value for IPV6_V6ONLY sockopt

* Update the ip6(4) manual page with the new behavior of IPV6_V6ONLY.

21 months agokernel - Silently accept any value for IPV6_V6ONLY sockopt
Matthew Dillon [Fri, 1 Jul 2022 02:11:11 +0000 (19:11 -0700)]
kernel - Silently accept any value for IPV6_V6ONLY sockopt

* Numerous utilities including named behave horribly if the IPV6_V6ONLY
  socketopt returns a failure.  We were returning failure if anyone
  attempted to set it to 0.

* just silently ignore the value entirely, always return success.  Fixes
  named, libuv (which named uses), and numerous other ports that use
  libuv or otherwise stupidly mess with this socketopt.

Reported-by: tuxillo
22 months agoAdd a small amdgpu.4 manual page.
Sascha Wildner [Sat, 18 Jun 2022 19:36:22 +0000 (21:36 +0200)]
Add a small amdgpu.4 manual page.

Submitted-by: Sergey Zigachev <s.zi@outlook.com>
22 months ago<stdlib.h>: Don't expose malloc_usable_size() in POSIX environments.
Sascha Wildner [Sat, 11 Jun 2022 07:59:09 +0000 (09:59 +0200)]
<stdlib.h>: Don't expose malloc_usable_size() in POSIX environments.

22 months agoUnbreak buildworld.
Sascha Wildner [Sat, 11 Jun 2022 07:58:32 +0000 (09:58 +0200)]
Unbreak buildworld.

csh uses its own malloc_usable_size(), which, now that its prototype comes
in with <stdlib.h>, has to take a const argument, too. :-(

22 months agokernel - namecache eviction fixes
Matthew Dillon [Sat, 11 Jun 2022 04:38:37 +0000 (21:38 -0700)]
kernel - namecache eviction fixes

* Fix several namecache eviction issues which interfere with nlookup*()
  functions.

  There is an optimization where nlookup*() avoids locking intermediate
  ncp's in a path whenever possible on the assumption that the ref on
  the ncp will prevent eviction.  This assumption fails when the machine
  is under a heavy namecache load.

  Errors included spurious ENOTCONN and EINVAL error codes from file
  operations.

* Refactor the namecache code to not evict resolved namecache entries
  which have extra refs under normal operation.  This allows nlookup*()
  and other functions to operate semi-lockless for intermediate elements
  in a path.  However, they still obtain a ref which is a cache-unfriendly
  atomic operation.

  This fixes numerous weird errors that occur during heavy dsynth bulk
  builds.

* Also fix a bug which evicted too many resolved namecache entries when
  attempting to evict unresolved entries.  This should improve performance
  under heavy namecache loads a bit.

22 months agoworld - include malloc_np.h from stdlib.h
Matthew Dillon [Sat, 11 Jun 2022 04:34:27 +0000 (21:34 -0700)]
world - include malloc_np.h from stdlib.h

* Include malloc_np.h from stdlib.h as per FreeBSD manual page.
  Note that linux includes it from <malloc.h>, but BSD's do not
  have a malloc.h so this is the easier path for now.

22 months agolibc - Fix bug in recent malloc_usable_size() support
Matthew Dillon [Thu, 9 Jun 2022 06:25:13 +0000 (23:25 -0700)]
libc - Fix bug in recent malloc_usable_size() support

* Add missing unlock in the bigalloc check path

* Fixes miniruby deadlock and other threaded uses of malloc_usable_size()
  on large memory blocks.

22 months agomalloc.3: Unify RETURN VALUES. Add info about malloc_usable_size().
Sascha Wildner [Wed, 8 Jun 2022 15:06:49 +0000 (17:06 +0200)]
malloc.3: Unify RETURN VALUES. Add info about malloc_usable_size().