Repository: go
Issue: os: recent FreeBSD update to sys/fusefs to allow kevents breaks go polling model 
Labels: OS-FreeBSD,NeedsInvestigation

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.18.4 freebsd/amd64
</pre>

### Does this issue reproduce with the latest release?

Yes, but it's dependent on the FreeBSD release. i.e. issue present on FreeBSD 13.1 and greater. 

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS="-mod=vendor"
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="freebsd"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go118"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go118/pkg/tool/freebsd_amd64"
GOVCS=""
GOVERSION="go1.18.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="cc"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/usr/local/poudriere/ports/default/net/rclone/work/github.com/rclone/rclone@v1.59.0/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3160769938=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.18.4 freebsd/amd64
GOROOT/bin/go tool compile -V: compile version go1.18.4
uname -v: FreeBSD 14.0-CURRENT #3 main-n256462-79e1500276a-dirty: Thu Jun 30 19:37:24 EDT 2022     root@e6220:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG
lldb --version: lldb version 14.0.5 (https://github.com/llvm/llvm-project.git revision llvmorg-14.0.5-0-gc12386ae247c)
  clang revision llvmorg-14.0.5-0-gc12386ae247c
  llvm revision llvmorg-14.0.5-0-gc12386ae247c
</pre></details>

### What did you do?
Tried to use the rclone program https://github.com/rclone/rclone to mount a remote filesystem.  (rclone uses fuse behind the scenes.) 

<pre># rclone mount ~ /mnt</pre>

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->


### What did you expect to see?
(nothing) the <b>rclone mount</b> command should complete without error.


### What did you see instead?
<pre>
# rclone mount ~ /mnt
2022/07/27 17:57:57 ERROR : /mnt: Unmounted rclone mount
2022/07/27 17:57:57 Fatal error: failed to umount FUSE fs: resource temporarily unavailable
</pre>

### Discussion
The issue is discussed in FreeBSD bug 258056 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258056

That *BSD does not map regular files to polling is covered here https://github.com/golang/go/issues/19093

### Possible patch
Patch below adds "/dev/fuse" as another <tt>pollable = false</tt> exception.

<pre>
--- src/os/file_unix.go.orig    2022-07-12 11:22:57.000000000 -0400
+++ src/os/file_unix.go 2022-07-27 08:35:28.234028000 -0400
@@ -165,6 +165,10 @@
                        if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && typ == syscall.S_IFIFO {
                                pollable = false
                        }
+
+                       if runtime.GOOS == "freebsd" && name == "/dev/fuse" {  // /dev/fuse always reports ready for writing
+                               pollable = false
+                       }
                }
        }
</pre>