Re: [PATCH] io_uring: Redefined the meaning of io_alloc_async_data's return value

From: Jens Axboe
Date: Mon Jul 10 2023 - 13:02:28 EST


On 7/10/23 10:58?AM, Gabriel Krisman Bertazi wrote:
> Lu Hongfei <luhongfei@xxxxxxxx> writes:
>
>> Usually, successful memory allocation returns true and failure returns false,
>> which is more in line with the intuitive perception of most people. So it
>> is necessary to redefine the meaning of io_alloc_async_data's return value.
>>
>> This could enhance the readability of the code and reduce the possibility
>> of confusion.
>
> just want to say, this is the kind of patch that causes bugs in
> downstream kernels. It is not fixing anything, and when we backport a
> future bugfix around it, it is easy to miss it and slightly break the
> semantics.

Exactly! This is also why I'm not a fan of patches like this, and was
not intending to apply it.

> That's my downstream problem, of course. But at least it would be good

Strictly speaking it is, but I think we have a responsibility to not
have core bits be different upstream "just because". IOW, making it
harder to introduce problems when backporting.

And fwiw, I'm not sure I agree on the idiomatic part of it. Lots of
functions return 0 for success and non-zero for an error. It's a bit odd
as this one is a bool, but I'm pretty sure it used to return an actual
error and this is why it looks the way it currently does.

--
Jens Axboe