diff options
Diffstat (limited to 'net/tipc/subscr.c')
-rw-r--r-- | net/tipc/subscr.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 0bf91cd3733c..be3d9e3183dc 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -52,7 +52,6 @@ struct tipc_subscriber { | |||
52 | struct list_head subscrp_list; | 52 | struct list_head subscrp_list; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static void tipc_subscrp_delete(struct tipc_subscription *sub); | ||
56 | static void tipc_subscrb_put(struct tipc_subscriber *subscriber); | 55 | static void tipc_subscrb_put(struct tipc_subscriber *subscriber); |
57 | 56 | ||
58 | /** | 57 | /** |
@@ -197,15 +196,19 @@ static void tipc_subscrb_subscrp_delete(struct tipc_subscriber *subscriber, | |||
197 | { | 196 | { |
198 | struct list_head *subscription_list = &subscriber->subscrp_list; | 197 | struct list_head *subscription_list = &subscriber->subscrp_list; |
199 | struct tipc_subscription *sub, *temp; | 198 | struct tipc_subscription *sub, *temp; |
199 | u32 timeout; | ||
200 | 200 | ||
201 | spin_lock_bh(&subscriber->lock); | 201 | spin_lock_bh(&subscriber->lock); |
202 | list_for_each_entry_safe(sub, temp, subscription_list, subscrp_list) { | 202 | list_for_each_entry_safe(sub, temp, subscription_list, subscrp_list) { |
203 | if (s && memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) | 203 | if (s && memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) |
204 | continue; | 204 | continue; |
205 | 205 | ||
206 | tipc_nametbl_unsubscribe(sub); | 206 | timeout = htohl(sub->evt.s.timeout, sub->swap); |
207 | list_del(&sub->subscrp_list); | 207 | if (timeout == TIPC_WAIT_FOREVER || del_timer(&sub->timer)) { |
208 | tipc_subscrp_delete(sub); | 208 | tipc_nametbl_unsubscribe(sub); |
209 | list_del(&sub->subscrp_list); | ||
210 | tipc_subscrp_put(sub); | ||
211 | } | ||
209 | 212 | ||
210 | if (s) | 213 | if (s) |
211 | break; | 214 | break; |
@@ -236,18 +239,12 @@ static void tipc_subscrb_delete(struct tipc_subscriber *subscriber) | |||
236 | tipc_subscrb_put(subscriber); | 239 | tipc_subscrb_put(subscriber); |
237 | } | 240 | } |
238 | 241 | ||
239 | static void tipc_subscrp_delete(struct tipc_subscription *sub) | ||
240 | { | ||
241 | u32 timeout = htohl(sub->evt.s.timeout, sub->swap); | ||
242 | |||
243 | if (timeout == TIPC_WAIT_FOREVER || del_timer(&sub->timer)) | ||
244 | tipc_subscrp_put(sub); | ||
245 | } | ||
246 | |||
247 | static void tipc_subscrp_cancel(struct tipc_subscr *s, | 242 | static void tipc_subscrp_cancel(struct tipc_subscr *s, |
248 | struct tipc_subscriber *subscriber) | 243 | struct tipc_subscriber *subscriber) |
249 | { | 244 | { |
245 | tipc_subscrb_get(subscriber); | ||
250 | tipc_subscrb_subscrp_delete(subscriber, s); | 246 | tipc_subscrb_subscrp_delete(subscriber, s); |
247 | tipc_subscrb_put(subscriber); | ||
251 | } | 248 | } |
252 | 249 | ||
253 | static struct tipc_subscription *tipc_subscrp_create(struct net *net, | 250 | static struct tipc_subscription *tipc_subscrp_create(struct net *net, |