Patchwork [BUG:961,4/6] mount3: Handle unmount for unknown volume names

login
register
Submitter Shehjar Tikoo
Date 2010-06-01 04:13:55
Message ID <1275365637-30417-4-git-send-email-shehjart@gluster.com>
Download mbox | patch
Permalink /patch/3357/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Shehjar Tikoo - 2010-06-01 04:13:55
From: Shehjar Tikoo <shehjart@gluster.com>

In case the nfs client sends an unmount request for a volume
that does not exist anymore.

Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
---
 xlators/nfs/server/src/mount3.c |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

Patch

diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index e1fffe9..3920775 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -513,14 +513,26 @@  __mnt3svc_umount (struct mount3_state *ms, char *dirpath, char *hostname)
         if (list_empty (&ms->mountlist))
                 return 0;
 
+        if (dirpath[0] == '/')
+                exname = dirpath+1;
+        else
+                exname = dirpath;
+
         list_for_each_entry (me, &ms->mountlist, mlist) {
-                if (dirpath[0] == '/')
-                        exname = dirpath+1;
-                else
-                        exname = dirpath;
-                if ((strcmp (me->exname, exname) == 0) &&
-                    (strcmp (me->hostname, hostname) == 0))
-                        break;
+               if ((strcmp (me->exname, exname) == 0) &&
+                    (strcmp (me->hostname, hostname) == 0)) {
+                       ret = 0;
+                       break;
+               }
+        }
+
+        /* Need this check here because at the end of the search me might still
+         * be pointing to the last entry, which may not be the one we're
+         * looking for.
+         */
+        if (ret == -1)  {/* Not found in list. */
+                gf_log (GF_MNT, GF_LOG_DEBUG, "Export not found");
+                goto ret;
         }
 
         if (!me)