Re: Bug (?) in subsystem kset refcounts

From: Alan Stern
Date: Sun Nov 09 2003 - 12:04:00 EST


On Sat, 8 Nov 2003, Greg KH wrote:

> See the patch that went into Linus's tree yesterday to fix where this
> would happen.

Ah yes. Glad to see the problem has been fixed.

> But yes, usages of these macros is touchy, and we need to get it
> correct. Your proposed patch will never allow the reference counts to
> go back to zero.
>
> Also, notice that when the kobject is initialized, the kset set by these
> macros is then incremented.

Right, I didn't notice that.

It's unfortunate that initialization of various parts of a kobject or
driver-model object is so order-sensitive. Worse yet is the fact that
these dependencies are not mentioned in Documentation/kobject.txt,
Documentation/driver-model, include/linux/kobject.h, or
include/linux/device.h. Wouldn't it be a good idea to add, for example to
Documentation/kobject.txt, a description of which members of struct
kobject must be initialized before calling kobject_init() and which must
be initialized before calling kobject_add()? And of course to do the same
for all the other important structures as well.

Alan Stern

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