diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2014-10-30 09:50:41 +0100 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-11-16 22:57:49 -0800 |
commit | 4d8917360ed3176a22ec218b9c1f15ee444ad11d (patch) | |
tree | 629249e9bce3f397396511ed1c6e41f638ab9acc /contrib/umountd | |
parent | 25aa365c29300e9c3e6db301f8d5bd5fe2329128 (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
Backport of: http://review.gluster.org/8991
BUG: 1138897
Change-Id: I39941577021c0b39f545f9777fe75cd39637427b
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/9006
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.c | 16 |
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); |