summaryrefslogtreecommitdiffstats
path: root/contrib/umountd
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2014-10-28 18:27:20 +0100
committerVijay Bellur <vbellur@redhat.com>2014-10-30 01:35:46 -0700
commit886eb63fc729d3effea292ef92e02168898d8205 (patch)
tree0b21c88560d8c3dea1b369a2a7f65ff6889e7026 /contrib/umountd
parentd2da726fe76e61f4c499421d8d2bd588ca41b770 (diff)
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>
Diffstat (limited to 'contrib/umountd')
-rw-r--r--contrib/umountd/umountd.c16
1 files changed, 11 insertions, 5 deletions
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);