]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
tipc: replace config_mutex lock with RTNL lock
authorYing Xue <ying.xue@windriver.com>
Mon, 21 Apr 2014 02:55:42 +0000 (10:55 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Apr 2014 01:17:52 +0000 (21:17 -0400)
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 <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Tested-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/config.c
net/tipc/core.h

index 4b981c053823e90cc31963277aedd8c3682bc1a0..251f5a2028e4b16fb85266d268336640d5da0399 100644 (file)
@@ -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 */
@@ -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;
@@ -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;
 }
index 8985bbcb942bdb3d6ef839c3249d4e547c2f75ce..36cbf158845f7fd1421dd6812ffecb992d2b86bb 100644 (file)
@@ -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"