Patchwork [BUG:1666] mnt3: Fix UMNTALL crash with Windows clients

login
register
Submitter Shehjar Tikoo
Date 2010-11-03 06:04:10
Message ID <1288764250-6098-1-git-send-email-shehjart@gluster.com>
Download mbox | patch
Permalink /patch/5628/
State Accepted
Headers show

Comments

Shehjar Tikoo - 2010-11-03 06:04:10
From: Shehjar Tikoo <shehjart@gluster.com>


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

Patch

diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index fdd05a2..47158dc 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -1078,11 +1078,15 @@  int
 __mnt3svc_umountall (struct mount3_state *ms)
 {
         struct mountentry       *me = NULL;
+        struct mountentry       *tmp = NULL;
 
         if (!ms)
                 return -1;
 
-        list_for_each_entry (me, &ms->mountlist, mlist) {
+        if (list_empty (&ms->mountlist))
+                return 0;
+
+        list_for_each_entry_safe (me, tmp, &ms->mountlist, mlist) {
                 list_del (&me->mlist);
                 GF_FREE (me);
         }
@@ -1111,18 +1115,17 @@  mnt3svc_umountall (struct mount3_state *ms)
 int
 mnt3svc_umntall (rpcsvc_request_t *req)
 {
-        int                     ret = -1;
+        int                     ret = RPCSVC_ACTOR_ERROR;
         struct mount3_state     *ms = NULL;
         mountstat3              mstat = MNT3_OK;
 
         if (!req)
-                return -1;
+                return ret;
 
         ms = (struct mount3_state *)nfs_rpcsvc_request_program_private (req);
         if (!ms) {
                 gf_log (GF_MNT, GF_LOG_ERROR, "Mount state not present");
                 nfs_rpcsvc_request_seterr (req, SYSTEM_ERR);
-                ret = -1;
                 goto rpcerr;
         }
 
@@ -1130,6 +1133,7 @@  mnt3svc_umntall (rpcsvc_request_t *req)
         mnt3svc_submit_reply (req, &mstat,
                               (mnt3_serializer)xdr_serialize_mountstat3);
 
+        ret = RPCSVC_ACTOR_SUCCESS;
 rpcerr:
         return ret;
 }