From 886eb63fc729d3effea292ef92e02168898d8205 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Tue, 28 Oct 2014 18:27:20 +0100 Subject: 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 Reviewed-on: http://review.gluster.org/8991 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- contrib/umountd/umountd.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'contrib') diff --git a/contrib/umountd/umountd.c b/contrib/umountd/umountd.c index 42f867d1983..0d2c6f20b60 100644 --- a/contrib/umountd/umountd.c +++ b/contrib/umountd/umountd.c @@ -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); -- cgit