Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67063
b: refs/heads/master
c: 3b71535
h: refs/heads/master
i:
  67061: fcacc9f
  67059: e3c92d9
  67055: 7f17a27
v: v3
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Oct 11, 2007
1 parent b3b36fc commit 23dcd25
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 33 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: 1536cc0d55a2820b71daf912060fe43ec15630c2
refs/heads/master: 3b71535f357a2e5d013a44a06b0c26a6a8d8fb5b
25 changes: 5 additions & 20 deletions trunk/net/netfilter/nfnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,14 @@ static struct sock *nfnl = NULL;
static const struct nfnetlink_subsystem *subsys_table[NFNL_SUBSYS_COUNT];
static DEFINE_MUTEX(nfnl_mutex);

static void nfnl_lock(void)
static inline void nfnl_lock(void)
{
mutex_lock(&nfnl_mutex);
}

static int nfnl_trylock(void)
{
return !mutex_trylock(&nfnl_mutex);
}

static void __nfnl_unlock(void)
{
mutex_unlock(&nfnl_mutex);
}

static void nfnl_unlock(void)
static inline void nfnl_unlock(void)
{
mutex_unlock(&nfnl_mutex);
if (nfnl->sk_receive_queue.qlen)
nfnl->sk_data_ready(nfnl, 0);
}

int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n)
Expand Down Expand Up @@ -147,9 +135,7 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
ss = nfnetlink_get_subsys(type);
if (!ss) {
#ifdef CONFIG_KMOD
/* don't call nfnl_unlock, since it would reenter
* with further packet processing */
__nfnl_unlock();
nfnl_unlock();
request_module("nfnetlink-subsys-%d", NFNL_SUBSYS_ID(type));
nfnl_lock();
ss = nfnetlink_get_subsys(type);
Expand Down Expand Up @@ -188,10 +174,9 @@ static void nfnetlink_rcv(struct sock *sk, int len)
unsigned int qlen = 0;

do {
if (nfnl_trylock())
return;
nfnl_lock();
qlen = netlink_run_queue(sk, qlen, nfnetlink_rcv_msg);
__nfnl_unlock();
nfnl_unlock();
} while (qlen);
}

Expand Down
15 changes: 3 additions & 12 deletions trunk/net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,14 @@ struct sock *genl_sock = NULL;

static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */

static void genl_lock(void)
static inline void genl_lock(void)
{
mutex_lock(&genl_mutex);
}

static int genl_trylock(void)
{
return !mutex_trylock(&genl_mutex);
}

static void genl_unlock(void)
static inline void genl_unlock(void)
{
mutex_unlock(&genl_mutex);

if (genl_sock && genl_sock->sk_receive_queue.qlen)
genl_sock->sk_data_ready(genl_sock, 0);
}

#define GENL_FAM_TAB_SIZE 16
Expand Down Expand Up @@ -483,8 +475,7 @@ static void genl_rcv(struct sock *sk, int len)
unsigned int qlen = 0;

do {
if (genl_trylock())
return;
genl_lock();
qlen = netlink_run_queue(sk, qlen, genl_rcv_msg);
genl_unlock();
} while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen);
Expand Down

0 comments on commit 23dcd25

Please sign in to comment.