[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190122015321.GA18876@bombadil.infradead.org>
Date: Mon, 21 Jan 2019 17:53:21 -0800
From: Matthew Wilcox <willy@...radead.org>
To: linux-kernel@...r.kernel.org
Subject: Re: Design of xa_alloc
On Thu, Jan 17, 2019 at 12:08:17PM -0800, Matthew Wilcox wrote:
> It would, of course, be possible to make the xa_alloc() API identical
> to idr_alloc(). idr_alloc() has been a phenomenal success with around
> 200 callers in the kernel today. But it could be improved, and this
> seems like a good time to make the API changes.
> Problem 3 is solved by using xa_insert() instead of xa_alloc(). It does
> return a different errno (-EEXIST) instead of -ENOSPC, but most users
> convert the errno to something else anyway because -ENOSPC is a horrible
> errno to return to userspace.
Writing this down and then thinking about it more makes me think that
this is the right time to change the return code of xa_alloc(). I chose
-ENOSPC to be compatible with idr_alloc(), but bugs like
https://bugzilla.kernel.org/show_bug.cgi?id=202297
show that returning an -ENOSPC error to userspace is just confusing:
: # tc filter add dev ipenc0 parent 2:0 handle ::102 protocol ip prio 1 u32 match ip dst 224.44.44.4/32 flowid 2:102
: RTNETLINK answers: No space left on device
: We have an error talking to the kernel
I'm really tempted to make it return -EEXIST instead of -ENOSPC to match
xa_insert().
Powered by blists - more mailing lists