diff options
author | Ying Xue <ying.xue@windriver.com> | 2013-06-17 10:54:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-17 18:53:01 -0400 |
commit | 28e5297281ab85d636aa814a9b65cfb99375d092 (patch) | |
tree | 3e346d9754e58bc805740d91009ef1d0de4b06a3 /net/tipc | |
parent | 3c5db8e4eca36e4f312b49bba99f4c1f6ce0563a (diff) |
tipc: convert config_lock from spinlock to mutex
As the configuration server is now running under process context,
it's unnecessary for us to have a spinlock serializing the TIPC
configuration process. Instead, we replace it with a mutex lock,
which gives us more freedom. For instance, we can now call
pre-emptable functions within the protected area.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/config.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c index 4887ae04f3a5..c301a9a592d8 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -42,7 +42,7 @@ | |||
42 | 42 | ||
43 | #define REPLY_TRUNCATED "<truncated>\n" | 43 | #define REPLY_TRUNCATED "<truncated>\n" |
44 | 44 | ||
45 | static DEFINE_SPINLOCK(config_lock); | 45 | static DEFINE_MUTEX(config_mutex); |
46 | static struct tipc_server cfgsrv; | 46 | static struct tipc_server cfgsrv; |
47 | 47 | ||
48 | static const void *req_tlv_area; /* request message TLV area */ | 48 | static const void *req_tlv_area; /* request message TLV area */ |
@@ -181,18 +181,7 @@ static struct sk_buff *cfg_set_own_addr(void) | |||
181 | if (tipc_own_addr) | 181 | if (tipc_own_addr) |
182 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED | 182 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
183 | " (cannot change node address once assigned)"); | 183 | " (cannot change node address once assigned)"); |
184 | |||
185 | /* | ||
186 | * Must temporarily release configuration spinlock while switching into | ||
187 | * networking mode as it calls tipc_eth_media_start(), which may sleep. | ||
188 | * Releasing the lock is harmless as other locally-issued configuration | ||
189 | * commands won't occur until this one completes, and remotely-issued | ||
190 | * configuration commands can't be received until a local configuration | ||
191 | * command to enable the first bearer is received and processed. | ||
192 | */ | ||
193 | spin_unlock_bh(&config_lock); | ||
194 | tipc_core_start_net(addr); | 184 | tipc_core_start_net(addr); |
195 | spin_lock_bh(&config_lock); | ||
196 | return tipc_cfg_reply_none(); | 185 | return tipc_cfg_reply_none(); |
197 | } | 186 | } |
198 | 187 | ||
@@ -248,7 +237,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area | |||
248 | { | 237 | { |
249 | struct sk_buff *rep_tlv_buf; | 238 | struct sk_buff *rep_tlv_buf; |
250 | 239 | ||
251 | spin_lock_bh(&config_lock); | 240 | mutex_lock(&config_mutex); |
252 | 241 | ||
253 | /* Save request and reply details in a well-known location */ | 242 | /* Save request and reply details in a well-known location */ |
254 | req_tlv_area = request_area; | 243 | req_tlv_area = request_area; |
@@ -377,7 +366,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area | |||
377 | 366 | ||
378 | /* Return reply buffer */ | 367 | /* Return reply buffer */ |
379 | exit: | 368 | exit: |
380 | spin_unlock_bh(&config_lock); | 369 | mutex_unlock(&config_mutex); |
381 | return rep_tlv_buf; | 370 | return rep_tlv_buf; |
382 | } | 371 | } |
383 | 372 | ||