From 4f49c3d22599b4296e51da0d2684633904ec134e Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Mon, 31 May 2010 22:43:55 +0000 Subject: 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 Signed-off-by: Anand V. Avati BUG: 961 (Unmount with invalid export crashes nfsx) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=961 --- xlators/nfs/server/src/mount3.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'xlators/nfs/server/src') diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c index d0b46147c25..9b287cf907e 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) -- cgit