Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278825
b: refs/heads/master
c: 36b77a5
h: refs/heads/master
i:
  278823: 9222a43
v: v3
  • Loading branch information
Glauber Costa authored and David S. Miller committed Dec 16, 2011
1 parent 70240c6 commit 738f8bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 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: cb9ffb76949cd7b17c8468f8bf10d0ff75d4cdd2
refs/heads/master: 36b77a52087a9fca4228c06e0730750f9b6468f0
28 changes: 14 additions & 14 deletions trunk/net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
#include <net/tcp.h>
#endif

static DEFINE_RWLOCK(proto_list_lock);
static DEFINE_MUTEX(proto_list_mutex);
static LIST_HEAD(proto_list);

#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
Expand All @@ -145,7 +145,7 @@ int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
struct proto *proto;
int ret = 0;

read_lock(&proto_list_lock);
mutex_lock(&proto_list_mutex);
list_for_each_entry(proto, &proto_list, node) {
if (proto->init_cgroup) {
ret = proto->init_cgroup(cgrp, ss);
Expand All @@ -154,25 +154,25 @@ int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
}
}

read_unlock(&proto_list_lock);
mutex_unlock(&proto_list_mutex);
return ret;
out:
list_for_each_entry_continue_reverse(proto, &proto_list, node)
if (proto->destroy_cgroup)
proto->destroy_cgroup(cgrp, ss);
read_unlock(&proto_list_lock);
mutex_unlock(&proto_list_mutex);
return ret;
}

void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss)
{
struct proto *proto;

read_lock(&proto_list_lock);
mutex_lock(&proto_list_mutex);
list_for_each_entry_reverse(proto, &proto_list, node)
if (proto->destroy_cgroup)
proto->destroy_cgroup(cgrp, ss);
read_unlock(&proto_list_lock);
mutex_unlock(&proto_list_mutex);
}
#endif

Expand Down Expand Up @@ -2479,10 +2479,10 @@ int proto_register(struct proto *prot, int alloc_slab)
}
}

write_lock(&proto_list_lock);
mutex_lock(&proto_list_mutex);
list_add(&prot->node, &proto_list);
assign_proto_idx(prot);
write_unlock(&proto_list_lock);
mutex_unlock(&proto_list_mutex);
return 0;

out_free_timewait_sock_slab_name:
Expand All @@ -2505,10 +2505,10 @@ EXPORT_SYMBOL(proto_register);

void proto_unregister(struct proto *prot)
{
write_lock(&proto_list_lock);
mutex_lock(&proto_list_mutex);
release_proto_idx(prot);
list_del(&prot->node);
write_unlock(&proto_list_lock);
mutex_unlock(&proto_list_mutex);

if (prot->slab != NULL) {
kmem_cache_destroy(prot->slab);
Expand All @@ -2531,9 +2531,9 @@ EXPORT_SYMBOL(proto_unregister);

#ifdef CONFIG_PROC_FS
static void *proto_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(proto_list_lock)
__acquires(proto_list_mutex)
{
read_lock(&proto_list_lock);
mutex_lock(&proto_list_mutex);
return seq_list_start_head(&proto_list, *pos);
}

Expand All @@ -2543,9 +2543,9 @@ static void *proto_seq_next(struct seq_file *seq, void *v, loff_t *pos)
}

static void proto_seq_stop(struct seq_file *seq, void *v)
__releases(proto_list_lock)
__releases(proto_list_mutex)
{
read_unlock(&proto_list_lock);
mutex_unlock(&proto_list_mutex);
}

static char proto_method_implemented(const void *method)
Expand Down

0 comments on commit 738f8bf

Please sign in to comment.