RWF_NOWAIT does not work on socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,

Now we're using io_uring's multi-shot feature,  multi-shot is similar
to epoll's edge-triggered mode, that means once one pure poll
request returns one event(cqe), we'll need to read or write continually
until EAGAIN is returned, which needs to set file to be non-blocking.

But since commit "io_uring: allow retry for O_NONBLOCK if async is
supported", seems that the non-blocking behavior has been changed.
In io_prep_rw:
+       /*
+        * If the file is marked O_NONBLOCK, still allow retry for it if it
+        * supports async. Otherwise it's impossible to use O_NONBLOCK files
+        * reliably. If not, or it IOCB_NOWAIT is set, don't retry.
+        */
+       if ((kiocb->ki_flags & IOCB_NOWAIT) ||
+           ((file->f_flags & O_NONBLOCK) && !io_file_supports_nowait(req, rw)))
                req->flags |= REQ_F_NOWAIT;

Then I tried to use RWF_NOWAIT, seems that it also does not work. In
kiocb_set_rw_flags():
    if (flags & RWF_NOWAIT) {
                if (!(ki->ki_filp->f_mode & FMODE_NOWAIT))
                        return -EOPNOTSUPP;
                kiocb_flags |= IOCB_NOIO;
        }

Seems that socket file doesn't have FMODE_NOWAIT set, so user apps
will get EOPNOTSUPP when using RWF_NOWAIT on socket. Also in
above codes, seems IOCB_NOWAIT isn't flagged too.

Any special reasons about above codes? Thanks.

Regards,
Xiaoguang Wang



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux