diff options
author | Patrick McHardy <kaber@trash.net> | 2011-03-28 04:39:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-30 20:14:33 -0400 |
commit | 04f482faf50535229a5a5c8d629cf963899f857c (patch) | |
tree | 698d5c8e22e68f9a621c03972556e3a73c525465 /include | |
parent | e2666f84958adb3a034b98e99699b55705117e01 (diff) |
connector: convert to synchronous netlink message processing
Commits 01a16b21 (netlink: kill eff_cap from struct netlink_skb_parms)
and c53fa1ed (netlink: kill loginuid/sessionid/sid members from struct
netlink_skb_parms) removed some members from struct netlink_skb_parms
that depend on the current context, all netlink users are now required
to do synchronous message processing.
connector however queues received messages and processes them in a work
queue, which is not valid anymore. This patch converts connector to do
synchronous message processing by invoking the registered callback handler
directly from the netlink receive function.
In order to avoid invoking the callback with connector locks held, a
reference count is added to struct cn_callback_entry, the reference
is taken when finding a matching callback entry on the device's queue_list
and released after the callback handler has been invoked.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/connector.h | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/include/linux/connector.h b/include/linux/connector.h index bcafc942e5e4..7c60d0942adb 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -88,8 +88,6 @@ struct cn_queue_dev { | |||
88 | atomic_t refcnt; | 88 | atomic_t refcnt; |
89 | unsigned char name[CN_CBQ_NAMELEN]; | 89 | unsigned char name[CN_CBQ_NAMELEN]; |
90 | 90 | ||
91 | struct workqueue_struct *cn_queue; | ||
92 | |||
93 | struct list_head queue_list; | 91 | struct list_head queue_list; |
94 | spinlock_t queue_lock; | 92 | spinlock_t queue_lock; |
95 | 93 | ||
@@ -101,20 +99,13 @@ struct cn_callback_id { | |||
101 | struct cb_id id; | 99 | struct cb_id id; |
102 | }; | 100 | }; |
103 | 101 | ||
104 | struct cn_callback_data { | ||
105 | struct sk_buff *skb; | ||
106 | void (*callback) (struct cn_msg *, struct netlink_skb_parms *); | ||
107 | |||
108 | void *free; | ||
109 | }; | ||
110 | |||
111 | struct cn_callback_entry { | 102 | struct cn_callback_entry { |
112 | struct list_head callback_entry; | 103 | struct list_head callback_entry; |
113 | struct work_struct work; | 104 | atomic_t refcnt; |
114 | struct cn_queue_dev *pdev; | 105 | struct cn_queue_dev *pdev; |
115 | 106 | ||
116 | struct cn_callback_id id; | 107 | struct cn_callback_id id; |
117 | struct cn_callback_data data; | 108 | void (*callback) (struct cn_msg *, struct netlink_skb_parms *); |
118 | 109 | ||
119 | u32 seq, group; | 110 | u32 seq, group; |
120 | }; | 111 | }; |
@@ -138,13 +129,12 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, | |||
138 | struct cb_id *id, | 129 | struct cb_id *id, |
139 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); | 130 | void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); |
140 | void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); | 131 | void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); |
132 | void cn_queue_release_callback(struct cn_callback_entry *); | ||
141 | 133 | ||
142 | struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *); | 134 | struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *); |
143 | void cn_queue_free_dev(struct cn_queue_dev *dev); | 135 | void cn_queue_free_dev(struct cn_queue_dev *dev); |
144 | 136 | ||
145 | int cn_cb_equal(struct cb_id *, struct cb_id *); | 137 | int cn_cb_equal(struct cb_id *, struct cb_id *); |
146 | 138 | ||
147 | void cn_queue_wrapper(struct work_struct *work); | ||
148 | |||
149 | #endif /* __KERNEL__ */ | 139 | #endif /* __KERNEL__ */ |
150 | #endif /* __CONNECTOR_H */ | 140 | #endif /* __CONNECTOR_H */ |