]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: adjust the policy of holding subscription kref
authorYing Xue <ying.xue@windriver.com>
Tue, 28 Mar 2017 10:28:28 +0000 (12:28 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 29 Mar 2017 01:03:33 +0000 (18:03 -0700)
commit430cb3fc91af2ca6a4cca82a0b252bca2a50540a
tree17bdb6c1fe9c4a204421de23f7f347073b868deb
parent26a2f835130eb4629a98325af9cf37d7e129b350
tipc: adjust the policy of holding subscription kref

When a new subscription object is inserted into name_seq->subscriptions
list, it's under name_seq->lock protection; when a subscription is
deleted from the list, it's also under the same lock protection;
similarly, when accessing a subscription by going through subscriptions
list, the entire process is also protected by the name_seq->lock.

Therefore, if subscription refcount is increased before it's inserted
into subscriptions list, and its refcount is decreased after it's
deleted from the list, it will be unnecessary to hold refcount at all
before accessing subscription object which is obtained by going through
subscriptions list under name_seq->lock protection.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/name_table.c
net/tipc/subscr.c
net/tipc/subscr.h