Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3b71535f357a2e5d013a44a06b0c26a6a8d8fb5b
Commit:     3b71535f357a2e5d013a44a06b0c26a6a8d8fb5b
Parent:     1536cc0d55a2820b71daf912060fe43ec15630c2
Author:     Denis V. Lunev <[EMAIL PROTECTED]>
AuthorDate: Wed Oct 10 21:13:32 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 21:13:32 2007 -0700

    [NET]: Make netlink processing routines semi-synchronious (inspired by 
rtnl) v2
    
    The code in netfilter/nfnetlink.c and in ./net/netlink/genetlink.c looks
    like outdated copy/paste from rtnetlink.c. Push them into sync with the
    original.
    
    Changes from v1:
    - deleted comment in nfnetlink_rcv_msg by request of Patrick McHardy
    
    Signed-off-by: Denis V. Lunev <[EMAIL PROTECTED]>
    Acked-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/netfilter/nfnetlink.c |   25 +++++--------------------
 net/netlink/genetlink.c   |   15 +++------------
 2 files changed, 8 insertions(+), 32 deletions(-)

diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index cb41990..99775af 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -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)
@@ -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);
@@ -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);
 }
 
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 07ef5d2..3f1104d 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -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
@@ -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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to