netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GENETLINK]: Question: global lock (genl_mutex) possible refinement?
@ 2007-07-20 12:52 Richard MUSIL
  2007-07-20 13:21 ` Patrick McHardy
  0 siblings, 1 reply; 12+ messages in thread
From: Richard MUSIL @ 2007-07-20 12:52 UTC (permalink / raw)
  To: netdev

I am currently trying to write a module which communicates with user space using NETLINK_GENERIC. This module (dev_mgr) manages virtual devices which are also supposed to use genetlink for communication with user space.

I want to do something like that:
dev_mgr <- receives message from user space to create new device
dev_mgr	inside 'doit' handler:
	1. creates device
	2. registers new genetlink family for the device
	3. returns family name and id to user

This should work similarly for device removal.

After few reboots I found out that 2. blocks on genl_mutex, since this mutex is already acquired when genl_register_family is called (by genl_rcv).

I do not see why registering new family (when processing message for another family) should be a problem. In fact from genl_lock and genl_trylock occurrence it seems that genl_mutex is mostly used for syncing access to family list and also for message processing.
Since I am not (yet) familiar enough with (ge)netlink internals I am asking:
Would it make sense to split the mutex into two, one for family list and one for messaging, so it would be possible to change families when processing the message?

Simple split could introduce possible danger of user removing family inside processing of the message for this particular family, but would this really be a danger?

--
Richard

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-08-17  8:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-20 12:52 [GENETLINK]: Question: global lock (genl_mutex) possible refinement? Richard MUSIL
2007-07-20 13:21 ` Patrick McHardy
2007-07-20 13:58   ` Richard MUSIL
2007-07-20 14:00     ` Patrick McHardy
2007-07-20 16:15       ` Richard MUSIL
2007-07-23 10:29         ` Thomas Graf
2007-07-23 16:45           ` Richard MUSIL
2007-07-24  9:35             ` Thomas Graf
2007-07-24 11:09               ` Richard MUSIL
2007-08-10  8:52                 ` Richard MUSIL
2007-08-16 15:58                 ` Thomas Graf
2007-08-17  8:38                   ` Richard MUSIL

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).