[Bug 265736] [FUSEFS] fuse(4) reports error on F_SETFL, O_RDWR|O_NONBLOCK but still sets the device in non-blocking mode

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 09 Aug 2022 13:39:27 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265736

            Bug ID: 265736
           Summary: [FUSEFS] fuse(4) reports error on F_SETFL,
                    O_RDWR|O_NONBLOCK but still sets the device in
                    non-blocking mode
           Product: Base System
           Version: 13.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: paulzhol@gmail.com

Created attachment 235799
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=235799&action=edit
bazil/fuse workaround

(Copied from https://github.com/golang/go/issues/54100#issuecomment-1200165500)

I ran the bazil/fuse/examples/hellofs example
(https://github.com/bazil/fuse/blob/master/examples/hellofs/hello.go), under
truss, getting the same result:
# truss -SdHf -o /tmp/truss ./hellofs -fuse.debug /tmp/tst1
2022/07/30 14:30:17 resource temporarily unavailable

 3678 100150: 0.032046504 open("/dev/fuse",O_RDWR|O_CLOEXEC,00) = 3 (0x3)

 3678 100150: 0.032667484 fstat(3,{ mode=crw-rw-rw-
,inode=102,size=0,blksize=4096 }) = 0 (0x0)
 3678 100150: 0.032856138 kqueue()               = 4 (0x4)
 3678 100150: 0.033037163 fcntl(4,F_SETFD,FD_CLOEXEC) = 0 (0x0)


 3678 100150: 0.033541314 compat11.kevent(4,{
3,EVFILT_READ,EV_ADD|EV_CLEAR,0,0,0x827253f68
3,EVFILT_WRITE,EV_ADD|EV_CLEAR,0,0,0x827253f68 },2,0x0,0,0x0) = 0 (0x0)
 3678 100150: 0.033721862 fcntl(3,F_GETFL,)      = 2 (0x2)
 3678 100150: 0.033866169 fcntl(3,F_SETFL,O_RDWR|O_NONBLOCK) ERR#19 'Operation
not supported by device'

The fcntl(3,F_SETFL,O_RDWR|O_NONBLOCK) reports an error, but still sets the
underlying file status flag to non-blocking. This later causes a read to return
EAGAIN which breaks the program.

-- 
You are receiving this mail because:
You are the assignee for the bug.