Re: io_uring file descriptor address already in use error

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

 



> On Aug 26, 2020, at 12:26 PM, Josef <josef.grieb@xxxxxxxxx> wrote:
> 
> On Wed, 26 Aug 2020 at 15:44, Jens Axboe <axboe@xxxxxxxxx> wrote:
>> 
>> On 8/25/20 9:01 PM, Josef wrote:
>>>> In order for the patch to be able to move ahead, we'd need to be able
>>>> to control this behavior. Right now we rely on the file being there if
>>>> we need to repoll, see:
>>>> 
>>>> commit a6ba632d2c249a4390289727c07b8b55eb02a41d
>>>> Author: Jens Axboe <axboe@xxxxxxxxx>
>>>> Date:   Fri Apr 3 11:10:14 2020 -0600
>>>> 
>>>>    io_uring: retry poll if we got woken with non-matching mask
>>>> 
>>>> If this never happened, we would not need the file at all and we could
>>>> make it the default behavior. But don't think that's solvable.
>>>> 
>>>>> is there no other way around to close the file descriptor? Even if I
>>>>> remove the poll, it doesn't work
>>>> 
>>>> If you remove the poll it should definitely work, as nobody is holding a
>>>> reference to it as you have nothing else in flight. Can you clarify what
>>>> you mean here?
>>>> 
>>>> I don't think there's another way, outside of having a poll (io_uring
>>>> or poll(2), doesn't matter, the behavior is the same) being triggered in
>>>> error. That doesn't happen, as mentioned if you do epoll/poll on a file
>>>> and you close it, it won't trigger an event.
>>>> 
>>>>> btw if understood correctly poll remove operation refers to all file
>>>>> descriptors which arming a poll in the ring buffer right?
>>>>> Is there a way to cancel a specific file descriptor poll?
>>>> 
>>>> You can cancel specific requests by identifying them with their
>>>> ->user_data. You can cancel a poll either with POLL_REMOVE or
>>>> ASYNC_CANCEL, either one will find it. So as long as you have that, and
>>>> it's unique, it'll only cancel that one specific request.
>>> 
>>> thanks it works, my bad, I was not aware that user_data is associated
>>> with the poll request user_data...just need to remove my server socket
>>> poll which binds to an address so I think this patch is not really
>>> necessary
>>> 
>>> btw IORING_FEAT_FAST_POLL feature which arming poll for read events,
>>> how does it work when the file descriptor(not readable yet) wants to
>>> read(non blocking) something and I close(2) the file descriptor? I'm
>>> guessing io_uring doesn't hold any reference to it anymore right?
>> 
>> Most file types will *not* notify you through poll if they get closed,
>> so it'll just sit there until canceled. This is the same with poll(2) or
>> epoll(2). io_uring will continue to hold a reference to the file, it
>> does that over request completion for any request that uses a file.
> 
> 
> okay, btw according to the man page IORING_OP_POLL_REMOVE it's unclear
> to me what value user_data contains in the cqe
> I'm guessing user_data is always 0 right? just tested it with liburing
> I got always 0(user_data) even if there is no polling request

The user_data is *always* passed straight from the sqe, so it is set to whatever you put in there. That’s a key component of the protocol, allowing you to tie a completion event back to your submission. And also allows you to do a directed cancel event for a given pending request. 





[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