Re: [QUESTION/sysfs] strange refcounting

From: Artem B. Bityutskiy
Date: Sat Feb 04 2006 - 07:03:16 EST


Artem B. Bityutskiy wrote:
Then, I see /sys/devices/mydev/ in sysfs. I open
pre-defined /sys/devices/mydev/power/state in userspace and don't close it.

Then I run lsmod, and see zero refcount to my module. Well, I run rmmod
mymod, module is unloaded.

Then I close /sys/devices/mydev/power/state, and enjoy segfault.

I actually forgot to formulate my question: why module's refcount is not increased when somebody opens a sysfs file which belongs to this module? How to withstan to an unexpected module unload?

Thanks.

--
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.
-
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/