Re: [PATCH] module: add kset_obj_exists() and use it

From: Veaceslav Falico
Date: Thu Apr 11 2013 - 11:39:51 EST


On Thu, Apr 11, 2013 at 08:20:03AM -0700, Greg KH wrote:
On Thu, Apr 11, 2013 at 03:53:40PM +0200, Veaceslav Falico wrote:
On Thu, Apr 11, 2013 at 06:28:31AM -0700, Greg KH wrote:
>On Thu, Apr 11, 2013 at 11:55:37AM +0200, Veaceslav Falico wrote:
...

In both examples we don't look at that kobject, and only uselessly
_get()/_put() it. And it looks a bit ugly. After the patch, in both cases,
it takes only one call to kset_obj_exists() to find out if the object
exists at that time.

But as your function does the same thing, logically it's the same code
path :)

Anyway, yes, I understand your point here, and in some new code I'm
writing right now, we had to do much the same check as well. But as
there are only 2 in-kernel users of this "pattern", I don't think it's
justified to add a new api call for it, especially if it were to be
misused as you were attempting to use it, which would only mask the real
problem you were trying to solve.

Good point, it really might mask the real problem, as it would actually do
for the initial race.


So, thanks for the idea, but for now, I'll pass.

Fair enough. Thank you for explaining :)


thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/