summaryrefslogtreecommitdiff
path: root/net/glusterfs/files
diff options
context:
space:
mode:
Diffstat (limited to 'net/glusterfs/files')
-rw-r--r--net/glusterfs/files/patch-configure.ac14
-rw-r--r--net/glusterfs/files/patch-libglusterfs_src_Makefile.am5
-rw-r--r--net/glusterfs/files/patch-libglusterfs_src_common-utils.c31
-rw-r--r--net/glusterfs/files/patch-libglusterfs_src_glusterfs_syscall.h16
-rw-r--r--net/glusterfs/files/patch-libglusterfs_src_libglusterfs.sym11
-rw-r--r--net/glusterfs/files/patch-libglusterfs_src_syscall.c64
-rw-r--r--net/glusterfs/files/patch-mount_glusterfs.in4
-rw-r--r--net/glusterfs/files/patch-xlators_mgmt_glusterd_src_Makefile.am17
-rw-r--r--net/glusterfs/files/patch-xlators_mgmt_glusterd_src_glusterd-utils.c115
9 files changed, 259 insertions, 18 deletions
diff --git a/net/glusterfs/files/patch-configure.ac b/net/glusterfs/files/patch-configure.ac
index 97d2dfe68826..4335283808e1 100644
--- a/net/glusterfs/files/patch-configure.ac
+++ b/net/glusterfs/files/patch-configure.ac
@@ -37,3 +37,17 @@
GF_CFLAGS="${GF_CFLAGS} -DO_DSYNC=0"
GF_CFLAGS="${GF_CFLAGS} -Dxdr_quad_t=xdr_longlong_t"
GF_CFLAGS="${GF_CFLAGS} -Dxdr_u_quad_t=xdr_u_longlong_t"
+@@ -1508,6 +1514,13 @@ AC_SUBST(AM_LIBTOOLFLAGS)
+ AC_SUBST(GF_NO_UNDEFINED)
+ AC_SUBST(GF_XLATOR_DEFAULT_LDFLAGS)
+ AC_SUBST(GF_XLATOR_LDFLAGS)
++AC_SUBST(GF_XLATOR_MGNT_LIBADD)
++
++case $host_os in
++ *freebsd*)
++ GF_XLATOR_MGNT_LIBADD="-lutil -lprocstat"
++ ;;
++esac
+
+ CONTRIBDIR='$(top_srcdir)/contrib'
+ AC_SUBST(CONTRIBDIR)
diff --git a/net/glusterfs/files/patch-libglusterfs_src_Makefile.am b/net/glusterfs/files/patch-libglusterfs_src_Makefile.am
index c7eb733dbafe..6f0c52dfc98f 100644
--- a/net/glusterfs/files/patch-libglusterfs_src_Makefile.am
+++ b/net/glusterfs/files/patch-libglusterfs_src_Makefile.am
@@ -1,11 +1,12 @@
--- libglusterfs/src/Makefile.am.orig 2020-07-06 01:22:37 UTC
+++ libglusterfs/src/Makefile.am
-@@ -12,7 +12,7 @@ libglusterfs_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE
+@@ -12,7 +12,8 @@ libglusterfs_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE
-DSBIN_DIR=\"$(sbindir)\" -I$(CONTRIBDIR)/timer-wheel \
-I$(CONTRIBDIR)/xxhash
-libglusterfs_la_LIBADD = $(ZLIB_LIBS) $(MATH_LIB) $(UUID_LIBS)
-+libglusterfs_la_LIBADD = $(ZLIB_LIBS) $(MATH_LIB) $(UUID_LIBS) $(URCU_LIBS)
++libglusterfs_la_LIBADD = $(ZLIB_LIBS) $(MATH_LIB) $(UUID_LIBS) $(LIB_DL) \
++ $(URCU_LIBS) $(URCU_CDS_LIBS)
libglusterfs_la_LDFLAGS = -version-info $(LIBGLUSTERFS_LT_VERSION) $(GF_LDFLAGS) \
-export-symbols $(top_srcdir)/libglusterfs/src/libglusterfs.sym
diff --git a/net/glusterfs/files/patch-libglusterfs_src_common-utils.c b/net/glusterfs/files/patch-libglusterfs_src_common-utils.c
index 0e3d73e575aa..9220c8eb3b7c 100644
--- a/net/glusterfs/files/patch-libglusterfs_src_common-utils.c
+++ b/net/glusterfs/files/patch-libglusterfs_src_common-utils.c
@@ -1,11 +1,34 @@
---- libglusterfs/src/common-utils.c.orig 2020-05-18 20:57:54 UTC
+--- libglusterfs/src/common-utils.c.orig 2020-07-06 01:22:37 UTC
+++ libglusterfs/src/common-utils.c
-@@ -3067,7 +3067,7 @@ get_mem_size()
+@@ -3113,7 +3113,7 @@ get_mem_size()
memsize = page_size * num_pages;
#endif
-
+
-#if defined GF_DARWIN_HOST_OS
+#if defined GF_DARWIN_HOST_OS || defined __FreeBSD__
-
+
size_t len = sizeof(memsize);
int name[] = {CTL_HW, HW_PHYSMEM};
+@@ -4127,6 +4127,14 @@ gf_skip_header_section(int fd, int header_len)
+ gf_boolean_t
+ gf_is_pid_running(int pid)
+ {
++#ifdef __FreeBSD__
++ int ret = -1;
++
++ ret = sys_kill(pid, 0);
++ if (ret < 0) {
++ return _gf_false;
++ }
++#else
+ char fname[32] = {
+ 0,
+ };
+@@ -4140,6 +4148,7 @@ gf_is_pid_running(int pid)
+ }
+
+ sys_close(fd);
++#endif
+ return _gf_true;
+ }
+
diff --git a/net/glusterfs/files/patch-libglusterfs_src_glusterfs_syscall.h b/net/glusterfs/files/patch-libglusterfs_src_glusterfs_syscall.h
new file mode 100644
index 000000000000..481cda04338d
--- /dev/null
+++ b/net/glusterfs/files/patch-libglusterfs_src_glusterfs_syscall.h
@@ -0,0 +1,16 @@
+--- libglusterfs/src/glusterfs/syscall.h.orig 2020-08-04 12:41:32 UTC
++++ libglusterfs/src/glusterfs/syscall.h
+@@ -266,4 +266,13 @@ ssize_t
+ sys_copy_file_range(int fd_in, off64_t *off_in, int fd_out, off64_t *off_out,
+ size_t len, unsigned int flags);
+
++int
++sys_kill(pid_t pid, int sig);
++
++#ifdef __FreeBSD__
++int
++sys_sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp,
++ const void *newp, size_t newlen);
++#endif
++
+ #endif /* __SYSCALL_H__ */
diff --git a/net/glusterfs/files/patch-libglusterfs_src_libglusterfs.sym b/net/glusterfs/files/patch-libglusterfs_src_libglusterfs.sym
new file mode 100644
index 000000000000..84a38f1a3e7f
--- /dev/null
+++ b/net/glusterfs/files/patch-libglusterfs_src_libglusterfs.sym
@@ -0,0 +1,11 @@
+--- libglusterfs/src/libglusterfs.sym.orig 2020-08-04 12:41:32 UTC
++++ libglusterfs/src/libglusterfs.sym
+@@ -1080,6 +1080,8 @@ sys_write
+ sys_writev
+ sys_socket
+ sys_accept
++sys_kill
++sys_sysctl
+ tbf_init
+ tbf_throttle
+ timespec_now
diff --git a/net/glusterfs/files/patch-libglusterfs_src_syscall.c b/net/glusterfs/files/patch-libglusterfs_src_syscall.c
index a674d3b9218d..ad4c70893dbd 100644
--- a/net/glusterfs/files/patch-libglusterfs_src_syscall.c
+++ b/net/glusterfs/files/patch-libglusterfs_src_syscall.c
@@ -1,20 +1,70 @@
---- libglusterfs/src/syscall.c.orig 2020-05-18 20:57:54 UTC
+--- libglusterfs/src/syscall.c.orig 2020-08-04 12:41:32 UTC
+++ libglusterfs/src/syscall.c
-@@ -485,7 +485,7 @@ sys_lsetxattr(const char *path, const char *name, cons
+@@ -13,6 +13,10 @@
+ #include "glusterfs/mem-pool.h"
+ #include "glusterfs/libglusterfs-messages.h"
+
++#ifdef __FreeBSD__
++#include <sys/sysctl.h>
++#include <signal.h>
++#endif
+ #include <sys/types.h>
+ #include <utime.h>
+ #include <sys/time.h>
+@@ -506,9 +510,17 @@ sys_lsetxattr(const char *path, const char *name, cons
#endif
-
+
#ifdef GF_BSD_HOST_OS
- return FS_RET_CHECK0(
-+ return FS_RET_CHECK(
++ ssize_t ret = FS_RET_CHECK(
extattr_set_link(path, EXTATTR_NAMESPACE_USER, name, value, size),
errno);
++ /* On BSD extattr_set_link returns the number of bytes written/read on
++ * success. Force this to be 0 if it was successful so the result remains
++ * compatible with other platform expectations.
++ */
++ if(ret > 0) {
++ ret = 0;
++ }
++ return ret;
#endif
-@@ -603,7 +603,7 @@ sys_fsetxattr(int filedes, const char *name, const voi
+
+ #ifdef GF_SOLARIS_HOST_OS
+@@ -624,9 +636,17 @@ sys_fsetxattr(int filedes, const char *name, const voi
#endif
-
+
#ifdef GF_BSD_HOST_OS
- return FS_RET_CHECK0(
-+ return FS_RET_CHECK(
++ ssize_t ret = FS_RET_CHECK(
extattr_set_fd(filedes, EXTATTR_NAMESPACE_USER, name, value, size),
errno);
++ /* On BSD extattr_set_fd returns the number of bytes written/read on
++ * success. Force this to be 0 if it was successful so the result remains
++ * compatible with other platform expectations.
++ */
++ if(ret > 0) {
++ ret = 0;
++ }
++ return ret;
#endif
+
+ #ifdef GF_SOLARIS_HOST_OS
+@@ -854,3 +874,18 @@ sys_copy_file_range(int fd_in, off64_t *off_in, int fd
+ #endif /* HAVE_COPY_FILE_RANGE_SYS */
+ #endif /* HAVE_COPY_FILE_RANGE */
+ }
++
++#ifdef __FreeBSD__
++int
++sys_kill(pid_t pid, int sig)
++{
++ return FS_RET_CHECK0(kill(pid, sig), errno);
++}
++
++int
++sys_sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp,
++ const void *newp, size_t newlen)
++{
++ return FS_RET_CHECK0(sysctl(name, namelen, oldp, oldlenp, newp, newlen), errno);
++}
++#endif
diff --git a/net/glusterfs/files/patch-mount_glusterfs.in b/net/glusterfs/files/patch-mount_glusterfs.in
index 45955c8c4973..c3b7abcaf8a1 100644
--- a/net/glusterfs/files/patch-mount_glusterfs.in
+++ b/net/glusterfs/files/patch-mount_glusterfs.in
@@ -1,5 +1,5 @@
---- xlators/mount/fuse/utils/mount_glusterfs.in.orig 2017-06-27 22:25:12.392137135 +0700
-+++ xlators/mount/fuse/utils/mount_glusterfs.in 2017-12-19 18:24:21.736142000 +0700
+--- xlators/mount/fuse/utils/mount_glusterfs.in.orig 2017-06-28 05:25:12 UTC
++++ xlators/mount/fuse/utils/mount_glusterfs.in
@@ -463,50 +463,44 @@ parse_options()
if [ "$key" = "$value" ]; then
without_options $pair;
diff --git a/net/glusterfs/files/patch-xlators_mgmt_glusterd_src_Makefile.am b/net/glusterfs/files/patch-xlators_mgmt_glusterd_src_Makefile.am
index 7d69cd2a958f..b7237c2cff98 100644
--- a/net/glusterfs/files/patch-xlators_mgmt_glusterd_src_Makefile.am
+++ b/net/glusterfs/files/patch-xlators_mgmt_glusterd_src_Makefile.am
@@ -1,6 +1,6 @@
--- xlators/mgmt/glusterd/src/Makefile.am.orig 2020-07-16 17:28:50 UTC
+++ xlators/mgmt/glusterd/src/Makefile.am
-@@ -25,12 +25,14 @@ glusterd_la_SOURCES = glusterd.c glusterd-handler.c gl
+@@ -25,13 +25,14 @@ glusterd_la_SOURCES = glusterd.c glusterd-handler.c gl
glusterd-conn-helper.c glusterd-snapd-svc.c glusterd-snapd-svc-helper.c \
glusterd-bitd-svc.c glusterd-scrub-svc.c glusterd-server-quorum.c \
glusterd-reset-brick.c glusterd-shd-svc.c glusterd-shd-svc-helper.c \
@@ -12,7 +12,18 @@
$(top_builddir)/libglusterd/src/libglusterd.la \
$(top_builddir)/rpc/xdr/src/libgfxdr.la \
$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la \
-+ $(CONTRIBDIR)/mount/mntent_compat.h \
- $(XML_LIBS) -lcrypto $(URCU_LIBS) $(URCU_CDS_LIBS) $(LIB_DL)
+- $(XML_LIBS) -lcrypto $(URCU_LIBS) $(URCU_CDS_LIBS) $(LIB_DL)
++ $(XML_LIBS) -lcrypto $(URCU_LIBS) $(URCU_CDS_LIBS) $(LIB_DL) $(GF_XLATOR_MGNT_LIBADD)
noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h \
+ glusterd-sm.h glusterd-store.h glusterd-mem-types.h \
+@@ -46,7 +47,8 @@ noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-
+ glusterd-scrub-svc.h glusterd-server-quorum.h glusterd-errno.h \
+ glusterd-shd-svc.h glusterd-shd-svc-helper.h \
+ glusterd-gfproxyd-svc.h glusterd-gfproxyd-svc-helper.h \
+- $(CONTRIBDIR)/userspace-rcu/rculist-extra.h
++ $(CONTRIBDIR)/userspace-rcu/rculist-extra.h \
++ $(CONTRIBDIR)/mount/mntent_compat.h
+
+ AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
+ -I$(top_srcdir)/rpc/xdr/src -I$(top_builddir)/rpc/xdr/src \
diff --git a/net/glusterfs/files/patch-xlators_mgmt_glusterd_src_glusterd-utils.c b/net/glusterfs/files/patch-xlators_mgmt_glusterd_src_glusterd-utils.c
new file mode 100644
index 000000000000..64177ca734f2
--- /dev/null
+++ b/net/glusterfs/files/patch-xlators_mgmt_glusterd_src_glusterd-utils.c
@@ -0,0 +1,115 @@
+--- xlators/mgmt/glusterd/src/glusterd-utils.c.orig 2020-07-06 01:22:37 UTC
++++ xlators/mgmt/glusterd/src/glusterd-utils.c
+@@ -79,6 +79,14 @@
+ #include <sys/sockio.h>
+ #endif
+
++#ifdef __FreeBSD__
++#include <sys/sysctl.h>
++#include <sys/param.h>
++#include <sys/queue.h>
++#include <libprocstat.h>
++#include <libutil.h>
++#endif
++
+ #define NFS_PROGRAM 100003
+ #define NFSV3_VERSION 3
+
+@@ -6270,7 +6278,6 @@ find_compatible_brick(glusterd_conf_t *conf, glusterd_
+ int
+ glusterd_get_sock_from_brick_pid(int pid, char *sockpath, size_t len)
+ {
+- char fname[128] = "";
+ char buf[1024] = "";
+ char cmdline[2048] = "";
+ xlator_t *this = NULL;
+@@ -6285,6 +6292,22 @@ glusterd_get_sock_from_brick_pid(int pid, char *sockpa
+ this = THIS;
+ GF_ASSERT(this);
+
++#ifdef __FreeBSD__
++ blen = sizeof(buf);
++ int mib[4];
++
++ mib[0] = CTL_KERN;
++ mib[1] = KERN_PROC;
++ mib[2] = KERN_PROC_ARGS;
++ mib[3] = pid;
++
++ if (sys_sysctl(mib, 4, buf, &blen, NULL, blen) != 0) {
++ gf_log(this->name, GF_LOG_ERROR, "brick process %d is not running",
++ pid);
++ return ret;
++ }
++#else
++ char fname[128] = "";
+ snprintf(fname, sizeof(fname), "/proc/%d/cmdline", pid);
+
+ if (sys_access(fname, R_OK) != 0) {
+@@ -6301,6 +6324,7 @@ glusterd_get_sock_from_brick_pid(int pid, char *sockpa
+ strerror(errno), fname);
+ return ret;
+ }
++#endif
+
+ /* convert cmdline to single string */
+ for (i = 0, j = 0; i < blen; i++) {
+@@ -6349,6 +6373,42 @@ glusterd_get_sock_from_brick_pid(int pid, char *sockpa
+ char *
+ search_brick_path_from_proc(pid_t brick_pid, char *brickpath)
+ {
++ char *brick_path = NULL;
++#ifdef __FreeBSD__
++ struct filestat *fst;
++ struct procstat *ps;
++ struct kinfo_proc *kp;
++ struct filestat_list *head;
++
++ ps = procstat_open_sysctl();
++ if (ps == NULL)
++ goto out;
++
++ kp = kinfo_getproc(brick_pid);
++ if (kp == NULL)
++ goto out;
++
++ head = procstat_getfiles(ps, (void *)kp, 0);
++ if (head == NULL)
++ goto out;
++
++ STAILQ_FOREACH(fst, head, next) {
++ if(fst->fs_fd < 0)
++ continue;
++
++ if (!strcmp(fst->fs_path, brickpath)) {
++ brick_path = gf_strdup(fst->fs_path);
++ break;
++ }
++ }
++
++out:
++ if (head != NULL)
++ procstat_freefiles(ps, head);
++ if (kp != NULL)
++ free(kp);
++ procstat_close(ps);
++#else
+ struct dirent *dp = NULL;
+ DIR *dirp = NULL;
+ size_t len = 0;
+@@ -6359,7 +6419,6 @@ search_brick_path_from_proc(pid_t brick_pid, char *bri
+ 0,
+ },
+ };
+- char *brick_path = NULL;
+
+ if (!brickpath)
+ goto out;
+@@ -6396,6 +6455,7 @@ search_brick_path_from_proc(pid_t brick_pid, char *bri
+ }
+ out:
+ sys_closedir(dirp);
++#endif
+ return brick_path;
+ }
+