Commit a8304529 authored by Ying Xue's avatar Ying Xue Committed by David S. Miller
Browse files

tipc: remove bearer_lock from tipc_bearer struct

After the earlier commits ("tipc: remove 'links' list from
tipc_bearer struct") and ("tipc: introduce new spinlock to protect
struct link_req"), there is no longer any need to protect struct
link_req or or any link list by use of bearer_lock. Furthermore,
we have eliminated the need for using bearer_lock during downcalls
(send) from the link to the bearer, since we have ensured that
bearers always have a longer life cycle that their associated links,
and always contain valid data.

So, the only need now for a lock protecting bearers is for guaranteeing
consistency of the bearer list itself. For this, it is sufficient, at
least for the time being, to continue applying 'net_lock´ in write mode.

By removing bearer_lock we also pre-empt introduction of issue b) descibed
in the previous commit "tipc: remove 'links' list from tipc_bearer struct":

"b) When the outer protection from net_lock is gone, taking
    bearer_lock and node_lock in opposite order of method 1) and 2)
    will become an obvious deadlock hazard".

Therefore, we now eliminate the bearer_lock spinlock.
Signed-off-by: default avatarYing Xue <>
Reviewed-by: default avatarPaul Gortmaker <>
Signed-off-by: default avatarJon Maloy <>
Signed-off-by: default avatarDavid S. Miller <>
parent 7d33939f
......@@ -785,7 +785,6 @@ void tipc_bclink_init(void)
bcl->owner = &bclink->node;
bcl->max_pkt = MAX_PKT_DEFAULT_MCAST;
tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT);
bcl->b_ptr = &bcbearer->bearer;
bcl->state = WORKING_WORKING;
strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME);
......@@ -327,7 +327,6 @@ restart:
b_ptr->net_plane = bearer_id + 'A';
b_ptr->active = 1;
b_ptr->priority = priority;
res = tipc_disc_create(b_ptr, &b_ptr->bcast_addr, disc_domain);
if (res) {
......@@ -351,9 +350,7 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
pr_info("Resetting bearer <%s>\n", b_ptr->name);
return 0;
......@@ -365,19 +362,12 @@ static int tipc_reset_bearer(struct tipc_bearer *b_ptr)
static void bearer_disable(struct tipc_bearer *b_ptr, bool shutting_down)
struct tipc_link_req *temp_req;
pr_info("Disabling bearer <%s>\n", b_ptr->name);
tipc_link_delete_list(b_ptr->identity, shutting_down);
temp_req = b_ptr->link_req;
b_ptr->link_req = NULL;
if (temp_req)
tipc_link_delete_list(b_ptr->identity, shutting_down);
if (b_ptr->link_req)
memset(b_ptr, 0, sizeof(struct tipc_bearer));
......@@ -107,10 +107,8 @@ struct tipc_media {
* struct tipc_bearer - Generic TIPC bearer structure
* @dev: ptr to associated network device
* @usr_handle: pointer to additional media-specific information about bearer
* @media_ptr: pointer to additional media-specific information about bearer
* @mtu: max packet size bearer can support
* @lock: spinlock for controlling access to bearer
* @addr: media-specific address associated with bearer
* @name: bearer name (format = media:interface)
* @media: ptr to media structure associated with bearer
......@@ -133,7 +131,6 @@ struct tipc_bearer {
u32 mtu; /* initalized by media */
struct tipc_media_addr addr; /* initalized by media */
spinlock_t lock;
struct tipc_media *media;
struct tipc_media_addr bcast_addr;
u32 priority;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment