sys/vfs/fuse: Some mmap related fixes, issues with sshfs and FUSE_FORGET * Only issue FUSE_FSYNC when there is a file-handle associated with the fuse_node. * Be sure to flush the VM object on inactive before releasing the file handle (fixes issues with mmap()). * Don't issue FUSE_FORGET for now, it seems to confuse sshfs so either I'm doing something wrong or ... don't know.
sys/vfs/fuse: Fix a ton more stuff * Remove all the fuse_dent code. It is no longer needed. * Remove signal mask wrappers. tsleep() isn't passing PCATCH so signals are basically ignored. * Add missing required FUSE_RELEASE operations (paired with CREATE/OPEN) * Add missing required FUSE_FORGET operations (paired with LOOKUPs). "." and ".." are not recorded by userland and do not need to be forgotten (will confuse userland if they are). * No reply is expected from FUSE_FORGET RPCs, add infrastructure to handle this case. * Index fuse_node's by their inode number, which greatly improves hardlink handling. * Properly store the file-handle for CREATE operations so we can release it later (fixes some dangling .fuse_hidden* files). * Flush the vnode and issue a FUSE_RELEASE when removing a file, including in the rename-over-file case, if the file is no longer open. Otherwise cached vnodes that have not yet been reclaimed will interfere with the removal and cause the fuse userland to create a .fuse_hidden* file. NOTE: RELEASE operations still need a bit of work. The v_opencount test in the file removal path is not sufficient, but we had to close RELEASEs there for the general case to avoid many annoying cases where .fuse_hidden* files are created.
sys/vfs/fuse: Fix a ton of stuff and get writes working * Recode all the file I/O. Use the buffer cache properly, create a backend for BIO strategy calls. mmap() should work properly now. write() should also now work properly. * For the moment issue vfinalize() when the opencount == 0 to force the DFly kernel to dispose of inactive vnodes once all references (including mmap references) are gone. * Recode the filehandle (fh) tracking. File handles are assigned in fuse_vop_open() and instead of being released in fuse_vop_close() (which completely blows up mmap() operations), we now release file handles in fuse_vop_inactive(). Remove the fh side allocation. The fh is now positively stored in the fuse_node. * Properly zero data structures allocated via the objcache. * Implement the new syncer thread / syncer scan API for fsync operations. * Implement asynchronous I/O in the frontend (the backend helper thread is currently still synchronous). * Rejigger how attributes are handled when the file size changes. It is still a bit of a mess but it is better than before. The basic problem is that the file attribute info in userland does not update the file size field until we flush the BIOs related to an append. * Not yet fixed: hard link related issues (duplicate fuse_node inodes are allocated). nlink tracking was a mess. Adjust fuse_node->nlink to only track the allocated directory entries on the kernel side. Do not try to update it against attribute nlink counts. We always report thte attribute nlink counts... the fuse_node->nlink only tracks local directory entries for the moment. * Fix a use-after-free situation that can develop with the root vnode for the fuse filesystem. * Properly disconnect fnp->pfnp linkages and move connection and disconnection to fuse_dent_attach() and fuse_dent_detach(). * Improve atomicy in fuse_node_vn(). * Implement advisory locks locally on the kernel side. * Not yet fixed: Multiple fuse_node's can have the same inode because we are not yet indexing them by inode number.
Fix null dereference bug in fuse and re-enable it. There was a null dereference bug in fuse if the subtype was null. subtype is supposed to be optional, as demonstrated by the code, so test it for null before copying it in from userspace. Remove the redundant memcpy which appears to have been missed when the code was changed to memset/copyinstr.
less(1): Regenerate defines.h and update Makefiles - Regenerate 'defines.h' as described in 'README.DRAGONFLY'. - Update the Makefiles for less(1), lessecho(1) and lesskey(1). - Install the lessecho.1 man page.
Merge branch 'vendor/LESS'
vendor/less: upgrade from 608 to 643 Security fix: CVE-2022-46663 (version <= 608) - https://github.com/gwsw/less/commit/a78e1351113cef564d790a730d657a321624d79c - https://nvd.nist.gov/vuln/detail/CVE-2022-46663 - https://bugs.dragonflybsd.org/issues/3360 See the NEWS file for the list of changes.
sockstat(1): Fix and improve output formatting The main issue with the old formatting was that the FD column was limited to 2 characters, so there would be no space between FD and PROTO columns. Increase the FD column to 5 characters, and increase the PID column to 6 characters. In addition, refactor the output formatting code to clean up the mess. While there, clean up the code a bit to save some type castings.
procfs(5): Add '/proc/self/exe' symlink support * Add the /proc/self symlink that's the same as /proc/curproc. * Add the /proc/<pid>/exe entry that's the same as /proc/<pid>/file. The '/proc/self/exe' symlink has been already landed in NetBSD and FreeBSD [0]. It could simplify some patches to ports that look for this symlink. [0] https://github.com/freebsd/freebsd-src/pull/976 GitHub PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/22
gzip(1): Set file flags after setting file times Only set the source file flags on the target file after the timestamp has been set; otherwise setting the timestamp will fail if the flags don't permit it (i.e., uchg). To reproduce the issue: $ /usr/bin/touch /tmp/foo $ /bin/chflags uchg /tmp/foo $ /usr/bin/gzip -v /tmp/foo gzip: couldn't utimes: /tmp/foo.gz: Operation not permitted GitHub PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/21 See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=120208