Lazy umount emulation: deal with stopped volumes

On non Linux systems, lazy umount is emulated using contrib/umountd.
It first check that the path given to unmount exists, but it should
not give up on ENOTCONN as it is what happens when a volume is mounted
but stopped.

This lets NetBSD pass tests/bugs/bug-1049323.t

BUG: 1129939
Change-Id: I3451362453607a0fd82b095a9e5aa6f63bfe869a
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8991
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
Emmanuel Dreyfus 2014-10-28 18:27:20 +01:00 committed by Vijay Bellur
parent d2da726fe7
commit 886eb63fc7

View File

@ -49,14 +49,20 @@ sanity_check (char *path, dev_t *devp)
if (path == NULL)
usage ();
if (stat (path, &st) != 0) {
gf_log ("umountd", GF_LOG_ERROR,
"Cannot access %s\n", path, strerror (errno));
goto out;
if ((ret = stat (path, &st)) != 0) {
switch (errno) {
case ENOTCONN:
/* volume is stopped */
break;
default:
gf_log ("umountd", GF_LOG_ERROR,
"Cannot access %s\n", path, strerror (errno));
goto out;
}
}
/* If dev was not specified, get it from path */
if (*devp == -1)
if (*devp == -1 && ret == 0)
*devp = st.st_dev;
strncpy (pathtmp, path, PATH_MAX);