LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

[RFC PATCH net-next 1/4] ipvs: move ip_vs_trash_put_dest into its own fu

To: <wensong@xxxxxxxxxxxx>, <horms@xxxxxxxxxxxx>, <ja@xxxxxx>
Subject: [RFC PATCH net-next 1/4] ipvs: move ip_vs_trash_put_dest into its own function
Cc: <lvs-devel@xxxxxxxxxxxxxxx>, <kernel-team@xxxxxx>, Alex Gartrell <agartrell@xxxxxx>
From: Alex Gartrell <agartrell@xxxxxx>
Date: Mon, 23 Feb 2015 21:07:39 -0800
This corresponds better with ip_vs_trash_get_dest and we'll need to all it
directly if the scheduler add dest fails.

Signed-off-by: Alex Gartrell <agartrell@xxxxxx>
---
 net/netfilter/ipvs/ip_vs_ctl.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index e557590..11da053 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -696,6 +696,24 @@ out:
        return dest;
 }
 
+static inline void ip_vs_trash_put_dest(struct netns_ipvs *ipvs,
+                                       struct ip_vs_dest *dest,
+                                       bool cleanup)
+{
+       spin_lock_bh(&ipvs->dest_trash_lock);
+       IP_VS_DBG_BUF(3, "Moving dest %s:%u into trash, dest->refcnt=%d\n",
+                     IP_VS_DBG_ADDR(dest->af, &dest->addr), ntohs(dest->port),
+                     atomic_read(&dest->refcnt));
+       if (list_empty(&ipvs->dest_trash) && !cleanup)
+               mod_timer(&ipvs->dest_trash_timer,
+                         jiffies + (IP_VS_DEST_TRASH_PERIOD >> 1));
+       /* dest lives in trash without reference */
+       list_add(&dest->t_list, &ipvs->dest_trash);
+       dest->idle_start = 0;
+       spin_unlock_bh(&ipvs->dest_trash_lock);
+       ip_vs_dest_put(dest);
+}
+
 static void ip_vs_dest_free(struct ip_vs_dest *dest)
 {
        struct ip_vs_service *svc = rcu_dereference_protected(dest->svc, 1);
@@ -1032,18 +1050,7 @@ static void __ip_vs_del_dest(struct net *net, struct 
ip_vs_dest *dest,
         */
        ip_vs_rs_unhash(dest);
 
-       spin_lock_bh(&ipvs->dest_trash_lock);
-       IP_VS_DBG_BUF(3, "Moving dest %s:%u into trash, dest->refcnt=%d\n",
-                     IP_VS_DBG_ADDR(dest->af, &dest->addr), ntohs(dest->port),
-                     atomic_read(&dest->refcnt));
-       if (list_empty(&ipvs->dest_trash) && !cleanup)
-               mod_timer(&ipvs->dest_trash_timer,
-                         jiffies + (IP_VS_DEST_TRASH_PERIOD >> 1));
-       /* dest lives in trash without reference */
-       list_add(&dest->t_list, &ipvs->dest_trash);
-       dest->idle_start = 0;
-       spin_unlock_bh(&ipvs->dest_trash_lock);
-       ip_vs_dest_put(dest);
+       ip_vs_trash_put_dest(ipvs, dest, cleanup);
 }
 
 
-- 
Alex Gartrell <agartrell@xxxxxx>

--
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>