LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [*v3 PATCH 02/22] IPVS: netns to services part 1

To: hans@xxxxxxxxxxxxxxx
Subject: Re: [*v3 PATCH 02/22] IPVS: netns to services part 1
Cc: horms@xxxxxxxxxxxx, ja@xxxxxx, daniel.lezcano@xxxxxxx, wensong@xxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, Hans Schillstrom <hans.schillstrom@xxxxxxxxxxxx>
From: Jan Engelhardt <jengelh@xxxxxxxxxx>
Date: Sat, 1 Jan 2011 15:57:29 +0100 (CET)
On Thursday 2010-12-30 11:50, hans@xxxxxxxxxxxxxxx wrote:
>+/*
>+ * Get net ptr from skb in traffic cases
>+ * use skb_sknet when call is from userland (ioctl or netlink)
>+ */
>+static inline struct net *skb_net(struct sk_buff *skb) {
>+#ifdef CONFIG_NET_NS
>+#ifdef CONFIG_IP_VS_DEBUG
>+      /*
>+       * This is used for debug only.
>+       * Start with the most likely hit
>+       * End with BUG
>+       */
>+      if (likely(skb->dev && skb->dev->nd_net))
>+              return dev_net(skb->dev);
>+      if (skb_dst(skb)->dev)
>+              return dev_net(skb_dst(skb)->dev);
>+      WARN(skb->sk,"Maybe skb_sknet should be used instead in %s() line:%d\n",
>+                    __func__, __LINE__);
>+      if (likely(skb->sk && skb->sk->sk_net))
>+              return sock_net(skb->sk);
>+      pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
>+              __func__, __LINE__);
>+      BUG();
>+#else
>+      return dev_net(skb->dev ? : skb_dst(skb)->dev);
>+#endif
>+#else
>+      return &init_net;
>+#endif
>+}

Whether NETNS is disabled or not, dev_net(skb->dev) can be used in either case,
so the extra return &init_net case is not really required AFAICS.

>@@ -3446,43 +3471,48 @@ static struct pernet_operations ipvs_control_ops = {
>-      smp_wmb();
>+
>+      smp_wmb();      /* Do wee really need it now ? */

not "whee" :)
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>