summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/compat.h
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2014-09-21 13:57:47 +0200
committerVijay Bellur <vbellur@redhat.com>2014-10-03 07:57:47 -0700
commit473c34f895c49bf2bd327ece586d3613cd86c068 (patch)
tree0facfd50720f62b298530a73bc0b55ffc5823ee8 /libglusterfs/src/compat.h
parentbaa6f0ad759af024e4731a0f3889fe857ae2f1bf (diff)
Do not hardcode umount(8) path, emulate lazy umount
1) Use a system-dependent macro for umount(8) location instead of relying on $PATH to find it, for security and portability sake. 2) Introduce gf_umount_lazy() to replace umount -l (-l for lazy) invocations, which is only supported on Linux; On Linux behavior in unchanged. On other systems, we fork an external process (umountd) that will take care of periodically attempt to unmount, and optionally rmdir. BUG: 1129939 Change-Id: Ia91167c0652f8ddab85136324b08f87c5ac1e51d Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/8649 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Csaba Henk <csaba@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs/src/compat.h')
-rw-r--r--libglusterfs/src/compat.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libglusterfs/src/compat.h b/libglusterfs/src/compat.h
index 5920fce992b..20d15c44e70 100644
--- a/libglusterfs/src/compat.h
+++ b/libglusterfs/src/compat.h
@@ -40,6 +40,10 @@
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
+
+#ifndef _PATH_UMOUNT
+#define _PATH_UMOUNT "/bin/umount"
+#endif
#endif /* GF_LINUX_HOST_OS */
#ifdef HAVE_XATTR_H
@@ -161,6 +165,9 @@ enum {
#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
+#ifndef _PATH_UMOUNT
+ #define _PATH_UMOUNT "/sbin/umount"
+#endif
#endif /* GF_BSD_HOST_OS */
#ifdef GF_DARWIN_HOST_OS
@@ -239,6 +246,9 @@ int32_t gf_darwin_compat_listxattr (int len, dict_t *dict, int size);
int32_t gf_darwin_compat_getxattr (const char *key, dict_t *dict);
int32_t gf_darwin_compat_setxattr (dict_t *dict);
+#ifndef _PATH_UMOUNT
+ #define _PATH_UMOUNT "/sbin/umount"
+#endif
#endif /* GF_DARWIN_HOST_OS */
#ifdef GF_SOLARIS_HOST_OS
@@ -318,6 +328,9 @@ enum {
#ifndef _PATH_MOUNTED
#define _PATH_MOUNTED "/etc/mtab"
#endif
+#ifndef _PATH_UMOUNT
+ #define _PATH_UMOUNT "/sbin/umount"
+#endif
#ifndef O_ASYNC
#ifdef FASYNC
@@ -464,4 +477,6 @@ int gf_mkostemp (char *tmpl, int suffixlen, int flags);
#pragma GCC poison system popen
#endif
+int gf_umount_lazy(char *xlname, char *path, int rmdir);
+
#endif /* __COMPAT_H__ */