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.
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
stf(4): Set ND6 flags to disable auto link-local and DAD Clear the 'ND6_IFF_AUTO_LINKLOCAL' flag and set the 'ND6_IFF_NO_DAD' flag for the stf(4) interface after if_attach(). In this way, the quirks in in6_ifattach() is removed.
netinet6: Improve flexibility of receiving Router Advertisement Convert the sysctl 'net.inet6.ip6.accept_rtadv' to be the default value of the per-interface flag 'ND6_IFF_ACCEPT_RTADV', making it no longer a global knob. Now the receiving RA is allowed if ip6_forwarding==0 *and* 'ND6_IFF_ACCEPT_RTADV' is set on that interface. ndp(8) already supports to toggle the 'ND6_IFF_ACCEPT_RTADV' flag via the 'accept_rtadv' option. Derived from FreeBSD.
netinet6: Add per-interface flag ND6_IFF_NO_DAD flag to disable DAD An interface that has no link-local address should also have DAD disabled. So this flag is generally set for an interface that has the ND6_IFF_AUTO_LINKLOCAL flag cleared. Derived from FreeBSD.
netinet6: Improve handling of auto link-local address configuration Add a new per-interface flag 'ND6_IFF_AUTO_LINKLOCAL' and convert the sysctl 'net.inet6.ip6.auto_linklocal' to be the default value of this new per-interface flag. This allows to fine control the automatic link-local address configuration on a per-interface basis. Update ndp(8) to support to toggle the 'ND6_IFF_AUTO_LINKLOCAL' flag by adding the 'auto_linklocal' option. Document the 'IPV6CTL_AUTO_LINKLOCAL' option in the inet6(4) man page. Derived from FreeBSD.
net: Reimplement packet loop detection based on mbuf tags The original naive implementation based on mbuf 'm_pkthdr.loop_cnt' was flawed: * There were likely some code paths that allocated mbufs failed to initialize the 'loop_cnt' to be zero. This caused unwanted packet drops in gif(4), as reported by Kyle Butt (iteratee). * The 'loop_cnt' was system-wide and thus cannot distinguish between the nesting of specific drivers. For example, it would break an actually valid setup that makes use of both gif(4) and gre(4). As a result, follow the FreeBSD's way and reimplement the packet loop detection based on mbuf tags. Each driver is allocated a unique mbuf tag cookie, and thus a unique mbuf tag will be created to track the nesting level of each driver. The if_tunnel_check_nesting() was derived from FreeBSD but I changed it to use only one mbuf tag for each cookie (i.e., driver). Although it can no longer directly detect that a packet loops through the same interface, it would still be prevented as that would lead to infinite recursions. Update gif(4), gre(4) and wg(4) to use the new loop detection facility. Bump __DragonFly_version as well. Reported-by: Kyle Butt (iteratee)
wg: Improve error handling in wg_output() - Don't send ICMP error if the packet looped, avoiding infinite loops. - Move the packet loop detection upper to optimize the logic a bit. - Integrate xmit_err() into wg_output() to simplify the error handling. - Just increase 'oerrors' and don't use 'oqdrops', which doesn't really make more sense here.