[PATCH] knfsd: Move makesock failed warning into make_socks.
authorNeilBrown <neilb@suse.de>
Mon, 2 Oct 2006 09:17:52 +0000 (02:17 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 2 Oct 2006 14:57:18 +0000 (07:57 -0700)
Thus it is printed for any path that leads to failure (make_socks is called
from two places).

Cc: "J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/lockd/svc.c

index f0791cff45ac6cfc0dbe6a47e21ee70edbac9bdc..448768b529130fe111553e713197070d13b3c69a 100644 (file)
@@ -227,15 +227,19 @@ static int make_socks(struct svc_serv *serv, int proto)
         * If nlm_udpport or nlm_tcpport were set as module
         * options, make those sockets unconditionally
         */
+       static int              warned;
        int err = 0;
        if (proto == IPPROTO_UDP || nlm_udpport)
                if (!find_socket(serv, IPPROTO_UDP))
                        err = svc_makesock(serv, IPPROTO_UDP, nlm_udpport);
-       if (err)
-               return err;
-       if (proto == IPPROTO_TCP || nlm_tcpport)
+       if (err == 0 && (proto == IPPROTO_TCP || nlm_tcpport))
                if (!find_socket(serv, IPPROTO_TCP))
                        err= svc_makesock(serv, IPPROTO_TCP, nlm_tcpport);
+       if (!err)
+               warned = 0;
+       else if (warned++ == 0)
+               printk(KERN_WARNING
+                      "lockd_up: makesock failed, error=%d\n", err);
        return err;
 }
 
@@ -245,7 +249,6 @@ static int make_socks(struct svc_serv *serv, int proto)
 int
 lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */
 {
-       static int              warned;
        struct svc_serv *       serv;
        int                     error = 0;
 
@@ -278,13 +281,8 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */
                goto out;
        }
 
-       if ((error = make_socks(serv, proto)) < 0) {
-               if (warned++ == 0) 
-                       printk(KERN_WARNING
-                               "lockd_up: makesock failed, error=%d\n", error);
+       if ((error = make_socks(serv, proto)) < 0)
                goto destroy_and_out;
-       } 
-       warned = 0;
 
        /*
         * Create the kernel thread and wait for it to start.