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
This commit is contained in:
Shehjar Tikoo 2010-05-31 22:43:55 +00:00 committed by Anand V. Avati
parent 91afbb094c
commit 4f49c3d225

View File

@ -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)