Patchwork [BUG:1783] glusterd: de-register nfs rpcs when it is stopped

login
register
Submitter Pranith K
Date 2010-12-17 08:23:15
Message ID <20101217082315.GA13021@dev.gluster.com>
Download mbox | patch
Permalink /patch/5911/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Pranith K - 2010-12-17 08:23:15
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
---
 xlators/mgmt/glusterd/src/glusterd-utils.c |   32 +++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)
Shehjar Tikoo - 2010-12-20 05:34:22
Reviewed ok, only if you've tested it to fix the sequence of commands in 
the bug report.


Pranith Kumar K wrote:
> 
> Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
> ---
>  xlators/mgmt/glusterd/src/glusterd-utils.c |   32 +++++++++++++++++++++++++++-
>  1 files changed, 31 insertions(+), 1 deletions(-)
> 
> diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
> index e0dc706..b399ad1 100644
> --- a/xlators/mgmt/glusterd/src/glusterd-utils.c
> +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
> @@ -51,11 +51,18 @@
>  #include <net/if.h>
>  #include <sys/ioctl.h>
>  #include <sys/socket.h>
> +#include <rpc/pmap_clnt.h>
>  
>  #ifdef GF_SOLARIS_HOST_OS
>  #include <sys/sockio.h>
>  #endif
>  
> +#define MOUNT_PROGRAM 100005
> +#define NFS_PROGRAM 100003
> +#define NFSV3_VERSION 3
> +#define MOUNTV3_VERSION 3
> +#define MOUNTV1_VERSION 1
> +
>  static glusterd_lock_t lock;
>  
>  static int32_t
> @@ -1760,6 +1767,26 @@ out:
>          return ret;
>  }
>  
> +void
> +glusterd_nfs_pmap_deregister ()
> +{
> +        if (pmap_unset (MOUNT_PROGRAM, MOUNTV3_VERSION))
> +                gf_log ("", GF_LOG_NORMAL, "De-registered MOUNTV3 successfully");
> +        else
> +                gf_log ("", GF_LOG_ERROR, "De-register MOUNTV3 is unsuccessful");
> +
> +        if (pmap_unset (MOUNT_PROGRAM, MOUNTV1_VERSION))
> +                gf_log ("", GF_LOG_NORMAL, "De-registered MOUNTV1 successfully");
> +        else
> +                gf_log ("", GF_LOG_ERROR, "De-register MOUNTV1 is unsuccessful");
> +
> +        if (pmap_unset (NFS_PROGRAM, NFSV3_VERSION))
> +                gf_log ("", GF_LOG_NORMAL, "De-registered NFSV3 successfully");
> +        else
> +                gf_log ("", GF_LOG_ERROR, "De-register NFSV3 is unsuccessful");
> +
> +}
> +
>  int32_t
>  glusterd_nfs_server_stop ()
>  {
> @@ -1776,7 +1803,10 @@ glusterd_nfs_server_stop ()
>          GLUSTERD_GET_NFS_DIR(path, priv);
>          GLUSTERD_GET_NFS_PIDFILE(pidfile);
>  
> -        return glusterd_service_stop ("nfsd", pidfile, SIGKILL, _gf_true);
> +        glusterd_service_stop ("nfsd", pidfile, SIGKILL, _gf_true);
> +        glusterd_nfs_pmap_deregister ();
> +
> +        return 0;
>  }
>  
>  int
Pranith K - 2010-12-20 07:14:13
Yes I tested it. It worked fine with this fix. Could you mark the patch as reviewd in patchwork.

Pranith.

----- Original Message -----
From: "Shehjar Tikoo" <shehjart@gluster.com>
To: "Pranith Kumar K" <pranithk@gluster.com>
Cc: glusterfs@dev.gluster.com, avati@gluster.com
Sent: Monday, December 20, 2010 11:04:22 AM
Subject: Re: [PATCH BUG:1783] glusterd: de-register nfs rpcs when it is stopped

Reviewed ok, only if you've tested it to fix the sequence of commands in 
the bug report.


Pranith Kumar K wrote:
> 
> Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
> ---
>  xlators/mgmt/glusterd/src/glusterd-utils.c |   32 +++++++++++++++++++++++++++-
>  1 files changed, 31 insertions(+), 1 deletions(-)
> 
> diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
> index e0dc706..b399ad1 100644
> --- a/xlators/mgmt/glusterd/src/glusterd-utils.c
> +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
> @@ -51,11 +51,18 @@
>  #include <net/if.h>
>  #include <sys/ioctl.h>
>  #include <sys/socket.h>
> +#include <rpc/pmap_clnt.h>
>  
>  #ifdef GF_SOLARIS_HOST_OS
>  #include <sys/sockio.h>
>  #endif
>  
> +#define MOUNT_PROGRAM 100005
> +#define NFS_PROGRAM 100003
> +#define NFSV3_VERSION 3
> +#define MOUNTV3_VERSION 3
> +#define MOUNTV1_VERSION 1
> +
>  static glusterd_lock_t lock;
>  
>  static int32_t
> @@ -1760,6 +1767,26 @@ out:
>          return ret;
>  }
>  
> +void
> +glusterd_nfs_pmap_deregister ()
> +{
> +        if (pmap_unset (MOUNT_PROGRAM, MOUNTV3_VERSION))
> +                gf_log ("", GF_LOG_NORMAL, "De-registered MOUNTV3 successfully");
> +        else
> +                gf_log ("", GF_LOG_ERROR, "De-register MOUNTV3 is unsuccessful");
> +
> +        if (pmap_unset (MOUNT_PROGRAM, MOUNTV1_VERSION))
> +                gf_log ("", GF_LOG_NORMAL, "De-registered MOUNTV1 successfully");
> +        else
> +                gf_log ("", GF_LOG_ERROR, "De-register MOUNTV1 is unsuccessful");
> +
> +        if (pmap_unset (NFS_PROGRAM, NFSV3_VERSION))
> +                gf_log ("", GF_LOG_NORMAL, "De-registered NFSV3 successfully");
> +        else
> +                gf_log ("", GF_LOG_ERROR, "De-register NFSV3 is unsuccessful");
> +
> +}
> +
>  int32_t
>  glusterd_nfs_server_stop ()
>  {
> @@ -1776,7 +1803,10 @@ glusterd_nfs_server_stop ()
>          GLUSTERD_GET_NFS_DIR(path, priv);
>          GLUSTERD_GET_NFS_PIDFILE(pidfile);
>  
> -        return glusterd_service_stop ("nfsd", pidfile, SIGKILL, _gf_true);
> +        glusterd_service_stop ("nfsd", pidfile, SIGKILL, _gf_true);
> +        glusterd_nfs_pmap_deregister ();
> +
> +        return 0;
>  }
>  
>  int

Patch

diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index e0dc706..b399ad1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -51,11 +51,18 @@ 
 #include <net/if.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
+#include <rpc/pmap_clnt.h>
 
 #ifdef GF_SOLARIS_HOST_OS
 #include <sys/sockio.h>
 #endif
 
+#define MOUNT_PROGRAM 100005
+#define NFS_PROGRAM 100003
+#define NFSV3_VERSION 3
+#define MOUNTV3_VERSION 3
+#define MOUNTV1_VERSION 1
+
 static glusterd_lock_t lock;
 
 static int32_t
@@ -1760,6 +1767,26 @@  out:
         return ret;
 }
 
+void
+glusterd_nfs_pmap_deregister ()
+{
+        if (pmap_unset (MOUNT_PROGRAM, MOUNTV3_VERSION))
+                gf_log ("", GF_LOG_NORMAL, "De-registered MOUNTV3 successfully");
+        else
+                gf_log ("", GF_LOG_ERROR, "De-register MOUNTV3 is unsuccessful");
+
+        if (pmap_unset (MOUNT_PROGRAM, MOUNTV1_VERSION))
+                gf_log ("", GF_LOG_NORMAL, "De-registered MOUNTV1 successfully");
+        else
+                gf_log ("", GF_LOG_ERROR, "De-register MOUNTV1 is unsuccessful");
+
+        if (pmap_unset (NFS_PROGRAM, NFSV3_VERSION))
+                gf_log ("", GF_LOG_NORMAL, "De-registered NFSV3 successfully");
+        else
+                gf_log ("", GF_LOG_ERROR, "De-register NFSV3 is unsuccessful");
+
+}
+
 int32_t
 glusterd_nfs_server_stop ()
 {
@@ -1776,7 +1803,10 @@  glusterd_nfs_server_stop ()
         GLUSTERD_GET_NFS_DIR(path, priv);
         GLUSTERD_GET_NFS_PIDFILE(pidfile);
 
-        return glusterd_service_stop ("nfsd", pidfile, SIGKILL, _gf_true);
+        glusterd_service_stop ("nfsd", pidfile, SIGKILL, _gf_true);
+        glusterd_nfs_pmap_deregister ();
+
+        return 0;
 }
 
 int