Skip to content

Commit

Permalink
tipc: replace config_mutex lock with RTNL lock
Browse files Browse the repository at this point in the history
There have two paths where we can configure or change bearer status:
one is that bearer is configured from user space with tipc-config
tool; another one is that bearer is changed by notification events
from its attached interface. On the first path, one dedicated
config_mutex lock is guarded; on the latter path, RTNL lock has been
placed to serialize the process of dealing with interface events.
So, if RTNL lock is also used to protect the first path, this will
not only extremely help us simplify current locking policy, but also
config_mutex lock can be deleted as well.

Signed-off-by: Ying Xue <[email protected]>
Reviewed-by: Jon Maloy <[email protected]>
Reviewed-by: Erik Hugne <[email protected]>
Tested-by: Erik Hugne <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ying-xue authored and davem330 committed Apr 23, 2014
1 parent 5a9d19a commit ef13a26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions net/tipc/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@

#define REPLY_TRUNCATED "<truncated>\n"

static DEFINE_MUTEX(config_mutex);

static const void *req_tlv_area; /* request message TLV area */
static int req_tlv_space; /* request message TLV area size */
static int rep_headroom; /* reply message headroom to use */
Expand Down Expand Up @@ -223,7 +221,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
{
struct sk_buff *rep_tlv_buf;

mutex_lock(&config_mutex);
rtnl_lock();

/* Save request and reply details in a well-known location */
req_tlv_area = request_area;
Expand Down Expand Up @@ -337,6 +335,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area

/* Return reply buffer */
exit:
mutex_unlock(&config_mutex);
rtnl_unlock();
return rep_tlv_buf;
}
2 changes: 1 addition & 1 deletion net/tipc/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>

#include <linux/rtnetlink.h>

#define TIPC_MOD_VER "2.0.0"

Expand Down

0 comments on commit ef13a26

Please sign in to comment.