Re: [PATCH] io_uring: fix race with shadow drain deferrals

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

 



On 11/20/19 6:57 PM, Jackie Liu wrote:
>> @@ -2957,15 +2975,14 @@ static void io_queue_sqe(struct io_kiocb *req)
>> 	int ret;
>>
>> 	ret = io_req_defer(req);
>> -	if (ret) {
>> -		if (ret != -EIOCBQUEUED) {
>> -			io_cqring_add_event(req, ret);
>> -			if (req->flags & REQ_F_LINK)
>> -				req->flags |= REQ_F_FAIL_LINK;
>> -			io_double_put_req(req);
>> -		}
>> -	} else
>> +	if (!ret) {
>> 		__io_queue_sqe(req);
>> +	} else if (ret != -EIOCBQUEUED) {
>> +		io_cqring_add_event(req, ret);
>> +		if (req->flags & REQ_F_LINK)
>> +			req->flags |= REQ_F_FAIL_LINK;
>> +		io_double_put_req(req);
>> +	}
>> }
> 
> Hmm.. Why we need rewrite there? clear code? Seems to be unrelated to
> this issue.

We don't need to, and the previous patch touched it, but it's much
easier to read after this change. Before it was:

if (ret) {
	if (ret != -EIOCBQUEUED) {
		...
	}
} else {
	...
}

which is now just

if (!ret) {
	...
} else if (ret != -EIOCBQUEUED) {
	...
}

not related to the change really, but kind of silly to make a separate
patch for imho.

-- 
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