Re: [PATCH 9/9] io_uring: allow events update of running poll requests

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

 



On 3/18/21 9:31 PM, Hao Xu wrote:
>> @@ -5382,24 +5387,32 @@ static int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
>>   
>>   	if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
>>   		return -EINVAL;
>> -	if (sqe->addr || sqe->ioprio || sqe->off || sqe->buf_index)
>> +	if (sqe->ioprio || sqe->off || sqe->buf_index)
>>   		return -EINVAL;
>>   	flags = READ_ONCE(sqe->len);
>> -	if (flags & ~IORING_POLL_ADD_MULTI)
>> +	if (flags & ~(IORING_POLL_ADD_MULTI | IORING_POLL_UPDATE))
>>   		return -EINVAL;
>>   
>>   	events = READ_ONCE(sqe->poll32_events);
>>   #ifdef __BIG_ENDIAN
>>   	events = swahw32(events);
>>   #endif
>> -	if (!flags)
>> +	if (!(flags & IORING_POLL_ADD_MULTI))
>>   		events |= EPOLLONESHOT;
>> +	if (flags & IORING_POLL_UPDATE) {
>> +		poll->update = true;
>> +		poll->addr = READ_ONCE(sqe->addr);
>> +	} else {
>> +		if (sqe->addr)
>> +			return -EINVAL;
>> +		poll->update = false;
> Hi Jens, is `poll->update = false` redundant?

Don't think so, the one in io_init_poll_iocb() is probably though.
Better safe than sorry... I did rework these bits in the latest, because
it has two separate flags instead of just the one.


-- 
Jens Axboe




[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