summaryrefslogtreecommitdiffstats
path: root/xlators/nfs
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-05-31 22:43:55 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-06-01 00:23:58 -0700
commit4f49c3d22599b4296e51da0d2684633904ec134e (patch)
tree3fbc013b4e33f6e7bf92844b3a8c2231e567f271 /xlators/nfs
parent91afbb094ce97fb8f8183227cd56410ad3746449 (diff)
mount3: Handle unmount for unknown volume names
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> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 961 (Unmount with invalid export crashes nfsx) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=961
Diffstat (limited to 'xlators/nfs')
-rw-r--r--xlators/nfs/server/src/mount3.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index d0b46147c..9b287cf90 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -516,14 +516,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)