diff options
| author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2017-03-27 16:09:56 -0400 | 
|---|---|---|
| committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2017-04-28 14:08:41 +0000 | 
| commit | 83abcba6b42f94eb5a6495a634d4055362a9d79d (patch) | |
| tree | 401e7638258acf9ef4c04af00a0bbfc443b570e3 | |
| parent | ab88f655e6423f51e2f2fac9265ff4d4f5c3e579 (diff) | |
build: conditionally build legacy gNFS server and associated sub-packaging
Plus some additional logic in glusterd to ensure gnfs (glusterfs)
daemons are never started if server/nfs xlator is not installed.
As a service, nfs is still initialized. The glusterfs-gnfs RPM
may be installed or uninstalled independent of anything else,
including on a system where gluster is actively running, so the
existence of the xlator is always tested before trying to start
gnfs.
Change-Id: I56743ad1cb36a84917226d7d26cb9d015d441e66
BUG: 1326219
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/16958
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
| -rw-r--r-- | configure.ac | 12 | ||||
| -rw-r--r-- | extras/LinuxRPM/Makefile.am | 4 | ||||
| -rw-r--r-- | glusterfs.spec.in | 59 | ||||
| -rw-r--r-- | xlators/Makefile.am | 11 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/Makefile.am | 4 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-messages.h | 11 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-nfs-svc.c | 28 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h | 1 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 7 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 35 | 
10 files changed, 107 insertions, 65 deletions
diff --git a/configure.ac b/configure.ac index 960a43cbe3b..cdac77b9574 100644 --- a/configure.ac +++ b/configure.ac @@ -1335,6 +1335,17 @@ if test "x$enable_glupy" = "xyes"; then  fi  dnl end glupy section +dnl gnfs section +BUILD_GNFS="no" +AC_ARG_ENABLE([gnfs], +              AC_HELP_STRING([--enable-gnfs], +                             [Enable legacy gnfs server xlator.])) +if test "x$enable_gnfs" = "xyes"; then +    BUILD_GNFS="yes" +fi +AM_CONDITIONAL([BUILD_GNFS], [test x$BUILD_GNFS = xyes]) +dnl end gnfs section +  dnl Check for userspace-rcu  PKG_CHECK_MODULES([URCU], [liburcu-bp], [],    [AC_CHECK_HEADERS([urcu-bp.h], @@ -1581,4 +1592,5 @@ echo "Events               : $BUILD_EVENTS"  echo "EC dynamic support   : $EC_DYNAMIC_SUPPORT"  echo "Use memory pools     : $USE_MEMPOOL"  echo "Nanosecond m/atimes  : $BUILD_NANOSECOND_TIMESTAMPS" +echo "Legacy gNFS server   : $BUILD_GNFS"  echo diff --git a/extras/LinuxRPM/Makefile.am b/extras/LinuxRPM/Makefile.am index 61fd6da74c8..f02853798c0 100644 --- a/extras/LinuxRPM/Makefile.am +++ b/extras/LinuxRPM/Makefile.am @@ -18,7 +18,7 @@ autogen:  	cd ../.. && \  	rm -rf autom4te.cache && \  	./autogen.sh && \ -	./configure --with-previous-options +	./configure --enable-gnfs --with-previous-options  prep:  	$(MAKE) -C ../.. dist; @@ -36,7 +36,7 @@ srcrpm:  	mv rpmbuild/SRPMS/* .  rpms: -	rpmbuild --define '_topdir $(shell pwd)/rpmbuild' -bb rpmbuild/SPECS/glusterfs.spec +	rpmbuild --define '_topdir $(shell pwd)/rpmbuild' --with gnfs -bb rpmbuild/SPECS/glusterfs.spec  	mv rpmbuild/RPMS/*/* .  # EPEL-5 does not like new versions of rpmbuild and requires some diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 27a4351c1af..b64c3af159c 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -47,6 +47,10 @@  %global _without_georeplication --disable-georeplication  %endif +# if you wish to compile an rpm with the legacy gNFS server xlator +# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --with gnfs +%{?_with_gnfs:%global _with_gnfs --enable-gnfs} +  # if you wish to compile an rpm without the OCF resource agents...  # rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without ocf  %{?_without_ocf:%global _without_ocf --without-ocf} @@ -100,7 +104,7 @@  %endif  # From https://fedoraproject.org/wiki/Packaging:Python#Macros -%if ( 0%{?rhel} && 0%{?rhel} <= 5 ) +%if ( 0%{?rhel} && 0%{?rhel} <= 6 )  %{!?python2_sitelib: %global python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}  %{!?python2_sitearch: %global python2_sitearch %(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}  %endif @@ -401,6 +405,26 @@ is in userspace and easily manageable.  This package provides support to geo-replication.  %endif +%if ( 0%{?_with_gnfs:1} ) +%package gnfs +Summary:          GlusterFS gNFS server +Group:            System Environment/Daemons +Requires:         %{name}%{?_isa} = %{version}-%{release} +Requires:         %{name}-client-xlators%{?_isa} = %{version}-%{release} +Requires:         nfs-utils + +%description gnfs +GlusterFS is a distributed file-system capable of scaling to several +petabytes. It aggregates various storage bricks over Infiniband RDMA +or TCP/IP interconnect into one large parallel network file +system. GlusterFS is one of the most sophisticated file systems in +terms of features and extensibility.  It borrows a powerful concept +called Translators from GNU Hurd kernel. Much of the code in GlusterFS +is in user space and easily manageable. + +This package provides the glusterfs legacy gNFS server xlator +%endif +  %package libs  Summary:          GlusterFS common libraries  Group:            Applications/File @@ -530,7 +554,6 @@ Requires:         %{name}-api%{?_isa} = %{version}-%{release}  Requires:         %{name}-client-xlators%{?_isa} = %{version}-%{release}  # lvm2 for snapshot, and nfs-utils and rpcbind/portmap for gnfs server  Requires:         lvm2 -Requires:         nfs-utils  %if ( 0%{?_with_systemd:1} )  %{?systemd_requires}  %else @@ -630,18 +653,19 @@ export CFLAGS  %configure \          %{?_with_cmocka} \          %{?_with_debug} \ -        %{?_with_valgrind} \ +        %{?_with_firewalld} \ +        %{?_with_gnfs} \          %{?_with_tmpfilesdir} \ +        %{?_with_valgrind} \          %{?_without_bd} \          %{?_without_epoll} \ +        %{?_without_events} \          %{?_without_fusermount} \          %{?_without_georeplication} \ -        %{?_with_firewalld} \          %{?_without_ocf} \          %{?_without_rdma} \          %{?_without_syslog} \ -        %{?_without_tiering} \ -        %{?_without_events} +        %{?_without_tiering}  # fix hardening and remove rpath in shlibs  %if ( 0%{?fedora} && 0%{?fedora} > 17 ) || ( 0%{?rhel} && 0%{?rhel} > 6 ) @@ -1059,6 +1083,16 @@ exit 0  %endif  %endif +%if ( 0%{?_with_gnfs:1} ) +%files gnfs +%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs +%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs/* +%ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/nfs +%ghost      %attr(0600,-,-) %{_sharedstatedir}/glusterd/nfs/nfs-server.vol +%ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/nfs/run +%ghost      %attr(0600,-,-) %{_sharedstatedir}/glusterd/nfs/run/nfs.pid +%endif +  %if ( 0%{!?_without_georeplication:1} )  %files geo-replication  %config(noreplace) %{_sysconfdir}/logrotate.d/glusterfs-georep @@ -1126,6 +1160,11 @@ exit 0  # sysconf  %config(noreplace) %{_sysconfdir}/glusterfs  %exclude %{_sysconfdir}/glusterfs/eventsconfig.json +%exclude %{_sharedstatedir}/glusterd/nfs/nfs-server.vol +%exclude %{_sharedstatedir}/glusterd/nfs/run/nfs.pid +%if ( 0%{?_with_gnfs:1} ) +%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs/* +%endif  %config(noreplace) %{_sysconfdir}/sysconfig/glusterd  %if ( 0%{_for_fedora_koji_builds} )  %config(noreplace) %{_sysconfdir}/sysconfig/glusterfsd @@ -1166,7 +1205,6 @@ exit 0  %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/upcall.so  %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/leases.so  %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mgmt* -%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs*  %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/server*  %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/storage*  %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/performance/decompounder.so @@ -1227,10 +1265,6 @@ exit 0         %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/stop/pre              %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/stop/pre/S30samba-stop.sh              %attr(0755,-,-) %{_sharedstatedir}/glusterd/hooks/1/stop/pre/S29CTDB-teardown.sh -%ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/nfs -%ghost      %attr(0600,-,-) %{_sharedstatedir}/glusterd/nfs/nfs-server.vol -%ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/nfs/run -%ghost      %attr(0600,-,-) %{_sharedstatedir}/glusterd/nfs/run/nfs.pid  %ghost      %attr(0600,-,-) %{_sharedstatedir}/glusterd/options  %ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/peers  %ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/quotad @@ -1272,6 +1306,9 @@ exit 0  %endif  %changelog +* Thu Apr 27 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com> +- gnfs in an optional subpackage +  * Wed Apr 26 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>  - /var/run/gluster owner gluster:gluster(0775) for qemu(gfapi)    statedumps (#1445569) diff --git a/xlators/Makefile.am b/xlators/Makefile.am index ea1be844ef4..876a31f8e81 100644 --- a/xlators/Makefile.am +++ b/xlators/Makefile.am @@ -2,8 +2,15 @@ if ENABLE_EXPERIMENTAL    EXPERIMENTAL = experimental  endif -SUBDIRS = cluster storage protocol performance debug features encryption mount nfs mgmt system \ -          playground meta $(EXPERIMENTAL) +if BUILD_GNFS +  GNFS_DIR = nfs +endif + +DIST_SUBDIRS = cluster storage protocol performance debug features encryption \ +          mount nfs mgmt system playground meta experimental + +SUBDIRS = cluster storage protocol performance debug features encryption \ +          mount ${GNFS_DIR} mgmt system playground meta $(EXPERIMENTAL)  EXTRA_DIST = xlator.sym diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am index 4858deeeedd..b0f5a9b540c 100644 --- a/xlators/mgmt/glusterd/src/Makefile.am +++ b/xlators/mgmt/glusterd/src/Makefile.am @@ -1,6 +1,8 @@  xlator_LTLIBRARIES = glusterd.la  xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mgmt -glusterd_la_CPPFLAGS = $(AM_CPPFLAGS) "-DFILTERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/filter\"" +glusterd_la_CPPFLAGS = $(AM_CPPFLAGS) \ +	-DFILTERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/filter\" \ +	-DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\"  glusterd_la_LDFLAGS = -module $(GF_XLATOR_DEFAULT_LDFLAGS)  glusterd_la_SOURCES = glusterd.c glusterd-handler.c glusterd-sm.c \  	glusterd-op-sm.c glusterd-utils.c glusterd-rpc-ops.c \ diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h index efeda0d4edf..8cfc26ce905 100644 --- a/xlators/mgmt/glusterd/src/glusterd-messages.h +++ b/xlators/mgmt/glusterd/src/glusterd-messages.h @@ -41,7 +41,7 @@  #define GLUSTERD_COMP_BASE      GLFS_MSGID_GLUSTERD -#define GLFS_NUM_MESSAGES       599 +#define GLFS_NUM_MESSAGES       600  #define GLFS_MSGID_END          (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)  /* Messaged with message IDs */ @@ -4842,8 +4842,17 @@   * @recommendedaction   *   */ +  #define GD_MSG_CLIENTS_GET_STATE_FAILED            (GLUSTERD_COMP_BASE + 599) +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ +#define GD_MSG_GNFS_XLATOR_NOT_INSTALLED           (GLUSTERD_COMP_BASE + 600) +  /*------------*/  #define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c index da343420790..bff4c6cf5d5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c @@ -10,6 +10,7 @@  #include "globals.h"  #include "run.h" +#include "syscall.h"  #include "glusterd.h"  #include "glusterd-utils.h"  #include "glusterd-volgen.h" @@ -17,8 +18,6 @@  #include "glusterd-messages.h"  #include "glusterd-svc-helper.h" -static char *nfs_svc_name = "nfs"; -  static gf_boolean_t  glusterd_nfssvc_need_start ()  { @@ -41,19 +40,13 @@ glusterd_nfssvc_need_start ()          return start;  } -int -glusterd_nfssvc_init (glusterd_svc_t *svc) -{ -        return glusterd_svc_init (svc, nfs_svc_name); -} -  static int  glusterd_nfssvc_create_volfile ()  {          char            filepath[PATH_MAX] = {0,};          glusterd_conf_t *conf = THIS->private; -        glusterd_svc_build_volfile_path (nfs_svc_name, conf->workdir, +        glusterd_svc_build_volfile_path (conf->nfs_svc.name, conf->workdir,                                           filepath, sizeof (filepath));          return glusterd_create_global_volfile (build_nfs_graph,                                                 filepath, NULL); @@ -65,15 +58,16 @@ glusterd_nfssvc_manager (glusterd_svc_t *svc, void *data, int flags)          int                 ret     = -1;          if (!svc->inited) { -                ret = glusterd_nfssvc_init (svc); +                ret = glusterd_svc_init (svc, "nfs");                  if (ret) {                          gf_msg (THIS->name, GF_LOG_ERROR, 0, -                                GD_MSG_FAILED_INIT_NFSSVC, "Failed to init nfs " -                                "service"); +                                GD_MSG_FAILED_INIT_NFSSVC, +                                "Failed to init nfs service");                          goto out;                  } else {                          svc->inited = _gf_true; -                        gf_msg_debug (THIS->name, 0, "nfs service initialized"); +                        gf_msg_debug (THIS->name, 0, +                                      "nfs service initialized");                  }          } @@ -81,6 +75,14 @@ glusterd_nfssvc_manager (glusterd_svc_t *svc, void *data, int flags)          if (ret)                  goto out; +        /* not an error, or a (very) soft error at best */ +        if (sys_access (XLATORDIR "/nfs/server.so", R_OK) != 0) { +                gf_msg (THIS->name, GF_LOG_INFO, 0, +                        GD_MSG_GNFS_XLATOR_NOT_INSTALLED, +                        "nfs/server.so xlator is not installed"); +                goto out; +        } +          ret = glusterd_nfssvc_create_volfile ();          if (ret)                  goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h index c505d1e897c..8b70a62a4e3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h +++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h @@ -29,7 +29,6 @@ struct glusterd_svc_ {          char                      name[PATH_MAX];          glusterd_conn_t           conn;          glusterd_proc_t           proc; -        glusterd_svc_build_t      build;          glusterd_svc_manager_t    manager;          glusterd_svc_start_t      start;          glusterd_svc_stop_t       stop; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 32ebcb8b9b2..e00d9a12fa5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -597,11 +597,8 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo)          new_volinfo->xl = THIS; -        new_volinfo->snapd.svc.build = glusterd_snapdsvc_build; -        new_volinfo->snapd.svc.build (&(new_volinfo->snapd.svc)); - -        new_volinfo->tierd.svc.build = glusterd_tierdsvc_build; -        new_volinfo->tierd.svc.build (&(new_volinfo->tierd.svc)); +        glusterd_snapdsvc_build (&new_volinfo->snapd.svc); +        glusterd_tierdsvc_build (&new_volinfo->tierd.svc);          pthread_mutex_init (&new_volinfo->reflock, NULL);          *volinfo = glusterd_volinfo_ref (new_volinfo); diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index 0f6d888b968..0a2641842aa 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -1331,34 +1331,6 @@ out:          return ret;  } -static void -glusterd_svcs_build () -{ -        xlator_t           *this    = NULL; -        glusterd_conf_t    *priv    = NULL; - -        this = THIS; -        GF_ASSERT (this); - -        priv = this->private; -        GF_ASSERT (priv); - -        priv->shd_svc.build = glusterd_shdsvc_build; -        priv->shd_svc.build (&(priv->shd_svc)); - -        priv->nfs_svc.build = glusterd_nfssvc_build; -        priv->nfs_svc.build (&(priv->nfs_svc)); - -        priv->quotad_svc.build = glusterd_quotadsvc_build; -        priv->quotad_svc.build (&(priv->quotad_svc)); - -        priv->bitd_svc.build = glusterd_bitdsvc_build; -        priv->bitd_svc.build (&(priv->bitd_svc)); - -        priv->scrub_svc.build = glusterd_scrubsvc_build; -        priv->scrub_svc.build (&(priv->scrub_svc)); -} -  static int  is_upgrade (dict_t *options, gf_boolean_t *upgrade)  { @@ -1806,7 +1778,12 @@ init (xlator_t *this)          this->private = conf;          glusterd_mgmt_v3_lock_init ();          glusterd_txn_opinfo_dict_init (); -        glusterd_svcs_build (); + +        glusterd_shdsvc_build (&conf->shd_svc); +        glusterd_nfssvc_build (&conf->nfs_svc); +        glusterd_quotadsvc_build (&conf->quotad_svc); +        glusterd_bitdsvc_build (&conf->bitd_svc); +        glusterd_scrubsvc_build (&conf->scrub_svc);          /* Make install copies few of the hook-scripts by creating hooks           * directory. Hence purposefully not doing the check for the presence of  | 
