aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* mount_nullfs: rename a local variableAlan Somers2021-02-121-7/+7
| | | | | | | | | | | | | The "source" variable was introduced in r26072, probably as the traditional counterpart to "target". But the "source"/"target" names suggest the opposite of their actual meaning. With ln, for example, the source is the real file and the target is the newly created link. In mount_nullfs the meaning is the opposite: the target is the existing file system and the source is the newly created mountpoint. Better to use "target"/"mountpoint" terminology, which matches the man page. MFC after: 6 weeks Sponsored by: Axcient
* ssh: remove ssh-hpn leftoversEd Maste2021-02-121-6/+0
| | | | | | | | | | | | This was introduced in 8998619212f3a, and left behind when the hpn-ssh patches were removed in 60c59fad8806. Although Being able to log SO_RCVBUF in debug mode might have some small value on its own, it's not worth carrying an extra diff against upstream. Reviewed by: kevans MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28610
* Adding PRR sysctls to tcp(4) man pageRichard Scheffenegger2021-02-121-2/+15
| | | | | | | | | | | | Summary: Documenting the newly added, and enabled by default, Proportional Rate Reduction algorithm's governing sysctls. MFC: 3 days Reviewed By: kbowling, rgrimes Differential Revision: https://reviews.freebsd.org/D28568
* Fix bug 253158 - Panic: snapacct_ufs2: bad block - mksnap_ffs(8) crashKirk McKusick2021-02-121-67/+70
| | | | | | | | | | | | | | | | | | | | | | | The panic reported in 253158 arises because the /mnt/.snap/.factory snapshot allocated the last block in the filesystem. The snapshot code allocates the last block in the filesystem as a way of setting its length to be the size of the filesystem. Part of taking a snapshot is to remove all the earlier snapshots from the image of the newest snapshot so that newer snapshots will not claim the blocks of the earlier snapshots. The panic occurs when the new snapshot finds that both it and an earlier snapshot claim the same block. The fix is to set the size of the snapshot to be one block after the last block in the filesystem. This block can never be allocated since it is not a valid block in the filesystem. This extra block is used as a place to store the initial list of blocks that the snapshot has already copied and is used to avoid a deadlock in and speed up the ffs_copyonwrite() function. Reported by: Harald Schmalzbauer Tested by: Peter Holm PR: 253158 Sponsored by: Netflix
* ssh: remove unused variableEd Maste2021-02-121-1/+1
| | | | | | | | | | | | | This was introduced in 03f6c5cd93ec, which added use of sysctl net.inet.ip.portrange.reservedhigh instead of IPPORT_RESERVED, but it appears the rest of that change was lost in some subsequent update. The change should probably be restored, but until then there is no reason to leave an unused variable around. MFC after: 3 days Sponsored by: The FreeBSD Foundation
* ssh: diff reduction against OpenBSD, remove unused includesEd Maste2021-02-122-2/+0
| | | | | | | These appear to be leftovers from ca86bcf2531c7 and f7167e0ea0bf5 MFC after: 3 days Sponsored by: The FreeBSD Foundation
* fifo: minor comment and assert improvements.Konstantin Belousov2021-02-122-4/+6
| | | | | | | | | | In particular, replace a note that reload through vget() is obsoleted, with explanation why this code is required. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ffs_unlock: assert that IN_ENDOFF is not leaked past locked scopeKonstantin Belousov2021-02-121-0/+3
| | | | | | | | | | This catches both missed processing of IN_ENDOFF and missed application of VOP_VPUT_PAIR() after VOP that created an entry in the directory. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ffs softdep: Force processing of VI_OWEINACT vnodes when there is inode shortageKonstantin Belousov2021-02-122-0/+63
| | | | | | | | | | Such vnodes prevent inode reuse, and should be force-cleared when ffs_valloc() is unable to find a free inode. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* softdep_request_cleanup: wait for softdep_request_clean_flush() to passKonstantin Belousov2021-02-121-0/+6
| | | | | | | | | | | if we noted a parallel request is active and declined to overflow the system with parallel redundant sync of the vnodes. But we need to wait for the flush to finish to see if there are any freed resources. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ufs_inactive(): stop hiding ERELOOKUP from ffs_truncate(), return it.Konstantin Belousov2021-02-122-6/+5
| | | | | | | | | | VFS should retry inactivation when possible, then. This should provide timely removal of unlinked unreferenced inodes. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* Stop ignoring ERELOOKUP from VOP_INACTIVE()Konstantin Belousov2021-02-123-16/+42
| | | | | | | | | | | | | When possible, relock the vnode and retry inactivation. Only vunref() is required not to drop the vnode lock, so handle it specially by not retrying. This is a part of the efforts to ensure that unlinked not referenced vnode does not prevent inode from reusing. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ufs vnops: brace softdep_prelink() with DOINGSUJ instead of DOINGSOFTDEPKonstantin Belousov2021-02-121-6/+6
| | | | | | | | | | | | because softdep_prelink() is reverted to NOP for non-J case. There is no need to do anything before ufs_direnter() in SU/non-J case, everything required to sync the directory is done in VOP_VPUT_PAIR(). Suggested by: mckusick Reviewed by: chs, mckusick Tested by: pho MFC after: 2 week Sponsored by: The FreeBSD Foundation
* ffs softdep: remove will_direnter argument of softdep_prelink()Konstantin Belousov2021-02-123-45/+15
| | | | | | | | | | | | | | | | | | | Originally this was done in 8a1509e442bc9a075 to forcibly cover cases where a hole in the directory could be created by extending into indirect block, since dependency of writing out indirect block is not tracked. This results in excessive amount of fsyncing the directories, where all creation of new entry forced fsync before it. This is not needed, it is enough to fsync when IN_NEEDSYNC is set, and VOP_VPUT_PAIR() provides the required hook to only perform required syncing. The series of changes culminating in this commit puts the performance of metadata-intensive loads back to that before 8a1509e442bc9a075. Analyzed by: mckusick Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ufs_direnter: directory truncation does not need special case for renameKonstantin Belousov2021-02-124-26/+23
| | | | | | | | | | | | | | | | | | | In ufs_rename case, tdvp is locked from the place where ufs_direnter() is done till VOP_VPUT_PAIR(), which means that we no longer need to specially handle rename in ufs_direnter(). Truncation, if possible, is done in the same way in ffs_vput_pair() both for rename and other VOPs calling ufs_direnter(). Remove isrename argument and set IN_ENDOFF if ufs_direnter() succeeded and directory needs truncation. In ffs_vput_pair(), stop verifying the condition that directory needs truncation when IN_ENDOFF is set, instead assert that the condition is true. Suggested by: mckusick Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ufs_rename: use VOP_VPUT_PAIR and rely on directory sync/truncation thereKonstantin Belousov2021-02-121-28/+6
| | | | | | | | Suggested by: mckusick Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ufs_direnter: move directory truncation to ffs_vput_pair().Konstantin Belousov2021-02-123-25/+46
| | | | | | | | | | | | | | | | VOP_VPUT_PAIR() provides the hook to do the truncation right before unlock, which is required since truncation might need to fsync(), which itself might unlock the directory vnode. Set new flag IN_ENDOFF which indicates that i_endoff is valid and should be checked against inode size. Excessive size is chomped, but this operation is advisory and failure to truncate should not result in the failure of the main VOP. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ffs_vput_pair(): try harder to recover from the vnode reclaimKonstantin Belousov2021-02-121-3/+36
| | | | | | | | | | | | | | | | | In particular, if unlock_vp is false, save vp's inode number and generation. If ffs_inotovp() can re-create the vnode with the same number and generation after we finished with handling dvp, then we most likely raced with unmount, and were able to restore atomicity of open. We use FFSV_REPLACE_DOOMED there, to drop the old vnode. This additional recovery is not strictly required, but it improves the quality of the implementation. Suggested by: mckusick Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* FFS: implement special VOP_VPUT_PAIR().Konstantin Belousov2021-02-121-0/+55
| | | | | | | | | | | | It cleans IN_NEEDSYNC flag on dvp before returning, by applying ffs_syncvnode() until success or an error different from ERELOOKUP. IN_NEEDSYNC cleanup is required to avoid creating holes in the directories when extended into indirect block. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* nfsserver: use VOP_VPUT_PAIR().Konstantin Belousov2021-02-121-16/+22
| | | | | | | | | | Apply VOP_VPUT_PAIR() to the end of vnode operations after the VOP_MKNOD(), VOP_MKDIR(), VOP_LINK(), VOP_SYMLINK(), VOP_CREATE(). Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ffs_snapshot: use VOP_VPUT_PAIR after VOP_CREATE.Konstantin Belousov2021-02-121-2/+7
| | | | | | | | | If the snapshot embrio was reclaimed under us, return error outright. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* Use VOP_VPUT_PAIR() for eligible VFS syscalls.Konstantin Belousov2021-02-123-21/+18
| | | | | | | | | | | The current list is limited to the cases where UFS needs to handle vput(dvp) specially. Which means VOP_CREATE(), VOP_MKDIR(), VOP_MKNOD(), VOP_LINK(), and VOP_SYMLINK(). Reviewed by: chs, mkcusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* nullfs: provide special bypass for VOP_VPUT_PAIRKonstantin Belousov2021-02-121-0/+49
| | | | | | | | | Generic bypass cannot understand the rules of liveness for the VOP. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* Add VOP_VPUT_PAIR() with trivial default implementation.Konstantin Belousov2021-02-122-0/+24
| | | | | | | | | | | | | | | | | | | | | | The VOP is intended to be used in situations where VFS has two referenced locked vnodes, typically a directory vnode dvp and a vnode vp that is linked from the directory, and at least dvp is vput(9)ed. The child vnode can be also vput-ed, but optionally left referenced and locked. There, at least UFS may need to do some actions with dvp which cannot be done while vp is also locked, so its lock might be dropped temporary. For instance, in some cases UFS needs to sync dvp to avoid filesystem state that is currently not handled by either kernel nor fsck. Having such VOP provides the neccessary context for filesystem which can do correct locking and handle potential reclamation of vp after relock. Trivial implementation does vput(dvp) and optionally vput(vp). Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* vn_open(): If the vnode is reclaimed during open(2), do not return error.Konstantin Belousov2021-02-122-4/+9
| | | | | | | | | | | | | | Most future operations on the returned file descriptor will fail anyway, and application should be ready to handle that failures. Not forcing it to understand the transient failure mode on open, which is implementation-specific, should make us less special without loss of reporting of errors. Suggested by: chs Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ufs_direnter/SU: unconditionally UFS_UPDATE inode when extending directoryKonstantin Belousov2021-02-121-3/+1
| | | | | | | | | | for all kinds of async/SU mount variants. Submitted by: mckusick Reviewed by: chs Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ffs_syncvnode: only clear IN_NEEDSYNC after successfull syncKonstantin Belousov2021-02-121-1/+2
| | | | | | | | | | If it is cleaned before the sync, other threads might see the inode without the flag set, because syncing could unlock it. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* Merge ufs_fhtovp() into ffs_inotovp().Konstantin Belousov2021-02-123-30/+17
| | | | | | | | | | The function alone was not used for anything but ffs_fstovp() for long time. Suggested by: mckusick Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ffs_inotovp(): interface to convert (ino, gen) into alive vnodeKonstantin Belousov2021-02-124-29/+40
| | | | | | | | | | | | It generalizes the VFS_FHTOVP() interface, making it possible to fetch the inode without faking filehandle. Also it adds the ffs flags argument which allows to control ffs_vgetf() call. Requested by: mckusick Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ffs: Add FFSV_REPLACE_DOOMED flag to ffs_vgetf()Konstantin Belousov2021-02-122-4/+8
| | | | | | | | | | | | It specifies that caller requests a fresh non-doomed vnode. If doomed vnode is found in the hash, it should behave similarly to FFSV_REPLACE. Or, to put it differently, the flag is same as FFSV_REPLACE, but only when the found hashed vnode is doomed. Reviewed by: chs, mkcusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* ffs: call ufsdirhash_dirtrunc() right after setting directory sizeKonstantin Belousov2021-02-123-6/+13
| | | | | | | | | | | Later processing of ffs_truncate() might temporary unlock the directory vnode, causing unsychronized dirhash and inode sizes if update is postponed to UFS_TRUNCATE() callers. Reviewed by: chs, mkcusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* buf SU hooks: track buf_start() calls with B_IOSTARTED flagKonstantin Belousov2021-02-123-7/+27
| | | | | | | | | | | | | | | | | and only call buf_complete() if previously started. Some error paths, like CoW failire, might skip buf_start() and do bufdone(), which itself call buf_complete(). Various SU handle_written_XXX() functions check that io was started and incomplete parts of the buffer data reverted before restoring them. This is a useful invariant that B_IO_STARTED on buffer layer allows to keep instead of changing check and panic into check and return. Reported by: pho Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundations
* ffs_vnops.c: Move opt_*.h includes to the top.Konstantin Belousov2021-02-121-2/+3
| | | | | | | | | | as it is done in other places. Header files might need options defined for correct operation. Reviewed by: chs, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
* pkg(7): address minor nits (mostly clang-analyze complaints)Kyle Evans2021-02-122-5/+3
| | | | | | | | | | | | | | | | - One (1) spurious whitespace. - One (1) occurrence of "random(3) bad, arc4random(3)" good. - Three (3) writes that will never be seen. The latter two points are complaints from clang-analyze. Switching to arc4random(3) is decidedly a good idea because we weren't doing any kind of PRNG seeding anyways. The discarded assignments are arguably good for future-proofing, but it's better to improve the S/N ratio from clang-analyze. Reviewed by: bapt, manu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28525
* pkg(7): add an -r reponame option for bootstrap and addKyle Evans2021-02-124-19/+91
| | | | | | | | | | | | | | | | | This is limited to bootstrap/add because some real pkg(8) commands have -r flags with an incompatible meaning/usage, e.g., pkg-audit. pkg(7) will still commence the search as it has, but it will ignore any repo objects without the given name so that overrides and whatnot still work as expected. The use of it for add is noted in the manpage; notably, that the signature config for that repository will be used over global config if it's specified. i.e., pkg(7) should assume that the given pkg did come from that repository and treat it appropriately. Reviewed by: bapt, manu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28524
* yacc: Regen test cases for the previous commitJung-uk Kim2021-02-1188-313/+313
|
* yacc: Use NULL instead of 0 for pointersJung-uk Kim2021-02-114-14/+14
| | | | | Note araujo tried to fix it in r298241 but he only touched generated files for bootstrap. This commit properly fixes the problem.
* lex: Use NULL instead of 0 for pointersJung-uk Kim2021-02-111-1/+1
| | | | | Note araujo tried to fix it in r298241 but he only touched generated files for bootstrap. This commit properly fixes the problem.
* efibootmgr: Check for efi supported after parsing argsWarner Losh2021-02-111-2/+3
| | | | | Move the check for efi variables being supported to after parsing the args. This allows '-h' to produce both as a normal user as well as on all systems.
* Fix blackhole/reject routes.Alexander V. Chernikov2021-02-111-2/+56
| | | | | | | | | | | | | | | | | | | Traditionally *BSD routing stack required to supply some interface data for blackhole/reject routes. This lead to varieties of hacks in routing daemons when inserting such routes. With the recent routeing stack changes, gateway sockaddr without RTF_GATEWAY started to be treated differently, purely as link identifier. This change broke net/bird, which installs blackhole routes with 127.0.0.1 gateway without RTF_GATEWAY flags. Fix this by automatically constructing necessary gateway data at rtsock level if RTF_REJECT/RTF_BLACKHOLE is set. Reported by: Marek Zarychta <zarychtam at plan-b.pwste.edu.pl> Reviewed by: donner MFC after: 1 week
* cam: Properly find the sim in the assertion in xpt_pollwait().John Baldwin2021-02-111-1/+2
| | | | | | | | I had missed merging this fixup into 447b3557a9cc5f00a301be8404339f21a9a0faa8 before pushing it. Pointy hat to: jhb MFC after: 2 weeks
* iscsi: Mark iSCSI CAM sims as non-pollable.John Baldwin2021-02-111-9/+1
| | | | | | | | | | | | | Previously, iscsi_poll() just panicked. This meant if you got a panic on a box when using the iSCSI initiator, the attempt to shutdown would trigger a nested panic and never write out a core. Now, CCB's sent to iSCSI devices (such as the sychronize-cache request in dashutdown()) just fail with a timeout during a panic shutdown. Reviewed by: scottl, mav MFC after: 2 weeks Sponsored by: Chelsio Differential Revision: https://reviews.freebsd.org/D28455
* cam: Don't permit crashdumps on non-pollable devices.John Baldwin2021-02-113-4/+7
| | | | | | | | | | | If a disk's SIM doesn't support polling, then it can't be used to store crashdumps. Leave d_dump NULL in that case so that dumpon(8) fails gracefully rather than having dumps fail at crash time. Reviewed by: scottl, mav, imp MFC after: 2 weeks Sponsored by: Chelsio Differential Revision: https://reviews.freebsd.org/D28454
* cam: Permit non-pollable sims.John Baldwin2021-02-113-1/+15
| | | | | | | | | | | | | | Some CAM sim drivers do not support polling (notably iscsi(4)). Rather than using a no-op poll routine that always times out requests, permit a SIM to set a NULL poll callback. cam_periph_runccb() will fail polled requests non-pollable sims immediately as if they had timed out. Reviewed by: scottl, mav (earlier version) Reviewed by: imp MFC after: 2 weeks Sponsored by: Chelsio Differential Revision: https://reviews.freebsd.org/D28453
* Widen ifnet_detach_sxlock coverageKristof Provost2021-02-113-7/+11
| | | | | | | | | Widen the ifnet_detach_sxlock to cover the entire vnet sysuninit code. This ensures that we can't end up having the vnet_sysuninit free the UDP pcb while the detach code is running and trying to purge the UDP pcb. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28530
* release.sh: fix OSVERSION and UNAME_r overridesGlen Barber2021-02-111-0/+7
| | | | | | | | | Add PBUILD_FLAGS and UNAME_r overrides to extra_chroot_setup() to fix building ports for 14-CURRENT builds on 13.x. MFC after: 3 days MFC with: c511a5ab53ba335dc85f7ac93843872eb5763602 Sponsored by: Rubicon Communications, LLC ("Netgate")
* mlx4, mthca: Silence warnings about no-op alignment operationsMark Johnston2021-02-114-9/+13
| | | | | | | | | | | | | Since commit 8fa6abb6f4f64f ("Expose clang's alignment builtins and use them for roundup2/rounddown2"), clang emits warnings for several alignment operations in these drivers because the operation is a no-op. The compiler is arguably being too strict here, but in the meantime let's silence the warnings by conditionally compiling the alignment operations. Reviewed by: arichardson, hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28576
* VOP_ADVLOCK(9): fix a typoGuangyuan Yang2021-02-111-2/+2
| | | | | | Submitted by: Ka Ho Ng <khng300@gmail.com> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28575
* Fix lib/msun/test builds on platforms without 80-bit long doublesDimitry Andric2021-02-111-0/+4
| | | | | | | | | | | After d3338f3355a612cf385632291f46c5777bba8d18, the lib/msun test case 'hypotl_near_underflow' would fail to compile on platforms where long doubles weren't 80 bit, like on x86. Disable this particular test on such platforms for now. PR: 253313 MFC after: 1 week X-MFC-With: d3338f3355a612cf385632291f46c5777bba8d18
* [udp] fix possible mbuf and lock leak in udp_input().Andrey V. Elsukov2021-02-111-5/+8
| | | | | | | | | | | | | | In error case we can leave `inp' locked, also we need to free mbuf chain `m' in the same case. Release the lock and use `badunlocked' label to exit with freed mbuf. Also modify UDP error statistic to match the IPv6 code. Remove redundant INP_RUNLOCK() from the `if (last == NULL)' block, there are no ways to reach this point with locked `inp'. Obtained from: Yandex LLC MFC after: 3 days Sponsored by: Yandex LLC