OpenVZ Forum


Home » Mailing lists » Devel » [PATCH][IPVS] Relax the module get/put in ip_vs_app.c
[PATCH][IPVS] Relax the module get/put in ip_vs_app.c [message #23507] Mon, 19 November 2007 09:58 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
Both try_module_get/module_put already handle the module == NULL
case, so no need in manual checking.

This patch fits both net-2.6 and net-2.6.25.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c
index 664cb8e..535abe0 100644
--- a/net/ipv4/ipvs/ip_vs_app.c
+++ b/net/ipv4/ipvs/ip_vs_app.c
@@ -51,18 +51,13 @@ static DEFINE_MUTEX(__ip_vs_app_mutex);
  */
 static inline int ip_vs_app_get(struct ip_vs_app *app)
 {
-	/* test and get the module atomically */
-	if (app->module)
-		return try_module_get(app->module);
-	else
-		return 1;
+	return try_module_get(app->module);
 }
 
 
 static inline void ip_vs_app_put(struct ip_vs_app *app)
 {
-	if (app->module)
-		module_put(app->module);
+	module_put(app->module);
 }
Re: [PATCH][IPVS] Relax the module get/put in ip_vs_app.c [message #23528 is a reply to message #23507] Tue, 20 November 2007 02:28 Go to previous messageGo to next message
Simon Horman is currently offline  Simon Horman
Messages: 8
Registered: April 2007
Junior Member
On Mon, Nov 19, 2007 at 12:58:14PM +0300, Pavel Emelyanov wrote:
> Both try_module_get/module_put already handle the module == NULL
> case, so no need in manual checking.
> 
> This patch fits both net-2.6 and net-2.6.25.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Thanks, that looks fine to me.

Acked-by: Simon Horman <horms@verge.net.au>
Re: [PATCH][IPVS] Relax the module get/put in ip_vs_app.c [message #23544 is a reply to message #23528] Tue, 20 November 2007 06:53 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Simon Horman <horms@verge.net.au>
Date: Tue, 20 Nov 2007 11:28:18 +0900

> On Mon, Nov 19, 2007 at 12:58:14PM +0300, Pavel Emelyanov wrote:
> > Both try_module_get/module_put already handle the module == NULL
> > case, so no need in manual checking.
> > 
> > This patch fits both net-2.6 and net-2.6.25.
> > 
> > Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> 
> Thanks, that looks fine to me.
> 
> Acked-by: Simon Horman <horms@verge.net.au>

Me too, applied to net-2.6.25, thanks Pavel.
Previous Topic: [PATCH][PKTGEN] Fix double unlock of xfrm_state->lock
Next Topic: [PATCH][net-2.6.25][NETNS] make netns cleanup to run in a separate workqueue
Goto Forum:
  


Current Time: Tue Jun 25 04:50:26 GMT 2024

Total time taken to generate the page: 0.03276 seconds