Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215200
b: refs/heads/master
c: ccc901e
h: refs/heads/master
v: v3
  • Loading branch information
Allan Stephens authored and David S. Miller committed Oct 18, 2010
1 parent c91c973 commit b493d26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 724829b3ad8e8aeb0aec46de383d35bfa1ad3875
refs/heads/master: ccc901ee58cfb090a31216a6eda0f1e9dfc572fa
38 changes: 11 additions & 27 deletions trunk/net/tipc/bearer.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,6 @@ static struct bearer *bearer_find(const char *name)
struct bearer *b_ptr;
u32 i;

if (tipc_mode != TIPC_NET_MODE)
return NULL;

for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
if (b_ptr->active && (!strcmp(b_ptr->publ.name, name)))
return b_ptr;
Expand Down Expand Up @@ -630,30 +627,17 @@ int tipc_block_bearer(const char *name)
* Note: This routine assumes caller holds tipc_net_lock.
*/

static int bearer_disable(const char *name)
static int bearer_disable(struct bearer *b_ptr)
{
struct bearer *b_ptr;
struct link *l_ptr;
struct link *temp_l_ptr;

b_ptr = bearer_find(name);
if (!b_ptr) {
warn("Attempt to disable unknown bearer <%s>\n", name);
return -EINVAL;
}

info("Disabling bearer <%s>\n", name);
info("Disabling bearer <%s>\n", b_ptr->publ.name);
tipc_disc_stop_link_req(b_ptr->link_req);
spin_lock_bh(&b_ptr->publ.lock);
b_ptr->link_req = NULL;
b_ptr->publ.blocked = 1;
if (b_ptr->media->disable_bearer) {
spin_unlock_bh(&b_ptr->publ.lock);
write_unlock_bh(&tipc_net_lock);
b_ptr->media->disable_bearer(&b_ptr->publ);
write_lock_bh(&tipc_net_lock);
spin_lock_bh(&b_ptr->publ.lock);
}
b_ptr->media->disable_bearer(&b_ptr->publ);
list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
tipc_link_delete(l_ptr);
}
Expand All @@ -664,10 +648,16 @@ static int bearer_disable(const char *name)

int tipc_disable_bearer(const char *name)
{
struct bearer *b_ptr;
int res;

write_lock_bh(&tipc_net_lock);
res = bearer_disable(name);
b_ptr = bearer_find(name);
if (b_ptr == NULL) {
warn("Attempt to disable unknown bearer <%s>\n", name);
res = -EINVAL;
} else
res = bearer_disable(b_ptr);
write_unlock_bh(&tipc_net_lock);
return res;
}
Expand All @@ -680,13 +670,7 @@ void tipc_bearer_stop(void)

for (i = 0; i < MAX_BEARERS; i++) {
if (tipc_bearers[i].active)
tipc_bearers[i].publ.blocked = 1;
}
for (i = 0; i < MAX_BEARERS; i++) {
if (tipc_bearers[i].active)
bearer_disable(tipc_bearers[i].publ.name);
bearer_disable(&tipc_bearers[i]);
}
media_count = 0;
}


0 comments on commit b493d26

Please sign in to comment.