Compare commits

..

No commits in common. "c9s_new" and "c8" have entirely different histories.
c9s_new ... c8

1087 changed files with 16278 additions and 106800 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
/glusterfs-3.12.2.tar.gz SOURCES/glusterfs-6.0.tar.gz
/glusterfs-6.0.tar.gz

1
.glusterfs.metadata Normal file
View File

@ -0,0 +1 @@
c9d75f37e00502a10f64cd4ba9aafb17552e0800 SOURCES/glusterfs-6.0.tar.gz

View File

@ -1,26 +0,0 @@
From d4d80332fb3231b1501720d604cf72882c4564ef Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Thu, 9 Nov 2017 01:46:40 -0500
Subject: [PATCH 01/74] Update rfc.sh to rhgs-3.4.0
Signed-off-by: Milind Changire <mchangir@redhat.com>
---
rfc.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rfc.sh b/rfc.sh
index 1354715..356242e 100755
--- a/rfc.sh
+++ b/rfc.sh
@@ -17,7 +17,7 @@ done
shift $((OPTIND-1))
-branch="release-3.12";
+branch="rhgs-3.4.0";
set_hooks_commit_msg()
{
--
1.8.3.1

View File

@ -1,26 +0,0 @@
From d6ae2eb7fa7431db2108173c08b9e4455dd06005 Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Thu, 21 Mar 2019 12:22:43 +0530
Subject: [PATCH 01/52] Update rfc.sh to rhgs-3.5.0
Signed-off-by: Milind Changire <mchangir@redhat.com>
---
rfc.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rfc.sh b/rfc.sh
index 764205c..94c92ef 100755
--- a/rfc.sh
+++ b/rfc.sh
@@ -18,7 +18,7 @@ done
shift $((OPTIND-1))
-branch="release-6";
+branch="rhgs-3.5.0";
set_hooks_commit_msg()
{
--
1.8.3.1

View File

@ -1,56 +0,0 @@
From 8fa58c563cf01934a64773e814f74727ee009b42 Mon Sep 17 00:00:00 2001
From: Joseph Fernandes <josferna@redhat.com>
Date: Wed, 30 Dec 2015 16:53:25 +0530
Subject: [PATCH 03/74] tier/ctr/sql : Dafault values for sql cache and wal
size
Setting default values for sql cache and wal size
cache : 12500 pages
wal : 25000 pages
1 pages - 4096 bytes
Porting this downstream 3.1.2 patch to 3.1.3
Label: DOWNSTREAM ONLY
> Change-Id: Iae3927e021af2e3f7617d45f84e81de3b7d93f1c
> BUG: 1282729
> Signed-off-by: Joseph Fernandes <josferna@redhat.com>
> Reviewed-on: https://code.engineering.redhat.com/gerrit/64642
> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
> Tested-by: Dan Lambright <dlambrig@redhat.com>
Change-Id: Ib3cd951709dff25157371006637b8c0d881f5d61
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/70346
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 982275e..93ef85c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -3152,7 +3152,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
"changetimerecorder xlator."
"The input to this option is in pages."
"Each page is 4096 bytes. Default value is 12500 "
- "pages."
+ "pages i.e ~ 49 MB. "
"The max value is 262144 pages i.e 1 GB and "
"the min value is 1000 pages i.e ~ 4 MB. "
},
@@ -3166,7 +3166,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
" changetimerecorder. "
"The input to this option is in pages. "
"Each page is 4096 bytes. Default value is 25000 "
- "pages."
+ "pages i.e ~ 98 MB."
"The max value is 262144 pages i.e 1 GB and "
"the min value is 1000 pages i.e ~4 MB."
},
--
1.8.3.1

View File

@ -1,51 +0,0 @@
From b67f788dfe5855c455c8f4b41fe8159a5b41c4bd Mon Sep 17 00:00:00 2001
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Date: Mon, 21 Mar 2016 13:54:19 +0530
Subject: [PATCH 04/74] rpc: set bind-insecure to off by default
commit 243a5b429f225acb8e7132264fe0a0835ff013d5 turn's 'ON'
allow-insecure and bind-insecure by default.
Problem:
Now with newer versions we have bind-insecure 'ON' by default.
So, while upgrading subset of nodes from a trusted storage pool,
nodes which have older versions of glusterfs will expect
connection from secure ports only (since they still have
bind-insecure off) thus they reject connection from upgraded
nodes which now have insecure ports.
Hence we will run into connection issues between peers.
Solution:
This patch will turn bind-insecure 'OFF' by default to avoid
problem explained above.
Label: DOWNSTREAM ONLY
Change-Id: Id7a19b4872399d3b019243b0857c9c7af75472f7
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/70313
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
rpc/rpc-lib/src/rpc-transport.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index fc26f46..94880f4 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -258,8 +258,8 @@ rpc_transport_load (glusterfs_ctx_t *ctx, dict_t *options, char *trans_name)
else
trans->bind_insecure = 0;
} else {
- /* By default allow bind insecure */
- trans->bind_insecure = 1;
+ /* Turning off bind insecure by default*/
+ trans->bind_insecure = 0;
}
ret = dict_get_str (options, "transport-type", &type);
--
1.8.3.1

View File

@ -1,47 +0,0 @@
From 174ed444ad3b2007ecf55992acc3418455c46893 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Mon, 21 Mar 2016 17:07:00 +0530
Subject: [PATCH 05/74] glusterd/spec: fixing autogen issue
Backport of https://code.engineering.redhat.com/gerrit/#/c/59463/
Because of the incorrect build section, autogen.sh wasn't re-run during the rpm
build process. The `extras/Makefile.in` was not regenerated with the changes
made to `extras/Makefile.am` in the firewalld patch. This meant that
`extras/Makefile` was generated without the firewalld changes. So the firewalld
config wasn't installed during `make install` and rpmbuild later failed when it
failed to find `/usr/lib/firewalld/glusterfs.xml`
Label: DOWNSTREAM ONLY
>Reviewed-on: https://code.engineering.redhat.com/gerrit/59463
Change-Id: I498bcceeacbd839640282eb6467c9f1464505697
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/70343
Reviewed-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index f68e38f..50db6cb 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -651,12 +651,7 @@ CFLAGS=-DUSE_INSECURE_OPENSSL
export CFLAGS
%endif
-# RHEL6 and earlier need to manually replace config.guess and config.sub
-%if ( 0%{?rhel} && 0%{?rhel} <= 6 )
-./autogen.sh
-%endif
-
-%configure \
+./autogen.sh && %configure \
%{?_with_cmocka} \
%{?_with_debug} \
%{?_with_firewalld} \
--
1.8.3.1

View File

@ -1,36 +0,0 @@
From 69a19b225dd5bc9fb0279ffd729dc5927548428e Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Mon, 21 Mar 2016 22:31:02 +0530
Subject: [PATCH 06/74] libglusterfs/glusterd: Fix compilation errors
1. Removed duplicate definition of GD_OP_VER_PERSISTENT_AFR_XATTRS introduced in
d367a88 where GD_OP_VER_PERSISTENT_AFR_XATTRS was redfined
2. Fixed incorrect op-version
Label: DOWNSTREAM ONLY
Change-Id: Icfa3206e8a41a11875641f57523732b80837f8f6
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/70384
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 229391a..8a662ef 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -968,7 +968,7 @@ glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo)
goto out;
}
- if (conf->op_version >= GD_OP_VERSION_RHS_3_0) {
+ if (conf->op_version >= GD_OP_VERSION_3_7_0) {
snprintf (buf, sizeof (buf), "%d", volinfo->disperse_count);
ret = gf_store_save_value (fd,
GLUSTERD_STORE_KEY_VOL_DISPERSE_CNT,
--
1.8.3.1

View File

@ -1,65 +0,0 @@
From 6ed11f5918cf21907df99839c9b76cf1144b2572 Mon Sep 17 00:00:00 2001
From: "Bala.FA" <barumuga@redhat.com>
Date: Mon, 7 Apr 2014 15:24:10 +0530
Subject: [PATCH 07/74] build: remove ghost directory entries
ovirt requires hook directories for gluster management and ghost
directories are no more ghost entries
Label: DOWNSTREAM ONLY
Change-Id: Iaf1066ba0655619024f87eaaa039f0010578c567
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/60133
Tested-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 50db6cb..3be99b6 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -757,14 +757,29 @@ install -D -p -m 0644 extras/glusterfs-logrotate \
%{buildroot}%{_sysconfdir}/logrotate.d/glusterfs
%if ( 0%{!?_without_georeplication:1} )
-# geo-rep ghosts
mkdir -p %{buildroot}%{_sharedstatedir}/glusterd/geo-replication
touch %{buildroot}%{_sharedstatedir}/glusterd/geo-replication/gsyncd_template.conf
install -D -p -m 0644 extras/glusterfs-georep-logrotate \
%{buildroot}%{_sysconfdir}/logrotate.d/glusterfs-georep
%endif
-# the rest of the ghosts
+%if ( 0%{!?_without_syslog:1} )
+%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} > 6 )
+install -D -p -m 0644 extras/gluster-rsyslog-7.2.conf \
+ %{buildroot}%{_sysconfdir}/rsyslog.d/gluster.conf.example
+%endif
+
+%if ( 0%{?rhel} && 0%{?rhel} == 6 )
+install -D -p -m 0644 extras/gluster-rsyslog-5.8.conf \
+ %{buildroot}%{_sysconfdir}/rsyslog.d/gluster.conf.example
+%endif
+
+%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} >= 6 )
+install -D -p -m 0644 extras/logger.conf.example \
+ %{buildroot}%{_sysconfdir}/glusterfs/logger.conf.example
+%endif
+%endif
+
touch %{buildroot}%{_sharedstatedir}/glusterd/glusterd.info
touch %{buildroot}%{_sharedstatedir}/glusterd/options
subdirs=(add-brick create copy-file delete gsync-create remove-brick reset set start stop)
@@ -1262,6 +1277,7 @@ exit 0
%{_sbindir}/gcron.py
%{_sbindir}/conf.py
+<<<<<<< 2944c7b6656a36a79551f9f9f24ab7a10467f13a
# /var/lib/glusterd, e.g. hookscripts, etc.
%ghost %attr(0644,-,-) %config(noreplace) %{_sharedstatedir}/glusterd/glusterd.info
%dir %attr(0755,-,-) %{_sharedstatedir}/glusterd
--
1.8.3.1

View File

@ -1,878 +0,0 @@
From cac41ae2729cffa23a348c4de14486043ef08163 Mon Sep 17 00:00:00 2001
From: "Bala.FA" <barumuga@redhat.com>
Date: Sat, 11 Nov 2017 10:32:42 +0530
Subject: [PATCH 08/74] build: add RHGS specific changes
Label: DOWNSTREAM ONLY
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1074947
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1097782
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1115267
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1221743
Change-Id: I08333334745adf2350e772c6454ffcfe9c08cb89
Reviewed-on: https://code.engineering.redhat.com/gerrit/24983
Reviewed-on: https://code.engineering.redhat.com/gerrit/25451
Reviewed-on: https://code.engineering.redhat.com/gerrit/25518
Reviewed-on: https://code.engineering.redhat.com/gerrit/25983
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/60134
Tested-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 605 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 597 insertions(+), 8 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 3be99b6..8458e8a 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -80,6 +80,23 @@
%global _without_tiering --disable-tiering
%endif
+# if you wish not to build server rpms, compile like this.
+# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without server
+
+%global _build_server 1
+%if "%{?_without_server}"
+%global _build_server 0
+%endif
+
+%if ( "%{?dist}" == ".el6rhs" ) || ( "%{?dist}" == ".el7rhs" ) || ( "%{?dist}" == ".el7rhgs" )
+%global _build_server 1
+%else
+%global _build_server 0
+%endif
+
+%global _without_extra_xlators 1
+%global _without_regression_tests 1
+
##-----------------------------------------------------------------------------
## All %%global definitions should be placed here and keep them sorted
##
@@ -178,7 +195,8 @@ Release: 0.1%{?prereltag:.%{prereltag}}%{?dist}
%else
Name: @PACKAGE_NAME@
Version: @PACKAGE_VERSION@
-Release: 0.@PACKAGE_RELEASE@%{?dist}
+Release: @PACKAGE_RELEASE@%{?dist}
+ExclusiveArch: x86_64 aarch64
%endif
License: GPLv2 or LGPLv3+
Group: System Environment/Base
@@ -320,7 +338,9 @@ Summary: Development Libraries
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
# Needed for the Glupy examples to work
-Requires: %{name}-extra-xlators%{?_isa} = %{version}-%{release}
+%if ( 0%{!?_without_extra_xlators:1} )
+Requires: %{name}-extra-xlators = %{version}-%{release}
+%endif
%description devel
GlusterFS is a distributed file-system capable of scaling to several
@@ -333,6 +353,7 @@ is in user space and easily manageable.
This package provides the development libraries and include files.
+%if ( 0%{!?_without_extra_xlators:1} )
%package extra-xlators
Summary: Extra Gluster filesystem Translators
Group: Applications/File
@@ -355,6 +376,7 @@ is in user space and easily manageable.
This package provides extra filesystem Translators, such as Glupy,
for GlusterFS.
+%endif
%package fuse
Summary: Fuse client
@@ -381,6 +403,31 @@ is in user space and easily manageable.
This package provides support to FUSE based clients and inlcudes the
glusterfs(d) binary.
+%if ( 0%{?_build_server} )
+%package ganesha
+Summary: NFS-Ganesha configuration
+Group: Applications/File
+
+Requires: %{name}-server%{?_isa} = %{version}-%{release}
+Requires: nfs-ganesha-gluster, pcs, dbus
+%if ( 0%{?rhel} && 0%{?rhel} == 6 )
+Requires: cman, pacemaker, corosync
+%endif
+
+%description ganesha
+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 configuration and related files for using
+NFS-Ganesha as the NFS server using GlusterFS
+%endif
+
+%if ( 0%{?_build_server} )
%if ( 0%{!?_without_georeplication:1} )
%package geo-replication
Summary: GlusterFS Geo-replication
@@ -406,6 +453,7 @@ is in userspace and easily manageable.
This package provides support to geo-replication.
%endif
+%endif
%if ( 0%{?_with_gnfs:1} )
%package gnfs
@@ -498,6 +546,8 @@ is in user space and easily manageable.
This package provides support to ib-verbs library.
%endif
+%if ( 0%{?_build_server} )
+%if ( 0%{!?_without_regression_tests:1} )
%package regression-tests
Summary: Development Tools
Group: Development/Tools
@@ -513,7 +563,10 @@ Requires: nfs-utils xfsprogs yajl psmisc bc
%description regression-tests
The Gluster Test Framework, is a suite of scripts used for
regression testing of Gluster.
+%endif
+%endif
+%if ( 0%{?_build_server} )
%if ( 0%{!?_without_ocf:1} )
%package resource-agents
Summary: OCF Resource Agents for GlusterFS
@@ -546,7 +599,9 @@ This package provides the resource agents which plug glusterd into
Open Cluster Framework (OCF) compliant cluster resource managers,
like Pacemaker.
%endif
+%endif
+%if ( 0%{?_build_server} )
%package server
Summary: Clustered file-system server
Group: System Environment/Daemons
@@ -602,6 +657,7 @@ called Translators from GNU Hurd kernel. Much of the code in GlusterFS
is in user space and easily manageable.
This package provides the glusterfs server daemon.
+%endif
%package client-xlators
Summary: GlusterFS client-side translators
@@ -618,6 +674,7 @@ is in user space and easily manageable.
This package provides the translators needed on any GlusterFS client.
+%if ( 0%{?_build_server} )
%if ( 0%{!?_without_events:1} )
%package events
Summary: GlusterFS Events
@@ -641,6 +698,7 @@ Requires: python-argparse
GlusterFS Events
%endif
+%endif
%prep
%setup -q -n %{name}-%{version}%{?prereltag}
@@ -822,10 +880,12 @@ exit 0
%post api
/sbin/ldconfig
+%if ( 0%{?_build_server} )
%if ( 0%{!?_without_events:1} )
%post events
%_init_restart glustereventsd
%endif
+%endif
%if ( 0%{?rhel} == 5 )
%post fuse
@@ -833,6 +893,7 @@ modprobe fuse
exit 0
%endif
+%if ( 0%{?_build_server} )
%if ( 0%{!?_without_georeplication:1} )
%post geo-replication
if [ $1 -ge 1 ]; then
@@ -840,10 +901,12 @@ if [ $1 -ge 1 ]; then
fi
exit 0
%endif
+%endif
%post libs
/sbin/ldconfig
+%if ( 0%{?_build_server} )
%post server
# Legacy server
%_init_enable glusterd
@@ -914,7 +977,7 @@ else
#rpm_script_t context.
rm -f %{_rundir}/glusterd.socket
fi
-exit 0
+%endif
##-----------------------------------------------------------------------------
## All %%pre should be placed here and keep them sorted
@@ -928,6 +991,7 @@ exit 0
##-----------------------------------------------------------------------------
## All %%preun should be placed here and keep them sorted
##
+%if ( 0%{?_build_server} )
%if ( 0%{!?_without_events:1} )
%preun events
if [ $1 -eq 0 ]; then
@@ -956,7 +1020,7 @@ if [ $1 -ge 1 ]; then
fi
%_init_restart glusterd
fi
-exit 0
+%endif
##-----------------------------------------------------------------------------
## All %%postun should be placed here and keep them sorted
@@ -986,6 +1050,73 @@ exit 0
## All %%files should be placed here and keep them grouped
##
%files
+# exclude extra-xlators files
+%if ( ! 0%{!?_without_extra_xlators:1} )
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption/rot-13.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quiesce.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/selinux.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/features/template.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/testing/performance/symlink-cache.so
+%exclude %{python_sitelib}/*
+%endif
+# exclude regression-tests files
+%if ( ! 0%{!?_without_regression_tests:1} )
+%exclude %{_prefix}/share/glusterfs/run-tests.sh
+%exclude %{_prefix}/share/glusterfs/tests/*
+%endif
+%if ( ! 0%{?_build_server} )
+# exclude ganesha files
+%exclude %{_prefix}/lib/ocf/*
+# exclude geo-replication files
+%exclude %{_sysconfdir}/logrotate.d/glusterfs-georep
+%exclude %{_libexecdir}/glusterfs/*
+%exclude %{_sbindir}/gfind_missing_files
+%exclude %{_datadir}/glusterfs/scripts/get-gfid.sh
+%exclude %{_datadir}/glusterfs/scripts/slave-upgrade.sh
+%exclude %{_datadir}/glusterfs/scripts/gsync-upgrade.sh
+%exclude %{_datadir}/glusterfs/scripts/generate-gfid-file.sh
+%exclude %{_datadir}/glusterfs/scripts/gsync-sync-gfid
+%exclude %{_sharedstatedir}/glusterd/*
+# exclude server files
+%exclude %{_sysconfdir}/glusterfs
+%exclude %{_sysconfdir}/glusterfs/glusterd.vol
+%exclude %{_sysconfdir}/glusterfs/glusterfs-georep-logrotate
+%exclude %{_sysconfdir}/glusterfs/glusterfs-logrotate
+%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-5.8.conf
+%exclude %{_sysconfdir}/glusterfs/gluster-rsyslog-7.2.conf
+%exclude %{_sysconfdir}/glusterfs/group-virt.example
+%exclude %{_sysconfdir}/glusterfs/logger.conf.example
+%exclude %_init_glusterd
+%exclude %{_sysconfdir}/sysconfig/glusterd
+%exclude %{_bindir}/glusterfind
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/arbiter.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bit-rot.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bitrot-stub.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/changetimerecorder.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/index.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/leases.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/locks.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/posix*
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/snapview-server.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/marker.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/quota*
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/trash.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/upcall.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mgmt*
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/performance/decompounder.so
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/server*
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/storage*
+%exclude %{_libdir}/libgfdb.so.*
+%exclude %{_sbindir}/gcron.py
+%exclude %{_sbindir}/glfsheal
+%exclude %{_sbindir}/glusterd
+%exclude %{_sbindir}/snap_scheduler.py
+%exclude %{_datadir}/glusterfs/scripts/stop-all-gluster-processes.sh
+%if 0%{?_tmpfilesdir:1}
+%exclude %{_tmpfilesdir}/gluster.conf
+%endif
+%endif
%doc ChangeLog COPYING-GPLV2 COPYING-LGPLV3 INSTALL README.md THANKS
%{_mandir}/man8/*gluster*.8*
%exclude %{_mandir}/man8/gluster.8*
@@ -1044,6 +1175,11 @@ exit 0
%if 0%{?_tmpfilesdir:1}
%{_tmpfilesdir}/gluster.conf
%endif
+%if ( ! 0%{?_build_server} )
+%{_libdir}/pkgconfig/libgfchangelog.pc
+%{_libdir}/pkgconfig/libgfdb.pc
+%{_sbindir}/gluster-setgfid2path
+%endif
%files api
%exclude %{_libdir}/*.so
@@ -1078,9 +1214,11 @@ exit 0
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/debug-trace.*
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/helloworld.*
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/negative.*
-%{_libdir}/pkgconfig/libgfchangelog.pc
-%if ( 0%{!?_without_tiering:1} )
-%{_libdir}/pkgconfig/libgfdb.pc
+%if ( 0%{?_build_server} )
+%exclude %{_libdir}/pkgconfig/libgfchangelog.pc
+%exclude %{_libdir}/pkgconfig/libgfdb.pc
+%exclude %{_sbindir}/gluster-setgfid2path
+%exclude %{_mandir}/man8/gluster-setgfid2path.8*
%endif
%files client-xlators
@@ -1090,6 +1228,7 @@ exit 0
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/client.so
++%if ( 0%{!?_without_extra_xlators:1} )
%files extra-xlators
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption
@@ -1106,6 +1245,11 @@ exit 0
%dir %{python2_sitelib}/gluster
%dir %{python2_sitelib}/gluster/glupy
%{python2_sitelib}/gluster/glupy/*
+# Don't expect a .egg-info file on EL5
+%if ( ! ( 0%{?rhel} && 0%{?rhel} < 6 ) )
+%{python_sitelib}/glusterfs_glupy*.egg-info
+%endif
+%endif
%files fuse
# glusterfs is a symlink to glusterfsd, -server depends on -fuse.
@@ -1125,6 +1269,7 @@ exit 0
%endif
%endif
+%if ( 0%{?_build_server} )
%if ( 0%{?_with_gnfs:1} )
%files gnfs
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
@@ -1135,7 +1280,13 @@ exit 0
%ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/nfs/run
%ghost %attr(0600,-,-) %{_sharedstatedir}/glusterd/nfs/run/nfs.pid
%endif
+%endif
+
+%if ( 0%{?_build_server} )
+%files ganesha
+%endif
+%if ( 0%{?_build_server} )
%if ( 0%{!?_without_georeplication:1} )
%files geo-replication
%config(noreplace) %{_sysconfdir}/logrotate.d/glusterfs-georep
@@ -1172,6 +1323,7 @@ exit 0
%{_datadir}/glusterfs/scripts/gsync-sync-gfid
%{_datadir}/glusterfs/scripts/schedule_georep.py*
%endif
+%endif
%files libs
%{_libdir}/*.so.*
@@ -1194,19 +1346,26 @@ exit 0
%{_libdir}/glusterfs/%{version}%{?prereltag}/rpc-transport/rdma*
%endif
+%if ( 0%{?_build_server} )
%files regression-tests
%dir %{_datadir}/glusterfs
%{_datadir}/glusterfs/run-tests.sh
%{_datadir}/glusterfs/tests
%exclude %{_datadir}/glusterfs/tests/vagrant
+%exclude %{_datadir}/share/glusterfs/tests/basic/rpm.t
+%endif
+%if ( 0%{?_build_server} )
%if ( 0%{!?_without_ocf:1} )
%files resource-agents
# /usr/lib is the standard for OCF, also on x86_64
%{_prefix}/lib/ocf/resource.d/glusterfs
%endif
+%endif
+%if ( 0%{?_build_server} )
%files server
+%exclude %{_sharedstatedir}/glusterd/hooks/1/gsync-create/post/S56glusterd-geo-rep-create-post.sh
%doc extras/clear_xattrs.sh
# sysconf
%config(noreplace) %{_sysconfdir}/glusterfs
@@ -1277,7 +1436,6 @@ exit 0
%{_sbindir}/gcron.py
%{_sbindir}/conf.py
-<<<<<<< 2944c7b6656a36a79551f9f9f24ab7a10467f13a
# /var/lib/glusterd, e.g. hookscripts, etc.
%ghost %attr(0644,-,-) %config(noreplace) %{_sharedstatedir}/glusterd/glusterd.info
%dir %attr(0755,-,-) %{_sharedstatedir}/glusterd
@@ -1354,8 +1512,438 @@ exit 0
%if ( 0%{?_with_firewalld:1} )
%{_prefix}/lib/firewalld/services/glusterfs.xml
%endif
+%endif
+
+
+##-----------------------------------------------------------------------------
+## All %pretrans should be placed here and keep them sorted
+##
+%if 0%{?_build_server}
+%pretrans -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ echo "ERROR: Distribute volumes detected. In-service rolling upgrade requires distribute volume(s) to be stopped."
+ echo "ERROR: Please stop distribute volume(s) before proceeding... exiting!"
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ echo "WARNING: Updating glusterfs requires its processes to be killed. This action does NOT incur downtime."
+ echo "WARNING: Ensure to wait for the upgraded server to finish healing before proceeding."
+ echo "WARNING: Refer upgrade section of install guide for more details"
+ echo "Please run # service glusterd stop; pkill glusterfs; pkill glusterfsd; pkill gsyncd.py;"
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
+%pretrans api -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-api_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
+%pretrans api-devel -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-api-devel_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
+%pretrans devel -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-devel_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
+%pretrans fuse -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-fuse_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
+%if 0%{?_can_georeplicate}
+%if ( 0%{!?_without_georeplication:1} )
+%pretrans geo-replication -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-geo-replication_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+%endif
+%endif
+
+
+
+%pretrans libs -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-libs_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
+%if ( 0%{!?_without_rdma:1} )
+%pretrans rdma -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-rdma_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+%endif
+
+
+
+%if ( 0%{!?_without_ocf:1} )
+%pretrans resource-agents -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-resource-agents_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+%endif
+
+
+
+%pretrans server -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-server_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+%endif
# Events
+%if ( 0%{?_build_server} )
%if ( 0%{!?_without_events:1} )
%files events
%config(noreplace) %{_sysconfdir}/glusterfs/eventsconfig.json
@@ -1373,6 +1961,7 @@ exit 0
%{_sysconfdir}/init.d/glustereventsd
%endif
%endif
+%endif
%changelog
* Tue Aug 22 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From bfa0315b0437602ff1e568fb16c43d9937703eb4 Mon Sep 17 00:00:00 2001
From: "Bala.FA" <barumuga@redhat.com>
Date: Thu, 22 May 2014 08:37:27 +0530
Subject: [PATCH 09/74] secalert: remove setuid bit for fusermount-glusterfs
glusterfs-fuse: File /usr/bin/fusermount-glusterfs on x86_64 is setuid
root but is not on the setxid whitelist
Label: DOWNSTREAM ONLY
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=989480
Change-Id: Icf6e5db72ae15ccc60b02be6713fb6c4f4c8a15f
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/25453
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/60135
Tested-by: Milind Changire <mchangir@redhat.com>
---
contrib/fuse-util/Makefile.am | 1 -
1 file changed, 1 deletion(-)
diff --git a/contrib/fuse-util/Makefile.am b/contrib/fuse-util/Makefile.am
index abbc10e..a071c81 100644
--- a/contrib/fuse-util/Makefile.am
+++ b/contrib/fuse-util/Makefile.am
@@ -9,6 +9,5 @@ AM_CFLAGS = -Wall $(GF_CFLAGS)
install-exec-hook:
-chown root $(DESTDIR)$(bindir)/fusermount-glusterfs
- chmod u+s $(DESTDIR)$(bindir)/fusermount-glusterfs
CLEANFILES =
--
1.8.3.1

View File

@ -1,79 +0,0 @@
From b40c05f7c099e860464faddd81722c7a3ab860a4 Mon Sep 17 00:00:00 2001
From: Niels de Vos <ndevos@redhat.com>
Date: Wed, 10 Jun 2015 16:16:47 +0200
Subject: [PATCH 10/74] build: packaging corrections for RHEL-5
Because the RHEL-5 version of these packages do not contain the -server
bits, some additional changes for the .spec are needed. These changes
are not applicable upstream.
Label: DOWNSTREAM ONLY
Change-Id: I3c4237bd986617f42b725efd75d1128a69e5dbe3
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/50447
Reviewed-by: Balamurugan Arumugam <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/60136
Tested-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 8458e8a..dbdb818 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -92,6 +92,7 @@
%global _build_server 1
%else
%global _build_server 0
+%global _without_georeplication --disable-georeplication
%endif
%global _without_extra_xlators 1
@@ -1068,17 +1069,14 @@ exit 0
%if ( ! 0%{?_build_server} )
# exclude ganesha files
%exclude %{_prefix}/lib/ocf/*
-# exclude geo-replication files
-%exclude %{_sysconfdir}/logrotate.d/glusterfs-georep
+# exclude incrementalapi
%exclude %{_libexecdir}/glusterfs/*
%exclude %{_sbindir}/gfind_missing_files
-%exclude %{_datadir}/glusterfs/scripts/get-gfid.sh
-%exclude %{_datadir}/glusterfs/scripts/slave-upgrade.sh
-%exclude %{_datadir}/glusterfs/scripts/gsync-upgrade.sh
-%exclude %{_datadir}/glusterfs/scripts/generate-gfid-file.sh
-%exclude %{_datadir}/glusterfs/scripts/gsync-sync-gfid
-%exclude %{_sharedstatedir}/glusterd/*
+%exclude %{_libexecdir}/glusterfs/glusterfind
+%exclude %{_bindir}/glusterfind
+%exclude %{_libexecdir}/glusterfs/peer_add_secret_pub
# exclude server files
+%exclude %{_sharedstatedir}/glusterd/*
%exclude %{_sysconfdir}/glusterfs
%exclude %{_sysconfdir}/glusterfs/glusterd.vol
%exclude %{_sysconfdir}/glusterfs/glusterfs-georep-logrotate
@@ -1093,7 +1091,9 @@ exit 0
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/arbiter.so
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bit-rot.so
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/bitrot-stub.so
+%if ( 0%{!?_without_tiering:1} )
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/changetimerecorder.so
+%endif
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/index.so
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/leases.so
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/locks.so
@@ -1107,7 +1107,9 @@ exit 0
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/performance/decompounder.so
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/server*
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/storage*
+%if ( 0%{!?_without_tiering:1} )
%exclude %{_libdir}/libgfdb.so.*
+%endif
%exclude %{_sbindir}/gcron.py
%exclude %{_sbindir}/glfsheal
%exclude %{_sbindir}/glusterd
--
1.8.3.1

View File

@ -1,70 +0,0 @@
From ada27d07526acb0ef09f37de7f364fa3dcea0b36 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Wed, 3 Jun 2015 11:09:21 +0530
Subject: [PATCH 11/74] build: introduce security hardening flags in gluster
This patch introduces two of the security hardening compiler flags RELRO & PIE
in gluster codebase. Using _hardened_build as 1 doesn't guarantee the existance
of these flags in the compilation as different versions of RHEL have different
redhat-rpm-config macro. So the idea is to export these flags at spec file
level.
Label: DOWNSTREAM ONLY
Change-Id: I0a1a56d0a8f54f110d306ba5e55e39b1b073dc84
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/49780
Reviewed-by: Balamurugan Arumugam <barumuga@redhat.com>
Tested-by: Balamurugan Arumugam <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/60137
Tested-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index dbdb818..458b8bc 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -709,6 +709,24 @@ GlusterFS Events
CFLAGS=-DUSE_INSECURE_OPENSSL
export CFLAGS
%endif
+# In RHEL7 few hardening flags are available by default, however the RELRO
+# default behaviour is partial, convert to full
+%if ( 0%{?rhel} && 0%{?rhel} >= 7 )
+LDFLAGS="$RPM_LD_FLAGS -Wl,-z,relro,-z,now"
+export LDFLAGS
+%else
+%if ( 0%{?rhel} && 0%{?rhel} == 6 )
+CFLAGS="$RPM_OPT_FLAGS -fPIE -DPIE"
+LDFLAGS="$RPM_LD_FLAGS -pie -Wl,-z,relro,-z,now"
+%else
+#It appears that with gcc-4.1.2 in RHEL5 there is an issue using both -fPIC and
+ # -fPIE that makes -z relro not work; -fPIE seems to undo what -fPIC does
+CFLAGS="$CFLAGS $RPM_OPT_FLAGS"
+LDFLAGS="$RPM_LD_FLAGS -Wl,-z,relro,-z,now"
+%endif
+export CFLAGS
+export LDFLAGS
+%endif
./autogen.sh && %configure \
%{?_with_cmocka} \
@@ -2110,8 +2128,11 @@ end
* Fri Jun 12 2015 Aravinda VK <avishwan@redhat.com>
- Added rsync as dependency to georeplication rpm (#1231205)
-* Tue Jun 02 2015 Aravinda VK <avishwan@redhat.com>
-- Added post hook for volume delete as part of glusterfind (#1225465)
+* Thu Jun 11 2015 Atin Mukherjee <amukherj@redhat.com>
+- Security hardening flags inclusion (#1200815)
+
+* Thu Jun 11 2015 Aravinda VK <avishwan@redhat.com>
+- Added post hook for volume delete as part of glusterfind (#1225551)
* Wed May 27 2015 Aravinda VK <avishwan@redhat.com>
- Added stop-all-gluster-processes.sh in glusterfs-server section (#1204641)
--
1.8.3.1

View File

@ -1,100 +0,0 @@
From 280eddebd49483343cc08b42c12f26d89f6d51e1 Mon Sep 17 00:00:00 2001
From: Niels de Vos <ndevos@redhat.com>
Date: Wed, 22 Apr 2015 15:39:59 +0200
Subject: [PATCH 12/74] spec: fix/add pre-transaction scripts for geo-rep and
cli packages
The cli subpackage never had a %pretrans script, this has been added
now.
The %pretrans script for ge-repliaction was never included in the RPM
package because it was disable by a undefined macro (_can_georeplicate).
This macro is not used/set anywhere else and _without_georeplication
should take care of it anyway.
Note: This is a Red Hat Gluster Storage specific patch. Upstream
packaging guidelines do not allow these kind of 'features'.
Label: DOWNSTREAM ONLY
Change-Id: I16aab5bba72f1ed178f3bcac47f9d8ef767cfcef
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/50491
Reviewed-on: https://code.engineering.redhat.com/gerrit/60138
Tested-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 43 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 41 insertions(+), 2 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 458b8bc..68eba56 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1668,6 +1668,47 @@ end
+%pretrans cli -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-cli_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
%pretrans devel -p <lua>
if not posix.access("/bin/bash", "x") then
-- initial installation, no shell, no running glusterfsd
@@ -1750,7 +1791,6 @@ end
-%if 0%{?_can_georeplicate}
%if ( 0%{!?_without_georeplication:1} )
%pretrans geo-replication -p <lua>
if not posix.access("/bin/bash", "x") then
@@ -1791,7 +1831,6 @@ if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
%endif
-%endif
--
1.8.3.1

View File

@ -1,84 +0,0 @@
From cf8f5a4e4098a6aae9b986dc2da2006eadd4fef1 Mon Sep 17 00:00:00 2001
From: Niels de Vos <ndevos@redhat.com>
Date: Thu, 18 Jun 2015 12:16:16 +0200
Subject: [PATCH 13/74] rpm: glusterfs-devel for client-builds should not
depend on -server
glusterfs-devel for client-side packages should *not* include the
libgfdb.so symlink and libgfdb.pc file or any of the libchangelog
ones.
Label: DOWNSTREAM ONLY
Change-Id: Ifb4a9cf48841e5af5dd0a98b6de51e2ee469fc56
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/51019
Reviewed-by: Balamurugan Arumugam <barumuga@redhat.com>
Tested-by: Balamurugan Arumugam <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/60139
Tested-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 68eba56..b2fb4d5 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1196,9 +1196,10 @@ exit 0
%{_tmpfilesdir}/gluster.conf
%endif
%if ( ! 0%{?_build_server} )
-%{_libdir}/pkgconfig/libgfchangelog.pc
-%{_libdir}/pkgconfig/libgfdb.pc
-%{_sbindir}/gluster-setgfid2path
+%exclude %{_libdir}/pkgconfig/libgfchangelog.pc
+%exclude %{_libdir}/pkgconfig/libgfdb.pc
+%exclude %{_sbindir}/gluster-setgfid2path
+%exclude %{_mandir}/man8/gluster-setgfid2path.8*
%endif
%files api
@@ -1226,6 +1227,12 @@ exit 0
%{_includedir}/glusterfs/*
%exclude %{_includedir}/glusterfs/api
%exclude %{_libdir}/libgfapi.so
+%if ( ! 0%{?_build_server} )
+%exclude %{_libdir}/libgfchangelog.so
+%endif
+%if ( 0%{!?_without_tiering:1} && ! 0%{?_build_server})
+%exclude %{_libdir}/libgfdb.so
+%endif
%{_libdir}/*.so
# Glupy Translator examples
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
@@ -1235,10 +1242,14 @@ exit 0
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/helloworld.*
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/glupy/negative.*
%if ( 0%{?_build_server} )
+%{_libdir}/pkgconfig/libgfchangelog.pc
+%else
%exclude %{_libdir}/pkgconfig/libgfchangelog.pc
+%endif
+%if ( 0%{!?_without_tiering:1} && 0%{?_build_server})
+%{_libdir}/pkgconfig/libgfdb.pc
+%else
%exclude %{_libdir}/pkgconfig/libgfdb.pc
-%exclude %{_sbindir}/gluster-setgfid2path
-%exclude %{_mandir}/man8/gluster-setgfid2path.8*
%endif
%files client-xlators
@@ -2161,6 +2172,9 @@ end
* Tue Aug 18 2015 Niels de Vos <ndevos@redhat.com>
- Include missing directories for glusterfind hooks scripts (#1225465)
+* Thu Jun 18 2015 Niels de Vos <ndevos@redhat.com>
+- glusterfs-devel for client-builds should not depend on -server (#1227029)
+
* Mon Jun 15 2015 Niels de Vos <ndevos@redhat.com>
- Replace hook script S31ganesha-set.sh by S31ganesha-start.sh (#1231738)
--
1.8.3.1

View File

@ -1,181 +0,0 @@
From 59602f5c55a05b9652247803d37efa85f6e8f526 Mon Sep 17 00:00:00 2001
From: "Bala.FA" <barumuga@redhat.com>
Date: Wed, 17 Jun 2015 21:34:52 +0530
Subject: [PATCH 14/74] build: add pretrans check
This patch adds pretrans check for client-xlators, ganesha and
python-gluster sub-packages.
Label: DOWNSTREAM ONLY
Change-Id: I454016319832c11902c0ca79a79fbbcf8ac0a121
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/50967
Reviewed-on: https://code.engineering.redhat.com/gerrit/60140
Tested-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 127 insertions(+)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index b2fb4d5..0d1161d 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1720,6 +1720,47 @@ end
+%pretrans client-xlators -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-client-xlators_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
%pretrans devel -p <lua>
if not posix.access("/bin/bash", "x") then
-- initial installation, no shell, no running glusterfsd
@@ -1802,6 +1843,47 @@ end
+%pretrans ganesha -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/glusterfs-ganesha_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
%if ( 0%{!?_without_georeplication:1} )
%pretrans geo-replication -p <lua>
if not posix.access("/bin/bash", "x") then
@@ -1886,6 +1968,47 @@ end
+%pretrans -n python-gluster -p <lua>
+if not posix.access("/bin/bash", "x") then
+ -- initial installation, no shell, no running glusterfsd
+ return 0
+end
+
+-- TODO: move this completely to a lua script
+-- For now, we write a temporary bash script and execute that.
+
+script = [[#!/bin/sh
+pidof -c -o %PPID -x glusterfsd &>/dev/null
+
+if [ $? -eq 0 ]; then
+ pushd . > /dev/null 2>&1
+ for volume in /var/lib/glusterd/vols/*; do cd $volume;
+ vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
+ volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
+ if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
+ exit 1;
+ fi
+ done
+
+ popd > /dev/null 2>&1
+ exit 1;
+fi
+]]
+
+-- rpm in RHEL5 does not have os.tmpname()
+-- io.tmpfile() can not be resolved to a filename to pass to bash :-/
+tmpname = "/tmp/python-gluster_pretrans_" .. os.date("%s")
+tmpfile = io.open(tmpname, "w")
+tmpfile:write(script)
+tmpfile:close()
+ok, how, val = os.execute("/bin/bash " .. tmpname)
+os.remove(tmpname)
+if not (ok == 0) then
+ error("Detected running glusterfs processes", ok)
+end
+
+
+
%if ( 0%{!?_without_rdma:1} )
%pretrans rdma -p <lua>
if not posix.access("/bin/bash", "x") then
@@ -2172,6 +2295,10 @@ end
* Tue Aug 18 2015 Niels de Vos <ndevos@redhat.com>
- Include missing directories for glusterfind hooks scripts (#1225465)
+* Thu Jun 18 2015 Bala.FA <barumuga@redhat.com>
+- add pretrans check for client-xlators, ganesha and python-gluster
+ sub-packages (#1232641)
+
* Thu Jun 18 2015 Niels de Vos <ndevos@redhat.com>
- glusterfs-devel for client-builds should not depend on -server (#1227029)
--
1.8.3.1

View File

@ -1,87 +0,0 @@
From 444324cfdcd8da750bc0ae04a3a416725489dd06 Mon Sep 17 00:00:00 2001
From: "Bala.FA" <barumuga@redhat.com>
Date: Fri, 19 Jun 2015 11:09:53 +0530
Subject: [PATCH 15/74] build: exclude libgfdb.pc conditionally
This patch fixes rhel-5 build failure where libgfdb.pc is not
applicable.
Label: DOWNSTREAM ONLY
Change-Id: Ied3978aa14ff6bd72f25eff9759e501100cb6343
Signed-off-by: Bala.FA <barumuga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/51099
Reviewed-on: https://code.engineering.redhat.com/gerrit/60141
Tested-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 0d1161d..f308f37 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1058,12 +1058,14 @@ fi
%postun libs
/sbin/ldconfig
+%if ( 0%{?_build_server} )
%postun server
/sbin/ldconfig
%if (0%{?_with_firewalld:1})
%firewalld_reload
%endif
exit 0
+%endif
##-----------------------------------------------------------------------------
## All %%files should be placed here and keep them grouped
@@ -1249,8 +1251,10 @@ exit 0
%if ( 0%{!?_without_tiering:1} && 0%{?_build_server})
%{_libdir}/pkgconfig/libgfdb.pc
%else
+%if ( 0%{?rhel} && 0%{?rhel} >= 6 )
%exclude %{_libdir}/pkgconfig/libgfdb.pc
%endif
+%endif
%files client-xlators
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
@@ -1259,7 +1263,7 @@ exit 0
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/client.so
-+%if ( 0%{!?_without_extra_xlators:1} )
+%if ( 0%{!?_without_extra_xlators:1} )
%files extra-xlators
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/encryption
@@ -1378,6 +1382,7 @@ exit 0
%endif
%if ( 0%{?_build_server} )
+%if ( 0%{!?_without_regression_tests:1} )
%files regression-tests
%dir %{_datadir}/glusterfs
%{_datadir}/glusterfs/run-tests.sh
@@ -1385,6 +1390,7 @@ exit 0
%exclude %{_datadir}/glusterfs/tests/vagrant
%exclude %{_datadir}/share/glusterfs/tests/basic/rpm.t
%endif
+%endif
%if ( 0%{?_build_server} )
%if ( 0%{!?_without_ocf:1} )
@@ -2295,6 +2301,9 @@ end
* Tue Aug 18 2015 Niels de Vos <ndevos@redhat.com>
- Include missing directories for glusterfind hooks scripts (#1225465)
+* Fri Jun 19 2015 Bala.FA <barumuga@redhat.com>
+- exclude libgfdb.pc conditionally for rhel-5 (#1233486)
+
* Thu Jun 18 2015 Bala.FA <barumuga@redhat.com>
- add pretrans check for client-xlators, ganesha and python-gluster
sub-packages (#1232641)
--
1.8.3.1

View File

@ -1,33 +0,0 @@
From 5b117b1f8cf05d645512bb6f07cbe2803119652f Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Thu, 29 Oct 2015 15:55:26 +0530
Subject: [PATCH 16/74] build: exclude glusterfs.xml on rhel-7 client build
Label: DOWNSTREAM ONLY
Change-Id: Iae1ee01b3aa61d4dd150e17646b330871b948ef3
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/60433
Reviewed-by: Balamurugan Arumugam <barumuga@redhat.com>
Tested-by: Balamurugan Arumugam <barumuga@redhat.com>
---
glusterfs.spec.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index f308f37..85f7f21 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1138,6 +1138,9 @@ exit 0
%if 0%{?_tmpfilesdir:1}
%exclude %{_tmpfilesdir}/gluster.conf
%endif
+%if ( 0%{?_with_firewalld:1} )
+%exclude /usr/lib/firewalld/services/glusterfs.xml
+%endif
%endif
%doc ChangeLog COPYING-GPLV2 COPYING-LGPLV3 INSTALL README.md THANKS
%{_mandir}/man8/*gluster*.8*
--
1.8.3.1

View File

@ -1,56 +0,0 @@
From 5d3441530f71047483b5973bad7efd2c73ccfff9 Mon Sep 17 00:00:00 2001
From: anand <anekkunt@redhat.com>
Date: Wed, 18 Nov 2015 16:13:46 +0530
Subject: [PATCH 17/74] glusterd: fix info file checksum mismatch during
upgrade
peers are moving rejected state when upgrading from RHS2.1 to RHGS3.1.2
due to checksum mismatch.
Label: DOWNSTREAM ONLY
Change-Id: Ifea6b7dfe8477c7f17eefc5ca87ced58aaa21c84
Signed-off-by: anand <anekkunt@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/61774
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-store.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 8a662ef..42bb8ce 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1014,16 +1014,19 @@ glusterd_volume_exclude_options_write (int fd, glusterd_volinfo_t *volinfo)
goto out;
}
- snprintf (buf, sizeof (buf), "%d", volinfo->op_version);
- ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_OP_VERSION, buf);
- if (ret)
- goto out;
+ if (conf->op_version >= GD_OP_VERSION_RHS_3_0) {
+ snprintf (buf, sizeof (buf), "%d", volinfo->op_version);
+ ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_OP_VERSION, buf);
+ if (ret)
+ goto out;
+
+ snprintf (buf, sizeof (buf), "%d", volinfo->client_op_version);
+ ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_CLIENT_OP_VERSION,
+ buf);
+ if (ret)
+ goto out;
+ }
- snprintf (buf, sizeof (buf), "%d", volinfo->client_op_version);
- ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_CLIENT_OP_VERSION,
- buf);
- if (ret)
- goto out;
if (volinfo->caps) {
snprintf (buf, sizeof (buf), "%d", volinfo->caps);
ret = gf_store_save_value (fd, GLUSTERD_STORE_KEY_VOL_CAPS,
--
1.8.3.1

View File

@ -1,61 +0,0 @@
From 75d0e5c542c4d1a2df1a49a6f526ccb099f9f53f Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Tue, 22 Mar 2016 23:33:13 +0530
Subject: [PATCH 18/74] build: spec file conflict resolution
Missed conflict resolution for removing references to
gluster.conf.example as mentioned in patch titled:
packaging: gratuitous dependencies on rsyslog-mm{count,jsonparse}
by Kaleb
References to hook scripts S31ganesha-start.sh and
S31ganesha-reset.sh got lost in the downstream only
patch conflict resolution.
Commented blanket reference to %{_sharedsstatedir}/glusterd/*
in section %files server to avoid rpmbuild warning related to
multiple references to hook scripts and other files under
/var/lib/glusterd.
Label: DOWNSTREAM ONLY
Change-Id: I9d409f1595ab985ed9f79d9d4f4298877609ba17
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/70535
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
---
glusterfs.spec.in | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 85f7f21..fe566e5 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -840,23 +840,6 @@ install -D -p -m 0644 extras/glusterfs-georep-logrotate \
%{buildroot}%{_sysconfdir}/logrotate.d/glusterfs-georep
%endif
-%if ( 0%{!?_without_syslog:1} )
-%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} > 6 )
-install -D -p -m 0644 extras/gluster-rsyslog-7.2.conf \
- %{buildroot}%{_sysconfdir}/rsyslog.d/gluster.conf.example
-%endif
-
-%if ( 0%{?rhel} && 0%{?rhel} == 6 )
-install -D -p -m 0644 extras/gluster-rsyslog-5.8.conf \
- %{buildroot}%{_sysconfdir}/rsyslog.d/gluster.conf.example
-%endif
-
-%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} >= 6 )
-install -D -p -m 0644 extras/logger.conf.example \
- %{buildroot}%{_sysconfdir}/glusterfs/logger.conf.example
-%endif
-%endif
-
touch %{buildroot}%{_sharedstatedir}/glusterd/glusterd.info
touch %{buildroot}%{_sharedstatedir}/glusterd/options
subdirs=(add-brick create copy-file delete gsync-create remove-brick reset set start stop)
--
1.8.3.1

View File

@ -1,36 +0,0 @@
From 5c5283f873e72d7305953ca357b709a3ab1919f4 Mon Sep 17 00:00:00 2001
From: Kaleb S KEITHLEY <kkeithle@redhat.com>
Date: Tue, 10 May 2016 12:37:23 -0400
Subject: [PATCH 19/74] build: dependency error during upgrade
Not sure who thought config params in the form without_foo were a
good idea. Trying to parse !without_tiering conditionals makes my
head hurt.
Label: DOWNSTREAM ONLY
Change-Id: Ie1c43fc60d6f747c27b22e3a1c40539aba3d2cad
Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/74041
Reviewed-by: Niels de Vos <ndevos@redhat.com>
---
glusterfs.spec.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index fe566e5..f83ae5e 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1234,6 +1234,9 @@ exit 0
%else
%exclude %{_libdir}/pkgconfig/libgfchangelog.pc
%endif
+%if ( 0%{!?_without_tiering:1} && ! 0%{?_build_server})
+%exclude %{_libdir}/libgfdb.so
+%endif
%if ( 0%{!?_without_tiering:1} && 0%{?_build_server})
%{_libdir}/pkgconfig/libgfdb.pc
%else
--
1.8.3.1

View File

@ -1,88 +0,0 @@
From a7570af0bc6dc53044dce2cace9a65e96c571da6 Mon Sep 17 00:00:00 2001
From: Aravinda VK <avishwan@redhat.com>
Date: Mon, 19 Sep 2016 16:59:30 +0530
Subject: [PATCH 20/74] eventsapi: Fix eventtypes.h header generation with
Python 2.4
eventskeygen.py file generates eventtypes.h and eventtypes.py files
during build. If Python version is old(Version 2.4), then Gluster
Client build will fail. eventskeygen.py uses "with" statement to
open file, which is introduced in Python 2.5
Label: DOWNSTREAM ONLY
Change-Id: I995e102fad0c7bc66e840b1ab9d53ed564266253
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/85060
Reviewed-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
events/eventskeygen.py | 47 +++++++++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 22 deletions(-)
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
index 23dfb47..a9c5573 100644
--- a/events/eventskeygen.py
+++ b/events/eventskeygen.py
@@ -207,33 +207,36 @@ ERRORS = (
if gen_header_type == "C_HEADER":
# Generate eventtypes.h
- with open(eventtypes_h, "w") as f:
- f.write("#ifndef __EVENTTYPES_H__\n")
- f.write("#define __EVENTTYPES_H__\n\n")
- f.write("typedef enum {\n")
- for k in ERRORS:
- f.write(" {0},\n".format(k))
- f.write("} event_errors_t;\n")
+ f = open(eventtypes_h, "w")
+ f.write("#ifndef __EVENTTYPES_H__\n")
+ f.write("#define __EVENTTYPES_H__\n\n")
+ f.write("typedef enum {\n")
+ for k in ERRORS:
+ f.write(" %s,\n" % k)
+ f.write("} event_errors_t;\n")
- f.write("\n")
+ f.write("\n")
- f.write("typedef enum {\n")
- for k in keys:
- f.write(" {0},\n".format(k))
+ f.write("typedef enum {\n")
+ for k in keys:
+ f.write(" %s,\n" % k)
- f.write(" {0}\n".format(LAST_EVENT))
- f.write("} eventtypes_t;\n")
- f.write("\n#endif /* __EVENTTYPES_H__ */\n")
+ f.write(" %s\n" % LAST_EVENT)
+ f.write("} eventtypes_t;\n")
+ f.write("\n#endif /* __EVENTTYPES_H__ */\n")
+ f.close()
if gen_header_type == "PY_HEADER":
# Generate eventtypes.py
- with open(eventtypes_py, "w") as f:
- f.write("# -*- coding: utf-8 -*-\n")
- f.write("all_events = [\n")
- for ev in keys:
- f.write(' "{0}",\n'.format(ev))
+ f = open(eventtypes_py, "w")
+ f.write("# -*- coding: utf-8 -*-\n")
+ f.write("all_events = [\n")
+ for ev in keys:
+ f.write(' "%s",\n' % ev)
- f.write("]\n\n")
+ f.write("]\n\n")
- for idx, ev in enumerate(keys):
- f.write("{0} = {1}\n".format(ev.replace("EVENT_", ""), idx))
+ for idx, ev in enumerate(keys):
+ f.write("%s = %s\n" % (ev.replace("EVENT_", ""), idx))
+
+ f.close()
--
1.8.3.1

View File

@ -1,86 +0,0 @@
From ab44b5af9915e15dbe679ac5a16a80d7b0ae45cc Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Tue, 20 Sep 2016 03:09:08 +0530
Subject: [PATCH 21/74] syscall: remove preadv and pwritev sys wrappers
Commit 76f1680 introduced sys wrappers for preadv and pwritev where these
syscalls are not supported for RHEL5. These functions are of actually no use
w.r.t downstream code as sys_pwritev is used only in bd xlator which is not
supported in downstream
Label: DOWNSTREAM ONLY
Change-Id: Ifdc798f1fa74affd77abb06dd14cf9b51f484fe7
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
---
libglusterfs/src/syscall.c | 14 --------------
libglusterfs/src/syscall.h | 6 ------
xlators/storage/bd/src/bd.c | 4 ++--
3 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index a7d4402..90ef39a 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -318,20 +318,6 @@ sys_write (int fd, const void *buf, size_t count)
ssize_t
-sys_preadv (int fd, const struct iovec *iov, int iovcnt, off_t offset)
-{
- return preadv (fd, iov, iovcnt, offset);
-}
-
-
-ssize_t
-sys_pwritev (int fd, const struct iovec *iov, int iovcnt, off_t offset)
-{
- return pwritev (fd, iov, iovcnt, offset);
-}
-
-
-ssize_t
sys_pread (int fd, void *buf, size_t count, off_t offset)
{
return pread (fd, buf, count, offset);
diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h
index 0cb61b6..da816cb 100644
--- a/libglusterfs/src/syscall.h
+++ b/libglusterfs/src/syscall.h
@@ -208,12 +208,6 @@ int
sys_fallocate(int fd, int mode, off_t offset, off_t len);
ssize_t
-sys_preadv (int fd, const struct iovec *iov, int iovcnt, off_t offset);
-
-ssize_t
-sys_pwritev (int fd, const struct iovec *iov, int iovcnt, off_t offset);
-
-ssize_t
sys_pread(int fd, void *buf, size_t count, off_t offset);
ssize_t
diff --git a/xlators/storage/bd/src/bd.c b/xlators/storage/bd/src/bd.c
index 07b7ecd..af3ac84 100644
--- a/xlators/storage/bd/src/bd.c
+++ b/xlators/storage/bd/src/bd.c
@@ -1782,7 +1782,7 @@ __bd_pwritev (int fd, struct iovec *vector, int count, off_t offset,
if (!vector)
return -EFAULT;
- retval = sys_pwritev (fd, vector, count, offset);
+ retval = pwritev (fd, vector, count, offset);
if (retval == -1) {
int64_t off = offset;
gf_log (THIS->name, GF_LOG_WARNING,
@@ -1805,7 +1805,7 @@ __bd_pwritev (int fd, struct iovec *vector, int count, off_t offset,
vector[index].iov_len = bd_size - internal_offset;
no_space = 1;
}
- retval = sys_pwritev (fd, vector[index].iov_base,
+ retval = pwritev (fd, vector[index].iov_base,
vector[index].iov_len, internal_offset);
if (retval == -1) {
gf_log (THIS->name, GF_LOG_WARNING,
--
1.8.3.1

View File

@ -1,32 +0,0 @@
From c5b4f68e24c718dcbc5f4ebe0094dcb900ac5314 Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Tue, 20 Sep 2016 12:43:43 +0530
Subject: [PATCH 22/74] build: ignore %{sbindir}/conf.py* for RHEL-5
commit dca6f06 has introduced this file in a very wrong location
for a Python file. And rpmbuild is behaving very differently than
RHEL-6 as regards ignoring .pyc and .pyo files.
Label: DOWNSTREAM ONLY
Change-Id: I574a500586162917102ae8eb32b939885d2b2d4c
Signed-off-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index f83ae5e..8f30020 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1118,6 +1118,7 @@ exit 0
%exclude %{_sbindir}/glusterd
%exclude %{_sbindir}/snap_scheduler.py
%exclude %{_datadir}/glusterfs/scripts/stop-all-gluster-processes.sh
+%exclude %{_sbindir}/conf.py*
%if 0%{?_tmpfilesdir:1}
%exclude %{_tmpfilesdir}/gluster.conf
%endif
--
1.8.3.1

View File

@ -1,248 +0,0 @@
From fdf4475ea3598b4287803001932f426f2c58f3b1 Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Fri, 14 Oct 2016 12:53:27 +0530
Subject: [PATCH 23/74] build: randomize temp file names in pretrans scriptlets
Security issue CVE-2015-1795 mentions about possibility of file name
spoof attack for the %pretrans server scriptlet.
Since %pretrans scriptlets are executed only for server builds, we can
use os.tmpname() to randomize temporary file names for all %pretrans
scriptlets using this mechanism.
Label: DOWNSTREAM ONLY
Change-Id: Ic82433897432794b6d311d836355aa4bad886369
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/86187
Reviewed-by: Siddharth Sharma <siddharth@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
glusterfs.spec.in | 106 ++++++++++++++++++++++++++++++++----------------------
1 file changed, 64 insertions(+), 42 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 8f30020..ab61688 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1579,9 +1579,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1620,9 +1621,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-api_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1661,9 +1663,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-api-devel_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1702,9 +1705,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-cli_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1743,9 +1747,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-client-xlators_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1784,9 +1789,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-devel_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1825,9 +1831,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-fuse_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1866,9 +1873,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-ganesha_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1908,9 +1916,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-geo-replication_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1950,9 +1959,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-libs_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -1991,9 +2001,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/python-gluster_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -2033,9 +2044,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-rdma_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -2076,9 +2088,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-resource-agents_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -2118,9 +2131,10 @@ if [ $? -eq 0 ]; then
fi
]]
--- rpm in RHEL5 does not have os.tmpname()
--- io.tmpfile() can not be resolved to a filename to pass to bash :-/
-tmpname = "/tmp/glusterfs-server_pretrans_" .. os.date("%s")
+-- Since we run pretrans scripts only for RPMs built for a server build,
+-- we can now use os.tmpname() since it is available on RHEL6 and later
+-- platforms which are server platforms.
+tmpname = os.tmpname()
tmpfile = io.open(tmpname, "w")
tmpfile:write(script)
tmpfile:close()
@@ -2211,6 +2225,13 @@ end
* Thu Nov 24 2016 Jiffin Tony Thottan <jhottan@redhat.com>
- remove S31ganesha-reset.sh from hooks (#1397795)
+* Fri Oct 14 2016 Milind Changire <mchangir@redhat.com>
+- Changed pretrans scripts to use os.tmpname() for enhanced security
+ for server builds only (#1362044)
+
+* Tue Sep 27 2016 Milind Changire <mchangir@redhat.com>
+- Added systemd requirement to glusterfs-server and glusterfs-events packages
+
* Thu Sep 22 2016 Kaleb S. KEITHLEY <kkeithle@redhat.com>
- python-ctypes no long exists, now in python stdlib (#1378436)
@@ -2330,6 +2351,7 @@ end
* Mon May 18 2015 Milind Changire <mchangir@redhat.com>
- Move file peer_add_secret_pub to the server RPM to support glusterfind (#1221544)
+
* Sun May 17 2015 Niels de Vos <ndevos@redhat.com>
- Fix building on RHEL-5 based distributions (#1222317)
--
1.8.3.1

View File

@ -1,80 +0,0 @@
From abd66a26f1a6fb998c0b6b60c3004ea8414ffee0 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Thu, 17 Nov 2016 12:44:38 +0530
Subject: [PATCH 24/74] glusterd/gNFS : On post upgrade to 3.2, disable gNFS
for all volumes
Currently on 3.2 gNFS is dsiabled for newly created volumes or old volumes
with default value. There will be volumes which have explicitly turn off
nfs.disable option. This change disable gNFS even for that volume as well.
label : DOWNSTREAM ONLY
Change-Id: I4ddeb23690271034b0bbb3fc50b359350b5eae87
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/90425
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 43 +++++++++++++++++-------------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 6d5b8cf..09be165 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2437,26 +2437,33 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
GF_VALIDATE_OR_GOTO (this->name, conf, out);
/* 3.9.0 onwards gNFS will be disabled by default. In case of an upgrade
- * from anything below than 3.9.0 to 3.9.x the volume's dictionary will
- * not have 'nfs.disable' key set which means the same will not be set
- * to on until explicitly done. setnfs.disable to 'on' at op-version
- * bump up flow is the ideal way here. The same is also applicable for
- * transport.address-family where if the transport type is set to tcp
- * then transport.address-family is defaulted to 'inet'.
+ * from anything below than 3.9.0 to 3.9.x, the value for nfs.disable is
+ * set to 'on' for all volumes even if it is explicitly set to 'off' in
+ * previous version. This change is only applicable to downstream code.
+ * Setting nfs.disable to 'on' at op-version bump up flow is the ideal
+ * way here. The same is also applicable for transport.address-family
+ * where if the transport type is set to tcp then transport.address-family
+ * is defaulted to 'inet'.
*/
if (conf->op_version >= GD_OP_VERSION_3_9_0) {
- if (dict_get_str_boolean (volinfo->dict, NFS_DISABLE_MAP_KEY,
- 1)) {
- ret = dict_set_dynstr_with_alloc (volinfo->dict,
- NFS_DISABLE_MAP_KEY,
- "on");
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- GD_MSG_DICT_SET_FAILED, "Failed to set "
- "option ' NFS_DISABLE_MAP_KEY ' on "
- "volume %s", volinfo->volname);
- goto out;
- }
+ if (!(dict_get_str_boolean (volinfo->dict, NFS_DISABLE_MAP_KEY,
+ 0))) {
+ gf_msg (this->name, GF_LOG_INFO, 0, 0, "Gluster NFS is"
+ " being deprecated in favor of NFS-Ganesha, "
+ "hence setting nfs.disable to 'on' for volume "
+ "%s. Please re-enable it if requires",
+ volinfo->volname);
+ }
+
+ ret = dict_set_dynstr_with_alloc (volinfo->dict,
+ NFS_DISABLE_MAP_KEY,
+ "on");
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to set "
+ "option ' NFS_DISABLE_MAP_KEY ' on "
+ "volume %s", volinfo->volname);
+ goto out;
}
ret = dict_get_str (volinfo->dict, "transport.address-family",
&address_family_str);
--
1.8.3.1

View File

@ -1,58 +0,0 @@
From 867536a4ced38d72a7d980cd34bcbf0ce876206a Mon Sep 17 00:00:00 2001
From: Soumya Koduri <skoduri@redhat.com>
Date: Fri, 18 Nov 2016 12:47:06 +0530
Subject: [PATCH 25/74] build: Add dependency on netstat for glusterfs-ganesha
pkg
portblock resource-agent needs netstat command but this dependency
should have been ideally added to resource-agents package. But the
fixes (bug1395594, bug1395596) are going to be available only
in the future RHEL 6.9 and RHEL 7.4 releases. Hence as an interim
workaround, we agreed to add this dependency for glusterfs-ganesha package.
label : DOWNSTREAM ONLY
Change-Id: I6ac1003103755d7534dd079c821bbaacd8dd94b8
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/90529
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
Reviewed-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
glusterfs.spec.in | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index ab61688..343e88f 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -414,6 +414,11 @@ Requires: nfs-ganesha-gluster, pcs, dbus
%if ( 0%{?rhel} && 0%{?rhel} == 6 )
Requires: cman, pacemaker, corosync
%endif
+%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} > 5 )
+# we need portblock resource-agent in 3.9.5 and later.
+Requires: resource-agents >= 3.9.5
+Requires: net-tools
+%endif
%description ganesha
GlusterFS is a distributed file-system capable of scaling to several
@@ -2225,6 +2230,14 @@ end
* Thu Nov 24 2016 Jiffin Tony Thottan <jhottan@redhat.com>
- remove S31ganesha-reset.sh from hooks (#1397795)
+* Fri Nov 18 2016 Soumya Koduri <skoduri@redhat.com>
+- As an interim fix add dependency on netstat(/net-tools) for glusterfs-ganesha package (#1395574)
+
+* Fri Nov 11 2016 Soumya Koduri <skoduri@redhat.com>
+- Add dependency on portblock resource agent for ganesha package (#1278336)
+- Fix incorrect Requires for portblock resource agent (#1278336)
+- Update version checks for portblock resource agent on RHEL (#1278336)
+
* Fri Oct 14 2016 Milind Changire <mchangir@redhat.com>
- Changed pretrans scripts to use os.tmpname() for enhanced security
for server builds only (#1362044)
--
1.8.3.1

View File

@ -1,105 +0,0 @@
From 14bfa98824d40ff1f721a905f8e8ffd557f96eef Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Thu, 15 Dec 2016 17:14:01 +0530
Subject: [PATCH 26/74] glusterd/gNFS : explicitly set "nfs.disable" to "off"
after 3.2 upgrade
Gluster NFS was enabled by default for all volumes till 3.1. But 3.2 onwards
for the new volumes it will be disabled by setting "nfs.disable" to "on".
This take patch will take care of existing volume in such a way that if the
option is not configured, it will set "nfs.disable" to "off" during op-version
bump up.
Also this patch removes the warning message while enabling gluster NFS for
a volume.
label : DOWNSTREAM ONLY
Change-Id: Ib199c3180204f917791b4627c58d846750d18a5a
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/93146
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
cli/src/cli-cmd-parser.c | 14 --------------
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 29 ++++++++++++-----------------
2 files changed, 12 insertions(+), 31 deletions(-)
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index c8ed367..ca4d906 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1621,20 +1621,6 @@ cli_cmd_volume_set_parse (struct cli_state *state, const char **words,
goto out;
}
}
- if ((!strcmp (key, "nfs.disable")) &&
- (!strcmp (value, "off"))) {
- question = "Gluster NFS is being deprecated in favor "
- "of NFS-Ganesha Enter \"yes\" to continue "
- "using Gluster NFS";
- answer = cli_cmd_get_confirmation (state, question);
- if (GF_ANSWER_NO == answer) {
- gf_log ("cli", GF_LOG_ERROR, "Operation "
- "cancelled, exiting");
- *op_errstr = gf_strdup ("Aborted by user.");
- ret = -1;
- goto out;
- }
- }
}
ret = dict_set_int32 (dict, "count", wordcount-3);
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 09be165..0557ad8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2438,9 +2438,9 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
/* 3.9.0 onwards gNFS will be disabled by default. In case of an upgrade
* from anything below than 3.9.0 to 3.9.x, the value for nfs.disable is
- * set to 'on' for all volumes even if it is explicitly set to 'off' in
+ * set to 'off' for all volumes even if it is not explicitly set in the
* previous version. This change is only applicable to downstream code.
- * Setting nfs.disable to 'on' at op-version bump up flow is the ideal
+ * Setting nfs.disable to 'off' at op-version bump up flow is the ideal
* way here. The same is also applicable for transport.address-family
* where if the transport type is set to tcp then transport.address-family
* is defaulted to 'inet'.
@@ -2448,23 +2448,18 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
if (conf->op_version >= GD_OP_VERSION_3_9_0) {
if (!(dict_get_str_boolean (volinfo->dict, NFS_DISABLE_MAP_KEY,
0))) {
- gf_msg (this->name, GF_LOG_INFO, 0, 0, "Gluster NFS is"
- " being deprecated in favor of NFS-Ganesha, "
- "hence setting nfs.disable to 'on' for volume "
- "%s. Please re-enable it if requires",
- volinfo->volname);
+ ret = dict_set_dynstr_with_alloc (volinfo->dict,
+ NFS_DISABLE_MAP_KEY,
+ "off");
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ GD_MSG_DICT_SET_FAILED, "Failed to turn "
+ "off ' NFS_DISABLE_MAP_KEY ' option for "
+ "volume %s", volinfo->volname);
+ goto out;
+ }
}
- ret = dict_set_dynstr_with_alloc (volinfo->dict,
- NFS_DISABLE_MAP_KEY,
- "on");
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, errno,
- GD_MSG_DICT_SET_FAILED, "Failed to set "
- "option ' NFS_DISABLE_MAP_KEY ' on "
- "volume %s", volinfo->volname);
- goto out;
- }
ret = dict_get_str (volinfo->dict, "transport.address-family",
&address_family_str);
if (ret) {
--
1.8.3.1

View File

@ -1,132 +0,0 @@
From 52798b6934ea584b25b1ade64cb52a7439c1b113 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Tue, 3 Jan 2017 18:13:29 +0530
Subject: [PATCH 27/74] glusterd: spawn nfs daemon in op-version bump if
nfs.disable key is absent
3.2.0 onwards gNFS will be disabled by default. However any cluster
upgraded to 3.2.0 with existing volumes exposed over gNFS should
continue to have gNFS access and hence post upgrade gNFS service should
come up after bumping up the op-version. Although the key nfs.disable
was handled and managed correctly in the upgrade path but gNFS daemon
was never spawned in this case.
Fix is to spawn gNFS daemon in op-version bump up code path if
nfs.disable option is not set.
Label : DOWNSTREAM ONLY
Change-Id: Icac6f3653160f79b271f25f5df0c89690917e702
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/94006
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
Reviewed-by: Samikshan Bairagya <sbairagy@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-messages.h | 8 ++++++
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 35 ++++++++++++++++++++++++---
2 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index 65d4353..8bb4c43 100644
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
@@ -4937,6 +4937,14 @@
*/
#define GD_MSG_GARBAGE_ARGS (GLUSTERD_COMP_BASE + 611)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_SVC_START_FAIL (GLUSTERD_COMP_BASE + 590)
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 0557ad8..4fc719a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2423,7 +2423,8 @@ out:
}
static int
-glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
+glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo,
+ gf_boolean_t *start_nfs_svc)
{
int ret = -1;
xlator_t *this = NULL;
@@ -2436,6 +2437,8 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
conf = this->private;
GF_VALIDATE_OR_GOTO (this->name, conf, out);
+ ret = 0;
+
/* 3.9.0 onwards gNFS will be disabled by default. In case of an upgrade
* from anything below than 3.9.0 to 3.9.x, the value for nfs.disable is
* set to 'off' for all volumes even if it is not explicitly set in the
@@ -2458,6 +2461,12 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
"volume %s", volinfo->volname);
goto out;
}
+ /* If the volume is started then mark start_nfs_svc to
+ * true such that nfs daemon can be spawned up
+ */
+ if (GLUSTERD_STATUS_STARTED == volinfo->status)
+ *start_nfs_svc = _gf_true;
+
}
ret = dict_get_str (volinfo->dict, "transport.address-family",
@@ -2478,9 +2487,12 @@ glusterd_update_volumes_dict (glusterd_volinfo_t *volinfo)
}
}
}
+ ret = glusterd_store_volinfo (volinfo,
+ GLUSTERD_VOLINFO_VER_AC_INCREMENT);
+ if (ret)
+ goto out;
+
}
- ret = glusterd_store_volinfo (volinfo,
- GLUSTERD_VOLINFO_VER_AC_INCREMENT);
out:
return ret;
@@ -2529,6 +2541,7 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
uint32_t op_version = 0;
glusterd_volinfo_t *volinfo = NULL;
glusterd_svc_t *svc = NULL;
+ gf_boolean_t start_nfs_svc = _gf_false;
conf = this->private;
ret = dict_get_str (dict, "key1", &key);
@@ -2645,6 +2658,22 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
"Failed to store op-version.");
}
}
+ cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
+ ret = glusterd_update_volumes_dict (volinfo,
+ &start_nfs_svc);
+ if (ret)
+ goto out;
+ }
+ if (start_nfs_svc) {
+ ret = conf->nfs_svc.manager (&(conf->nfs_svc), NULL,
+ PROC_START_NO_WAIT);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_START_FAIL,
+ "unable to start nfs service");
+ goto out;
+ }
+ }
/* No need to save cluster.op-version in conf->opts
*/
goto out;
--
1.8.3.1

View File

@ -1,42 +0,0 @@
From 91489431c48f6fa9bce3ee6f377bc9702602b18d Mon Sep 17 00:00:00 2001
From: Poornima G <pgurusid@redhat.com>
Date: Wed, 26 Apr 2017 14:07:58 +0530
Subject: [PATCH 28/74] glusterd, parallel-readdir: Change the op-version of
parallel-readdir to 31100
Issue: Downstream 3.2 was released with op-version 31001, parallel-readdir
feature in upstream was released in 3.10 and hence with op-version 31000.
With this, parallel-readdir will be allowed in 3.2 cluster/clients as well.
But 3.2 didn't have parallel-readdir feature backported.
Fix:
Increase the op-version of parallel-readdir feature only in downstream
to 31100(3.3 highest op-version)
Label: DOWNSTREAM ONLY
Change-Id: I2640520985627f3a1cb4fb96e28350f8bb9b146c
Signed-off-by: Poornima G <pgurusid@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/104403
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 93ef85c..9729767 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -3376,7 +3376,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.option = "parallel-readdir",
.value = "off",
.type = DOC,
- .op_version = GD_OP_VERSION_3_10_0,
+ .op_version = GD_OP_VERSION_3_11_0,
.validate_fn = validate_parallel_readdir,
.description = "If this option is enabled, the readdir operation "
"is performed in parallel on all the bricks, thus "
--
1.8.3.1

View File

@ -1,68 +0,0 @@
From 7562ffbce9d768d5af9d23361cf6dd6ef992bead Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Fri, 10 Nov 2017 23:38:14 +0530
Subject: [PATCH 29/74] build: exclude glusterfssharedstorage.service and
mount-shared-storage.sh from client builds
Label: DOWNSTREAM ONLY
Change-Id: I7d76ba0742b5c6a44505eb883eacda0c91efbe51
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/109684
Reviewed-by: Milind Changire <mchangir@redhat.com>
Tested-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
glusterfs.spec.in | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 343e88f..4596e3f 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1083,6 +1083,20 @@ exit 0
%exclude %{_libexecdir}/glusterfs/glusterfind
%exclude %{_bindir}/glusterfind
%exclude %{_libexecdir}/glusterfs/peer_add_secret_pub
+# exclude eventsapi files
+%exclude %{_sysconfdir}/glusterfs/eventsconfig.json
+%exclude %{_sharedstatedir}/glusterd/events
+%exclude %{_libexecdir}/glusterfs/events
+%exclude %{_libexecdir}/glusterfs/peer_eventsapi.py*
+%exclude %{_sbindir}/glustereventsd
+%exclude %{_sbindir}/gluster-eventsapi
+%exclude %{_datadir}/glusterfs/scripts/eventsdash.py*
+%if ( 0%{?_with_systemd:1} )
+%exclude %{_unitdir}/glustereventsd.service
+%exclude %_init_glusterfssharedstorage
+%else
+%exclude %{_sysconfdir}/init.d/glustereventsd
+%endif
# exclude server files
%exclude %{_sharedstatedir}/glusterd/*
%exclude %{_sysconfdir}/glusterfs
@@ -1123,6 +1137,9 @@ exit 0
%exclude %{_sbindir}/glusterd
%exclude %{_sbindir}/snap_scheduler.py
%exclude %{_datadir}/glusterfs/scripts/stop-all-gluster-processes.sh
+%if ( 0%{?_with_systemd:1} )
+%exclude %{_libexecdir}/glusterfs/mount-shared-storage.sh
+%endif
%exclude %{_sbindir}/conf.py*
%if 0%{?_tmpfilesdir:1}
%exclude %{_tmpfilesdir}/gluster.conf
@@ -2181,7 +2198,10 @@ end
* Thu Jul 13 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>
- various directories not owned by any package
-* Fri Jun 16 2017 Jiffin Tony Thottan <jthottan@redhat.com>
+* Wed Jun 21 2017 Jiffin Tony Thottan <jthottan@redhat.com>
+- Exclude glusterfssharedstorage.service and mount-shared-storage.sh from client builds
+
+* Tue Jun 20 2017 Jiffin Tony Thottan <jthottan@redhat.com>
- Add glusterfssharedstorage.service systemd file
* Fri Jun 9 2017 Poornima G <pgurusid@redhat.com>
--
1.8.3.1

View File

@ -1,50 +0,0 @@
From 8279b8c5f23cddd1b7db59c56ed2d8896ac49aa7 Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Tue, 4 Jul 2017 17:10:27 +0530
Subject: [PATCH 30/74] build: make gf_attach available in glusterfs-server
Problem:
gf_attach was erroneously packaged in glusterfs-fuse
Solution:
move gf_attach listing to server package
add gf_attach to the exclude listing for client builds
Label: DOWNSTREAM ONLY
Change-Id: I0de45700badcbab65febf2385f1ac074c44cfa7c
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/111001
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
glusterfs.spec.in | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 4596e3f..600fa6e 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1135,6 +1135,7 @@ exit 0
%exclude %{_sbindir}/gcron.py
%exclude %{_sbindir}/glfsheal
%exclude %{_sbindir}/glusterd
+%exclude %{_sbindir}/gf_attach
%exclude %{_sbindir}/snap_scheduler.py
%exclude %{_datadir}/glusterfs/scripts/stop-all-gluster-processes.sh
%if ( 0%{?_with_systemd:1} )
@@ -2198,6 +2199,12 @@ end
* Thu Jul 13 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>
- various directories not owned by any package
+* Tue Jul 04 2017 Milind Changire <mchangir@redhat.com>
+- moved %{_sbindir}/gf_attach from glusterfs-fuse to glusterfs-server
+
+* Fri Jun 23 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>
+- DOWNSTREAM ONLY remove Requires: selinux-policy for puddle generation
+
* Wed Jun 21 2017 Jiffin Tony Thottan <jthottan@redhat.com>
- Exclude glusterfssharedstorage.service and mount-shared-storage.sh from client builds
--
1.8.3.1

View File

@ -1,37 +0,0 @@
From e1f21c716b9a9f245e8ad2c679fb12fd86c8655e Mon Sep 17 00:00:00 2001
From: Samikshan Bairagya <sbairagy@redhat.com>
Date: Mon, 10 Jul 2017 11:54:52 +0530
Subject: [PATCH 31/74] glusterd: Revert op-version for
"cluster.max-brick-per-process"
The op-version for the "cluster.max-brick-per-process" option was
set to 3.12.0 in the upstream patch and was backported here:
https://code.engineering.redhat.com/gerrit/#/c/111799. This commit
reverts the op-version for this option to 3.11.1 instead.
Label: DOWNSTREAM ONLY
Change-Id: I23639cef43d41915eea0394d019b1e0796a99d7b
Signed-off-by: Samikshan Bairagya <sbairagy@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/111804
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 9729767..2210b82 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -3449,7 +3449,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
{ .key = GLUSTERD_BRICKMUX_LIMIT_KEY,
.voltype = "mgmt/glusterd",
.value = "0",
- .op_version = GD_OP_VERSION_3_12_0,
+ .op_version = GD_OP_VERSION_3_11_1,
.validate_fn = validate_mux_limit,
.type = GLOBAL_DOC,
.description = "This option can be used to limit the number of brick "
--
1.8.3.1

View File

@ -1,56 +0,0 @@
From 472aebd90fb081db85b00491ce7034a9b971f4e1 Mon Sep 17 00:00:00 2001
From: Samikshan Bairagya <sbairagy@redhat.com>
Date: Wed, 9 Aug 2017 14:32:59 +0530
Subject: [PATCH 32/74] cli: Add message for user before modifying
brick-multiplex option
Users should ne notified that brick-multiplexing feature is
supported only for container workloads (CNS/CRS). It should also be
made known to users that it is advisable to either have all volumes
in stopped state or have no bricks running before modifying the
"brick-multiplex" option. This commit makes sure these messages
are displayed to the user before brick-multiplexing is enabled or
disabled.
Label: DOWNSTREAM ONLY
Change-Id: Ic40294b26c691ea03185c4d1fce840ef23f95718
Signed-off-by: Samikshan Bairagya <sbairagy@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/114793
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
cli/src/cli-cmd-parser.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index ca4d906..216e050 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1621,6 +1621,24 @@ cli_cmd_volume_set_parse (struct cli_state *state, const char **words,
goto out;
}
}
+
+ if ((strcmp (key, "cluster.brick-multiplex") == 0)) {
+ question = "Brick-multiplexing is supported only for "
+ "container workloads (CNS/CRS). Also it is "
+ "advised to make sure that either all "
+ "volumes are in stopped state or no bricks "
+ "are running before this option is modified."
+ "Do you still want to continue?";
+
+ answer = cli_cmd_get_confirmation (state, question);
+ if (GF_ANSWER_NO == answer) {
+ gf_log ("cli", GF_LOG_ERROR, "Operation "
+ "cancelled, exiting");
+ *op_errstr = gf_strdup ("Aborted by user.");
+ ret = -1;
+ goto out;
+ }
+ }
}
ret = dict_set_int32 (dict, "count", wordcount-3);
--
1.8.3.1

View File

@ -1,114 +0,0 @@
From 1ce0b65090c888b0e2b28cab03731674f4988aeb Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Tue, 10 Oct 2017 09:58:24 +0530
Subject: [PATCH 33/74] build: launch glusterd upgrade after all new bits are
installed
Problem:
glusterd upgrade mode needs new bits from glusterfs-rdma which
optional and causes the dependency graph to break since it is
not tied into glusterfs-server requirements
Solution:
Run glusterd upgrade mode after all new bits are installed
i.e. in %posttrans server section
Label: DOWNSTREAM ONLY
Change-Id: I356e02d0bf0eaaef43c20ce07b388262f63093a4
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/120094
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
---
glusterfs.spec.in | 56 ++++++++++++++++++++++++++++++++++---------------------
1 file changed, 35 insertions(+), 21 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 600fa6e..f4386de 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -963,27 +963,6 @@ fi
%firewalld_reload
%endif
-pidof -c -o %PPID -x glusterd &> /dev/null
-if [ $? -eq 0 ]; then
- kill -9 `pgrep -f gsyncd.py` &> /dev/null
-
- killall --wait glusterd &> /dev/null
- glusterd --xlator-option *.upgrade=on -N
-
- #Cleaning leftover glusterd socket file which is created by glusterd in
- #rpm_script_t context.
- rm -f %{_rundir}/glusterd.socket
-
- # glusterd _was_ running, we killed it, it exited after *.upgrade=on,
- # so start it again
- %_init_start glusterd
-else
- glusterd --xlator-option *.upgrade=on -N
-
- #Cleaning leftover glusterd socket file which is created by glusterd in
- #rpm_script_t context.
- rm -f %{_rundir}/glusterd.socket
-fi
%endif
##-----------------------------------------------------------------------------
@@ -2166,6 +2145,35 @@ os.remove(tmpname)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
+
+%posttrans server
+pidof -c -o %PPID -x glusterd &> /dev/null
+if [ $? -eq 0 ]; then
+ kill -9 `pgrep -f gsyncd.py` &> /dev/null
+
+ killall --wait -SIGTERM glusterd &> /dev/null
+
+ if [ "$?" != "0" ]; then
+ echo "killall failed while killing glusterd"
+ fi
+
+ glusterd --xlator-option *.upgrade=on -N
+
+ #Cleaning leftover glusterd socket file which is created by glusterd in
+ #rpm_script_t context.
+ rm -rf /var/run/glusterd.socket
+
+ # glusterd _was_ running, we killed it, it exited after *.upgrade=on,
+ # so start it again
+ %_init_start glusterd
+else
+ glusterd --xlator-option *.upgrade=on -N
+
+ #Cleaning leftover glusterd socket file which is created by glusterd in
+ #rpm_script_t context.
+ rm -rf /var/run/glusterd.socket
+fi
+
%endif
# Events
@@ -2190,9 +2198,15 @@ end
%endif
%changelog
+* Tue Oct 10 2017 Milind Changire <mchangir@redhat.com>
+- DOWNSTREAM ONLY patch - launch glusterd in upgrade mode after all new bits have been installed
+
* Tue Aug 22 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>
- libibverbs-devel, librdmacm-devel -> rdma-core-devel #1483996
+* Fri Aug 04 2017 Kaleb S. KEITHLEY <kkeithle@rehat.com>
+- /var/lib/glusterd/options made config(noreplace) to avoid losing shared state info
+
* Thu Jul 20 2017 Aravinda VK <avishwan@redhat.com>
- Added new tool/binary to set the gfid2path xattr on files
--
1.8.3.1

View File

@ -1,76 +0,0 @@
From 58e52a8862aff553a883ee8b554f38baa2bda9a6 Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Tue, 7 Nov 2017 18:32:59 +0530
Subject: [PATCH 34/74] build: remove pretrans script for python-gluster
Remove pretrans scriptlet for python-gluster.
Label: DOWNSTREAM ONLY
Change-Id: Iee006354c596aedbd70438a3bdd583de28837190
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/122556
Reviewed-by: Prashanth Pai <ppai@redhat.com>
Reviewed-by: Aravinda Vishwanathapura Krishna Murthy <avishwan@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
---
glusterfs.spec.in | 42 ------------------------------------------
1 file changed, 42 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index f4386de..8c16477 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1976,48 +1976,6 @@ end
-%pretrans -n python-gluster -p <lua>
-if not posix.access("/bin/bash", "x") then
- -- initial installation, no shell, no running glusterfsd
- return 0
-end
-
--- TODO: move this completely to a lua script
--- For now, we write a temporary bash script and execute that.
-
-script = [[#!/bin/sh
-pidof -c -o %PPID -x glusterfsd &>/dev/null
-
-if [ $? -eq 0 ]; then
- pushd . > /dev/null 2>&1
- for volume in /var/lib/glusterd/vols/*; do cd $volume;
- vol_type=`grep '^type=' info | awk -F'=' '{print $2}'`
- volume_started=`grep '^status=' info | awk -F'=' '{print $2}'`
- if [ $vol_type -eq 0 ] && [ $volume_started -eq 1 ] ; then
- exit 1;
- fi
- done
-
- popd > /dev/null 2>&1
- exit 1;
-fi
-]]
-
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
-if not (ok == 0) then
- error("Detected running glusterfs processes", ok)
-end
-
-
-
%if ( 0%{!?_without_rdma:1} )
%pretrans rdma -p <lua>
if not posix.access("/bin/bash", "x") then
--
1.8.3.1

View File

@ -1,99 +0,0 @@
From 88ed6bd3e752a028b5372aa948a191fa49377459 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Fri, 10 Nov 2017 19:17:27 +0530
Subject: [PATCH 35/74] glusterd: regenerate volfiles on op-version bump up
Please note that LOC of downstream patch differs because of a
downstream only fix https://code.engineering.redhat.com/gerrit/94006
Label: DOWNSTREAM ONLY
>Reviewed-on: https://review.gluster.org/16455
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Prashanth Pai <ppai@redhat.com>
>Reviewed-by: Kaushal M <kaushal@redhat.com>
Change-Id: I2fe7a3ebea19492d52253ad5a1fdd67ac95c71c8
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/96368
Reviewed-by: Samikshan Bairagya <sbairagy@redhat.com>
Reviewed-by: Prashanth Pai <ppai@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 38 ++++++++++--------------------
1 file changed, 13 insertions(+), 25 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 4fc719a..96e0860 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2612,7 +2612,8 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
NULL);
if (ret)
goto out;
- ret = glusterd_update_volumes_dict (volinfo);
+ ret = glusterd_update_volumes_dict
+ (volinfo, &start_nfs_svc);
if (ret)
goto out;
if (!volinfo->is_snap_volume) {
@@ -2622,14 +2623,6 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
if (ret)
goto out;
}
-
- if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
- svc = &(volinfo->tierd.svc);
- ret = svc->reconfigure (volinfo);
- if (ret)
- goto out;
- }
-
ret = glusterd_create_volfiles_and_notify_services (volinfo);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
@@ -2651,6 +2644,17 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
}
}
}
+ if (start_nfs_svc) {
+ ret = conf->nfs_svc.manager (&(conf->nfs_svc),
+ NULL,
+ PROC_START_NO_WAIT);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_START_FAIL,
+ "unable to start nfs service");
+ goto out;
+ }
+ }
ret = glusterd_store_global_info (this);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
@@ -2658,22 +2662,6 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,
"Failed to store op-version.");
}
}
- cds_list_for_each_entry (volinfo, &conf->volumes, vol_list) {
- ret = glusterd_update_volumes_dict (volinfo,
- &start_nfs_svc);
- if (ret)
- goto out;
- }
- if (start_nfs_svc) {
- ret = conf->nfs_svc.manager (&(conf->nfs_svc), NULL,
- PROC_START_NO_WAIT);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_SVC_START_FAIL,
- "unable to start nfs service");
- goto out;
- }
- }
/* No need to save cluster.op-version in conf->opts
*/
goto out;
--
1.8.3.1

View File

@ -1,50 +0,0 @@
From b5f16e56bd1a9e64fa461f22f24790992fd2c008 Mon Sep 17 00:00:00 2001
From: Mohammed Rafi KC <rkavunga@redhat.com>
Date: Thu, 12 Oct 2017 14:31:14 +0530
Subject: [PATCH 36/74] mount/fuse : Fix parsing of vol_id for snapshot volume
For supporting sub-dir mount, we changed the volid. Which means anything
after a '/' in volume_id will be considered as sub-dir path.
But snapshot volume has vol_id stracture of /snaps/<volname>/<snapname>
which has to be considered as during the parsing.
Note 1: sub-dir mount is not supported on snapshot volume
Note 2: With sub-dir mount changes brick based mount for quota cannot be
executed via mount command. It has to be a direct call via glusterfs
Backport of>
>Change-Id: I0d824de0236b803db8a918f683dabb0cb523cb04
>BUG: 1501235
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
>Upstream patch : https://review.gluster.org/18506
Change-Id: I82903bdd0bfcf8454faef958b38f13d4d95a2346
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/120524
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mount/fuse/utils/mount.glusterfs.in | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index bd6503a..36b60ff 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -675,8 +675,10 @@ main ()
[ ${first_char} = '/' ] && {
volume_str_temp=$(echo "$volume_str" | cut -c 2-)
}
- [ $(echo $volume_str_temp | grep -c "/") -eq 1 ] && {
- volume_id=$(echo "$volume_str_temp" | cut -f1 -d '/');
+ volume_id_temp=$(echo "$volume_str_temp" | cut -f1 -d '/');
+ [ $(echo $volume_str_temp | grep -c "/") -eq 1 ] &&
+ [ "$volume_id_temp" != "snaps" ] && {
+ volume_id=$volume_id_temp;
subdir_mount=$(echo "$volume_str_temp" | cut -f2- -d '/');
}
}
--
1.8.3.1

View File

@ -1,141 +0,0 @@
From 6d6e3a4100fcb9333d82618d64e96e49ddddcbf4 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Mon, 16 Oct 2017 11:44:59 +0530
Subject: [PATCH 37/74] protocol-auth: use the proper validation method
Currently, server protocol's init and glusterd's option
validation methods are different, causing an issue. They
should be same for having consistent behavior
> Upstream:
> Change-Id: Ibbf9a18c7192b2d77f9b7675ae7da9b8d2fe5de4
> URL: https://review.gluster.org/#/c/18489/
Change-Id: Id595a1032b14233ca8f31d20813dca98476b2468
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/120558
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
libglusterfs/src/options.c | 4 ++--
libglusterfs/src/options.h | 5 +++++
tests/features/subdir-mount.t | 4 ++++
xlators/protocol/server/src/server.c | 40 +++++++-----------------------------
4 files changed, 18 insertions(+), 35 deletions(-)
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c
index f0292ea..a0f04c7 100644
--- a/libglusterfs/src/options.c
+++ b/libglusterfs/src/options.c
@@ -590,7 +590,7 @@ xlator_option_validate_addr (xlator_t *xl, const char *key, const char *value,
return ret;
}
-static int
+int
xlator_option_validate_addr_list (xlator_t *xl, const char *key,
const char *value, volume_option_t *opt,
char **op_errstr)
@@ -668,7 +668,7 @@ xlator_option_validate_addr_list (xlator_t *xl, const char *key,
out:
if (ret) {
snprintf (errstr, sizeof (errstr), "option %s %s: '%s' is not "
- "a valid internet-address-list", key, value, value);
+ "a valid internet-address-list", key, value, value);
gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s",
errstr);
if (op_errstr)
diff --git a/libglusterfs/src/options.h b/libglusterfs/src/options.h
index 3154dce..d259d44 100644
--- a/libglusterfs/src/options.h
+++ b/libglusterfs/src/options.h
@@ -87,6 +87,11 @@ int xlator_options_validate_list (xlator_t *xl, dict_t *options,
int xlator_option_validate (xlator_t *xl, char *key, char *value,
volume_option_t *opt, char **op_errstr);
int xlator_options_validate (xlator_t *xl, dict_t *options, char **errstr);
+
+int xlator_option_validate_addr_list (xlator_t *xl, const char *key,
+ const char *value, volume_option_t *opt,
+ char **op_errstr);
+
volume_option_t *
xlator_volume_option_get (xlator_t *xl, const char *key);
diff --git a/tests/features/subdir-mount.t b/tests/features/subdir-mount.t
index 2fb0be4..ab7ef35 100644
--- a/tests/features/subdir-mount.t
+++ b/tests/features/subdir-mount.t
@@ -78,6 +78,10 @@ TEST ! $CLI volume set $V0 auth.allow "subdir2\(1.2.3.4\)"
# support subdir inside subdir
TEST $CLI volume set $V0 auth.allow '/subdir1/subdir1.1/subdir1.2/\(1.2.3.4\|::1\),/\(192.168.10.1\|192.168.11.1\),/subdir2\(1.2.3.4\)'
+TEST $CLI volume stop $V0
+
+TEST $CLI volume start $V0
+
# /subdir2 has not allowed IP
TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M1
TEST stat $M1
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index e47acb2..6dc9d0f 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -386,9 +386,6 @@ _check_for_auth_option (dict_t *d, char *k, data_t *v,
int ret = 0;
xlator_t *xl = NULL;
char *tail = NULL;
- char *tmp_addr_list = NULL;
- char *addr = NULL;
- char *tmp_str = NULL;
xl = tmp;
@@ -417,38 +414,15 @@ _check_for_auth_option (dict_t *d, char *k, data_t *v,
* valid auth.allow.<xlator>
* Now we verify the ip address
*/
- if (!strcmp (v->data, "*")) {
- ret = 0;
- goto out;
- }
-
- /* TODO-SUBDIR-MOUNT: fix the format */
- tmp_addr_list = gf_strdup (v->data);
- addr = strtok_r (tmp_addr_list, ",", &tmp_str);
- if (!addr)
- addr = v->data;
-
- while (addr) {
- if (valid_internet_address (addr, _gf_true)) {
- ret = 0;
- } else {
- ret = -1;
- gf_msg (xl->name, GF_LOG_ERROR, 0,
- PS_MSG_INTERNET_ADDR_ERROR,
- "internet address '%s'"
- " does not conform to"
- " standards.", addr);
- goto out;
- }
- if (tmp_str)
- addr = strtok_r (NULL, ",", &tmp_str);
- else
- addr = NULL;
- }
+ ret = xlator_option_validate_addr_list (xl, "auth-*", v->data,
+ NULL, NULL);
+ if (ret)
+ gf_msg (xl->name, GF_LOG_ERROR, 0,
+ PS_MSG_INTERNET_ADDR_ERROR,
+ "internet address '%s' does not conform "
+ "to standards.", v->data);
}
out:
- GF_FREE (tmp_addr_list);
-
return ret;
}
--
1.8.3.1

View File

@ -1,111 +0,0 @@
From 4fd6388cf08d9c902f20683579d62408847c3766 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Mon, 23 Oct 2017 21:17:52 +0200
Subject: [PATCH 38/74] protocol/server: fix the comparision logic in case of
subdir mount
without the fix, the stat entry on a file would return inode==1 for
many files, in case of subdir mount
This happened with the confusion of return value of 'gf_uuid_compare()',
it is more like strcmp, instead of a gf_boolean return value, and hence
resulted in the bug.
> Upstream:
> URL: https://review.gluster.org/#/c/18558/
>
Also fixes the bz1501714
Change-Id: I31b8cbd95eaa3af5ff916a969458e8e4020c86bb
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/121726
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/protocol/server/src/server-common.c | 60 ++++++++++++++---------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/xlators/protocol/server/src/server-common.c b/xlators/protocol/server/src/server-common.c
index b972918..ce33089 100644
--- a/xlators/protocol/server/src/server-common.c
+++ b/xlators/protocol/server/src/server-common.c
@@ -12,22 +12,22 @@
void
server_post_stat (server_state_t *state, gfs3_stat_rsp *rsp, struct iatt *stbuf)
{
- if (state->client->subdir_mount) {
- if (gf_uuid_compare (stbuf->ia_gfid,
- state->client->subdir_gfid)) {
- /* This is very important as when we send iatt of
- root-inode, fuse/client expect the gfid to be 1,
- along with inode number. As for subdirectory mount,
- we use inode table which is shared by everyone, but
- make sure we send fops only from subdir and below,
- we have to alter inode gfid and send it to client */
- uuid_t gfid = {0,};
-
- gfid[15] = 1;
- stbuf->ia_ino = 1;
- gf_uuid_copy (stbuf->ia_gfid, gfid);
- }
+ if (state->client->subdir_mount &&
+ !gf_uuid_compare (stbuf->ia_gfid,
+ state->client->subdir_gfid)) {
+ /* This is very important as when we send iatt of
+ root-inode, fuse/client expect the gfid to be 1,
+ along with inode number. As for subdirectory mount,
+ we use inode table which is shared by everyone, but
+ make sure we send fops only from subdir and below,
+ we have to alter inode gfid and send it to client */
+ uuid_t gfid = {0,};
+
+ gfid[15] = 1;
+ stbuf->ia_ino = 1;
+ gf_uuid_copy (stbuf->ia_gfid, gfid);
}
+
gf_stat_from_iatt (&rsp->stat, stbuf);
}
@@ -185,22 +185,22 @@ void
server_post_fstat (server_state_t *state, gfs3_fstat_rsp *rsp,
struct iatt *stbuf)
{
- if (state->client->subdir_mount) {
- if (gf_uuid_compare (stbuf->ia_gfid,
- state->client->subdir_gfid)) {
- /* This is very important as when we send iatt of
- root-inode, fuse/client expect the gfid to be 1,
- along with inode number. As for subdirectory mount,
- we use inode table which is shared by everyone, but
- make sure we send fops only from subdir and below,
- we have to alter inode gfid and send it to client */
- uuid_t gfid = {0,};
-
- gfid[15] = 1;
- stbuf->ia_ino = 1;
- gf_uuid_copy (stbuf->ia_gfid, gfid);
- }
+ if (state->client->subdir_mount &&
+ !gf_uuid_compare (stbuf->ia_gfid,
+ state->client->subdir_gfid)) {
+ /* This is very important as when we send iatt of
+ root-inode, fuse/client expect the gfid to be 1,
+ along with inode number. As for subdirectory mount,
+ we use inode table which is shared by everyone, but
+ make sure we send fops only from subdir and below,
+ we have to alter inode gfid and send it to client */
+ uuid_t gfid = {0,};
+
+ gfid[15] = 1;
+ stbuf->ia_ino = 1;
+ gf_uuid_copy (stbuf->ia_gfid, gfid);
}
+
gf_stat_from_iatt (&rsp->stat, stbuf);
}
--
1.8.3.1

View File

@ -1,108 +0,0 @@
From 0f3a3c9ed32fec80f1b88cc649a98bcdcc234b6a Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Sun, 22 Oct 2017 12:41:38 +0530
Subject: [PATCH 39/74] protocol/client: handle the subdir handshake properly
for add-brick
There should be different way we handle handshake in case of subdir
mount for the first time, and in case of subsequent graph changes.
> Upstream
> URL: https://review.gluster.org/#/c/18550/
>
Change-Id: I2a7ba836433bb0a0f4a861809e2bb0d7fbc4da54
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/121725
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
tests/features/subdir-mount.t | 31 +++++++++++++++++++++-----
xlators/protocol/client/src/client-handshake.c | 10 ++++++++-
2 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/tests/features/subdir-mount.t b/tests/features/subdir-mount.t
index ab7ef35..1742f86 100644
--- a/tests/features/subdir-mount.t
+++ b/tests/features/subdir-mount.t
@@ -82,17 +82,38 @@ TEST $CLI volume stop $V0
TEST $CLI volume start $V0
-# /subdir2 has not allowed IP
-TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M1
-TEST stat $M1
-
TEST $GFS --subdir-mount /subdir1/subdir1.1/subdir1.2 -s $H0 --volfile-id $V0 $M2
TEST stat $M2
+# mount shouldn't fail even after add-brick
+TEST $CLI volume add-brick $V0 replica 2 $H0:$B0/${V0}{5,6};
+
+# Give time for client process to get notified and use the new
+# volfile after add-brick
+sleep 1
+
+# Existing mount should still be active
+mount_inode=$(stat --format "%i" "$M2")
+TEST test "$mount_inode" == "1"
+
+TEST umount $M2
+
+# because the subdir is not yet 'healed', below should fail.
+TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M2
+mount_inode=$(stat --format "%i" "$M2")
+TEST test "$mount_inode" != "1"
+
+# Allow the heal to complete
+TEST stat $M0/subdir1/subdir1.1/subdir1.2/subdir1.2_file;
+TEST stat $M0/subdir2/
+
+# Now the mount should succeed
+TEST $GFS --subdir-mount /subdir2 -s $H0 --volfile-id $V0 $M1
+TEST stat $M1
+
# umount $M1 / $M2
TEST umount $M0
TEST umount $M1
-TEST umount $M2
TEST $CLI volume stop $V0;
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index b6dc079..aee6b3a 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -1079,10 +1079,14 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
int32_t op_errno = 0;
gf_boolean_t auth_fail = _gf_false;
uint32_t lk_ver = 0;
+ glusterfs_ctx_t *ctx = NULL;
frame = myframe;
this = frame->this;
conf = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, conf, out);
+ ctx = this->ctx;
+ GF_VALIDATE_OR_GOTO (this->name, ctx, out);
if (-1 == req->rpc_status) {
gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
@@ -1145,9 +1149,13 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
auth_fail = _gf_true;
op_ret = 0;
}
- if ((op_errno == ENOENT) && this->ctx->cmd_args.subdir_mount) {
+ if ((op_errno == ENOENT) && this->ctx->cmd_args.subdir_mount &&
+ (ctx->graph_id <= 1)) {
/* A case of subdir not being present at the moment,
ride on auth_fail framework to notify the error */
+ /* Make sure this case is handled only in the new
+ graph, so mount may fail in this case. In case
+ of 'add-brick' etc, we need to continue retry */
auth_fail = _gf_true;
op_ret = 0;
}
--
1.8.3.1

View File

@ -1,69 +0,0 @@
From 8fb2496f67b1170595144eecb9a3b8f3be35044e Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Mon, 30 Oct 2017 15:55:32 +0530
Subject: [PATCH 40/74] glusterd: delete source brick only once in reset-brick
commit force
While stopping the brick which is to be reset and replaced delete_brick
flag was passed as true which resulted glusterd to free up to source
brick before the actual operation. This results commit force to fail
failing to find the source brickinfo.
>upstream patch : https://review.gluster.org/#/c/18581
Change-Id: I1aa7508eff7cc9c9b5d6f5163f3bb92736d6df44
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/121876
Tested-by: RHGS Build Bot <nigelb@redhat.com>
---
.../bug-1507466-reset-brick-commit-force.t | 24 ++++++++++++++++++++++
xlators/mgmt/glusterd/src/glusterd-reset-brick.c | 2 +-
2 files changed, 25 insertions(+), 1 deletion(-)
create mode 100644 tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t
diff --git a/tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t b/tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t
new file mode 100644
index 0000000..764399d
--- /dev/null
+++ b/tests/bugs/glusterd/bug-1507466-reset-brick-commit-force.t
@@ -0,0 +1,24 @@
+#!/bin/bash
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../cluster.rc
+cleanup;
+
+function check_peers {
+ $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
+}
+
+TEST launch_cluster 3
+TEST $CLI_1 peer probe $H2;
+EXPECT_WITHIN $PROBE_TIMEOUT 1 check_peers
+
+TEST $CLI_1 volume create $V0 replica 2 $H1:$B0/${V0} $H2:$B0/${V0}
+TEST $CLI_1 volume start $V0
+
+# Negative case with brick not killed && volume-id xattrs present
+TEST ! $CLI_1 volume reset-brick $V0 $H1:$B0/${V0} $H1:$B0/${V0} commit force
+
+TEST $CLI_1 volume reset-brick $V0 $H1:$B0/${V0} start
+# Now test if reset-brick commit force works
+TEST $CLI_1 volume reset-brick $V0 $H1:$B0/${V0} $H1:$B0/${V0} commit force
+
+cleanup;
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
index c127d64..abb44e0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
@@ -343,7 +343,7 @@ glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict)
gf_msg_debug (this->name, 0, "I AM THE DESTINATION HOST");
ret = glusterd_volume_stop_glusterfs (volinfo,
src_brickinfo,
- _gf_true);
+ _gf_false);
if (ret) {
gf_msg (this->name, GF_LOG_CRITICAL, 0,
GD_MSG_BRICK_STOP_FAIL,
--
1.8.3.1

View File

@ -1,193 +0,0 @@
From 548895f0333a0706ec9475efc3b28456d591f093 Mon Sep 17 00:00:00 2001
From: Gaurav Yadav <gyadav@redhat.com>
Date: Fri, 27 Oct 2017 16:04:46 +0530
Subject: [PATCH 41/74] glusterd: persist brickinfo's port change into
glusterd's store
Problem:
Consider a case where node reboot is performed and prior to reboot
brick was listening to 49153. Post reboot glusterd assigned 49152
to brick and started the brick process but the new port was never
persisted. Now when glusterd restarts glusterd always read the port
from its persisted store i.e 49153 however pmap signin happens with
the correct port i.e 49152.
Fix:
Make sure when glusterd_brick_start is called, glusterd_store_volinfo is
eventually invoked.
>upstream mainline patch : https://review.gluster.org/#/c/18579/
Change-Id: Ic0efbd48c51d39729ed951a42922d0e59f7115a1
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/121878
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-handshake.c | 18 +++++++++---------
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 9 ++++++++-
xlators/mgmt/glusterd/src/glusterd-server-quorum.c | 16 ++++++++++++++++
xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 10 ++++++++++
xlators/mgmt/glusterd/src/glusterd-utils.c | 19 +++++++++++++++++++
5 files changed, 62 insertions(+), 10 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index c7e419c..8dfb528 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -658,6 +658,15 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
}
brickinfo->snap_status = 0;
+ ret = glusterd_brick_start (snap_vol, brickinfo, _gf_false);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_BRICK_DISCONNECTED, "starting the "
+ "brick %s:%s for the snap %s failed",
+ brickinfo->hostname, brickinfo->path,
+ snap->snapname);
+ goto out;
+ }
ret = glusterd_store_volinfo (snap_vol,
GLUSTERD_VOLINFO_VER_AC_NONE);
if (ret) {
@@ -668,15 +677,6 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
goto out;
}
- ret = glusterd_brick_start (snap_vol, brickinfo, _gf_false);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- GD_MSG_BRICK_DISCONNECTED, "starting the "
- "brick %s:%s for the snap %s failed",
- brickinfo->hostname, brickinfo->path,
- snap->snapname);
- goto out;
- }
out:
if (device)
GF_FREE (device);
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 96e0860..9641b4f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2415,8 +2415,15 @@ glusterd_start_bricks (glusterd_volinfo_t *volinfo)
brickinfo->path);
goto out;
}
- }
+ }
+ ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_STORE_FAIL,
+ "Failed to write volinfo for volume %s",
+ volinfo->volname);
+ goto out;
+ }
ret = 0;
out:
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
index a4637f8..659ff9d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
@@ -12,6 +12,7 @@
#include "glusterd-utils.h"
#include "glusterd-messages.h"
#include "glusterd-server-quorum.h"
+#include "glusterd-store.h"
#include "glusterd-syncop.h"
#include "glusterd-op-sm.h"
@@ -309,6 +310,7 @@ void
glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo,
gf_boolean_t meets_quorum)
{
+ int ret = -1;
glusterd_brickinfo_t *brickinfo = NULL;
gd_quorum_status_t quorum_status = NOT_APPLICABLE_QUORUM;
gf_boolean_t follows_quorum = _gf_false;
@@ -365,6 +367,20 @@ glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo,
glusterd_brick_start (volinfo, brickinfo, _gf_false);
}
volinfo->quorum_status = quorum_status;
+ if (quorum_status == MEETS_QUORUM) {
+ /* bricks might have been restarted and so as the port change
+ * might have happened
+ */
+ ret = glusterd_store_volinfo (volinfo,
+ GLUSTERD_VOLINFO_VER_AC_NONE);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_STORE_FAIL,
+ "Failed to write volinfo for volume %s",
+ volinfo->volname);
+ goto out;
+ }
+ }
out:
return;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index 6fb49c3..4cbade1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -1680,6 +1680,16 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count,
}
if (glusterd_is_volume_started (snap_vol)) {
(void) glusterd_start_bricks (snap_vol);
+ ret = glusterd_store_volinfo
+ (snap_vol,
+ GLUSTERD_VOLINFO_VER_AC_NONE);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to "
+ "write volinfo for volume %s",
+ snap_vol->volname);
+ goto out;
+ }
} else {
(void) glusterd_stop_bricks(snap_vol);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index f34e218..bb236df 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6003,6 +6003,15 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
glusterd_brick_start (volinfo, brickinfo,
_gf_false);
}
+ ret = glusterd_store_volinfo
+ (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to "
+ "write volinfo for volume %s",
+ volinfo->volname);
+ goto out;
+ }
}
}
@@ -6034,6 +6043,16 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
glusterd_brick_start (volinfo, brickinfo,
_gf_false);
}
+ ret = glusterd_store_volinfo
+ (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to "
+ "write volinfo for volume %s",
+ volinfo->volname);
+ goto out;
+ }
+
}
}
ret = 0;
--
1.8.3.1

View File

@ -1,39 +0,0 @@
From 4ea251b0a23ae8fc0740abc2c5d85c09c31e0c70 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Mon, 6 Nov 2017 13:23:32 +0530
Subject: [PATCH 42/74] glusterd: restart the brick if qorum status is
NOT_APPLICABLE_QUORUM
If a volume is not having server quorum enabled and in a trusted storage
pool all the glusterd instances from other peers are down, on restarting
glusterd the brick start trigger doesn't happen resulting into the
brick not coming up.
> mainline patch : https://review.gluster.org/18669
Change-Id: If1458e03b50a113f1653db553bb2350d11577539
BUG: 1509102
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123055
Reviewed-by: Gaurav Yadav <gyadav@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-server-quorum.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
index 659ff9d..4706403 100644
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
@@ -341,7 +341,8 @@ glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo,
* the bricks that are down are brought up again. In this process it
* also brings up the brick that is purposefully taken down.
*/
- if (volinfo->quorum_status == quorum_status)
+ if (quorum_status != NOT_APPLICABLE_QUORUM &&
+ volinfo->quorum_status == quorum_status)
goto out;
if (quorum_status == MEETS_QUORUM) {
--
1.8.3.1

View File

@ -1,173 +0,0 @@
From 385b61f9a6f818c2810cc0a2223c9d71340cd345 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Tue, 17 Oct 2017 21:32:44 +0530
Subject: [PATCH 43/74] glusterd: clean up portmap on brick disconnect
GlusterD's portmap entry for a brick is cleaned up when a PMAP_SIGNOUT event is
initiated by the brick process at the shutdown. But if the brick process crashes
or gets killed through SIGKILL then this event is not initiated and glusterd
ends up with a stale port. Since GlusterD's portmap traversal happens both ways,
forward for allocation and backward for registry search, there is a possibility
that glusterd might end up running with a stale port for a brick which
eventually will end up with clients to fail to connect to the bricks.
Solution is to clean up the port entry in case the process is down as
part of the brick disconnect event. Although with this the handling
PMAP_SIGNOUT event becomes redundant in most of the cases, but this is
the safeguard method to avoid glusterd getting into the stale port
issues.
>mainline patch : https://review.gluster.org/#/c/18541
Change-Id: I04c5be6d11e772ee4de16caf56dbb37d5c944303
BUG: 1503244
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123057
Reviewed-by: Gaurav Yadav <gyadav@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-handler.c | 25 +++++++++++++++++++++++++
xlators/mgmt/glusterd/src/glusterd-pmap.c | 26 +++++++++++++++++---------
xlators/mgmt/glusterd/src/glusterd-pmap.h | 3 ++-
xlators/mgmt/glusterd/src/glusterd.c | 3 ++-
4 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index af9a796..34e751c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -5974,8 +5974,10 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
glusterd_volinfo_t *volinfo = NULL;
xlator_t *this = NULL;
int temp = 0;
+ int32_t pid = -1;
glusterd_brickinfo_t *brickinfo_tmp = NULL;
glusterd_brick_proc_t *brick_proc = NULL;
+ char pidfile[PATH_MAX] = {0};
brickid = mydata;
if (!brickid)
@@ -6074,6 +6076,29 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
"peer=%s;volume=%s;brick=%s",
brickinfo->hostname, volinfo->volname,
brickinfo->path);
+ /* In case of an abrupt shutdown of a brick PMAP_SIGNOUT
+ * event is not received by glusterd which can lead to a
+ * stale port entry in glusterd, so forcibly clean up
+ * the same if the process is not running
+ */
+ GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo,
+ brickinfo, conf);
+ if (!gf_is_service_running (pidfile, &pid)) {
+ ret = pmap_registry_remove (
+ THIS, brickinfo->port,
+ brickinfo->path,
+ GF_PMAP_PORT_BRICKSERVER,
+ NULL, _gf_true);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_WARNING,
+ GD_MSG_PMAP_REGISTRY_REMOVE_FAIL,
+ 0, "Failed to remove pmap "
+ "registry for port %d for "
+ "brick %s", brickinfo->port,
+ brickinfo->path);
+ ret = 0;
+ }
+ }
}
if (is_brick_mx_enabled()) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index 2a75476..1b547e7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -239,7 +239,8 @@ pmap_assign_port (xlator_t *this, int old_port, const char *path)
if (old_port) {
ret = pmap_registry_remove (this, 0, path,
- GF_PMAP_PORT_BRICKSERVER, NULL);
+ GF_PMAP_PORT_BRICKSERVER, NULL,
+ _gf_false);
if (ret) {
gf_msg (this->name, GF_LOG_WARNING,
GD_MSG_PMAP_REGISTRY_REMOVE_FAIL, 0, "Failed to"
@@ -342,7 +343,8 @@ pmap_registry_extend (xlator_t *this, int port, const char *brickname)
int
pmap_registry_remove (xlator_t *this, int port, const char *brickname,
- gf_pmap_port_type_t type, void *xprt)
+ gf_pmap_port_type_t type, void *xprt,
+ gf_boolean_t brick_disconnect)
{
struct pmap_registry *pmap = NULL;
int p = 0;
@@ -389,11 +391,16 @@ remove:
* can delete the entire entry.
*/
if (!pmap->ports[p].xprt) {
- brick_str = pmap->ports[p].brickname;
- if (brick_str) {
- while (*brick_str != '\0') {
- if (*(brick_str++) != ' ') {
- goto out;
+ /* If the signout call is being triggered by brick disconnect
+ * then clean up all the bricks (in case of brick mux)
+ */
+ if (!brick_disconnect) {
+ brick_str = pmap->ports[p].brickname;
+ if (brick_str) {
+ while (*brick_str != '\0') {
+ if (*(brick_str++) != ' ') {
+ goto out;
+ }
}
}
}
@@ -548,14 +555,15 @@ __gluster_pmap_signout (rpcsvc_request_t *req)
goto fail;
}
rsp.op_ret = pmap_registry_remove (THIS, args.port, args.brick,
- GF_PMAP_PORT_BRICKSERVER, req->trans);
+ GF_PMAP_PORT_BRICKSERVER, req->trans,
+ _gf_false);
ret = glusterd_get_brickinfo (THIS, args.brick, args.port, &brickinfo);
if (args.rdma_port) {
snprintf(brick_path, PATH_MAX, "%s.rdma", args.brick);
rsp.op_ret = pmap_registry_remove (THIS, args.rdma_port,
brick_path, GF_PMAP_PORT_BRICKSERVER,
- req->trans);
+ req->trans, _gf_false);
}
/* Update portmap status on brickinfo */
if (brickinfo)
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.h b/xlators/mgmt/glusterd/src/glusterd-pmap.h
index 9965a95..253b4cc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.h
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.h
@@ -42,7 +42,8 @@ int pmap_registry_bind (xlator_t *this, int port, const char *brickname,
gf_pmap_port_type_t type, void *xprt);
int pmap_registry_extend (xlator_t *this, int port, const char *brickname);
int pmap_registry_remove (xlator_t *this, int port, const char *brickname,
- gf_pmap_port_type_t type, void *xprt);
+ gf_pmap_port_type_t type, void *xprt,
+ gf_boolean_t brick_disconnect);
int pmap_registry_search (xlator_t *this, const char *brickname,
gf_pmap_port_type_t type, gf_boolean_t destroy);
struct pmap_registry *pmap_registry_get (xlator_t *this);
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 4887ff4..81a3206 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -424,7 +424,8 @@ glusterd_rpcsvc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
pthread_mutex_lock (&priv->xprt_lock);
list_del (&xprt->list);
pthread_mutex_unlock (&priv->xprt_lock);
- pmap_registry_remove (this, 0, NULL, GF_PMAP_PORT_ANY, xprt);
+ pmap_registry_remove (this, 0, NULL, GF_PMAP_PORT_ANY, xprt,
+ _gf_false);
break;
}
--
1.8.3.1

View File

@ -1,283 +0,0 @@
From 938ee38c02cce2a743c672f9c03798ebcbb1e348 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Thu, 26 Oct 2017 14:26:30 +0530
Subject: [PATCH 44/74] glusterd: fix brick restart parallelism
glusterd's brick restart logic is not always sequential as there is
atleast three different ways how the bricks are restarted.
1. through friend-sm and glusterd_spawn_daemons ()
2. through friend-sm and handling volume quorum action
3. through friend handshaking when there is a mimatch on quorum on
friend import.
In a brick multiplexing setup, glusterd ended up trying to spawn the
same brick process couple of times as almost in fraction of milliseconds
two threads hit glusterd_brick_start () because of which glusterd didn't
have any choice of rejecting any one of them as for both the case brick
start criteria met.
As a solution, it'd be better to control this madness by two different
flags, one is a boolean called start_triggered which indicates a brick
start has been triggered and it continues to be true till a brick dies
or killed, the second is a mutex lock to ensure for a particular brick
we don't end up getting into glusterd_brick_start () more than once at
same point of time.
>mainline patch : https://review.gluster.org/#/c/18577
Change-Id: I292f1e58d6971e111725e1baea1fe98b890b43e2
BUG: 1505363
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123056
Reviewed-by: Gaurav Yadav <gyadav@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-handler.c | 24 ++++++++-----
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 31 ++++++++++-------
xlators/mgmt/glusterd/src/glusterd-server-quorum.c | 15 +++++++--
xlators/mgmt/glusterd/src/glusterd-utils.c | 39 +++++++++++++++++-----
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 8 +++++
xlators/mgmt/glusterd/src/glusterd.h | 2 ++
6 files changed, 87 insertions(+), 32 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 34e751c..c3b9252 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -5946,16 +5946,22 @@ glusterd_mark_bricks_stopped_by_proc (glusterd_brick_proc_t *brick_proc) {
int ret = -1;
cds_list_for_each_entry (brickinfo, &brick_proc->bricks, brick_list) {
- ret = glusterd_get_volinfo_from_brick (brickinfo->path, &volinfo);
+ ret = glusterd_get_volinfo_from_brick (brickinfo->path,
+ &volinfo);
if (ret) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
- "Failed to get volinfo from brick(%s)",
- brickinfo->path);
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_VOLINFO_GET_FAIL, "Failed to get volinfo"
+ " from brick(%s)", brickinfo->path);
goto out;
}
- cds_list_for_each_entry (brickinfo_tmp, &volinfo->bricks, brick_list) {
- if (strcmp (brickinfo->path, brickinfo_tmp->path) == 0)
- glusterd_set_brick_status (brickinfo_tmp, GF_BRICK_STOPPED);
+ cds_list_for_each_entry (brickinfo_tmp, &volinfo->bricks,
+ brick_list) {
+ if (strcmp (brickinfo->path,
+ brickinfo_tmp->path) == 0) {
+ glusterd_set_brick_status (brickinfo_tmp,
+ GF_BRICK_STOPPED);
+ brickinfo_tmp->start_triggered = _gf_false;
+ }
}
}
return 0;
@@ -6129,8 +6135,10 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
if (temp == 1)
break;
}
- } else
+ } else {
glusterd_set_brick_status (brickinfo, GF_BRICK_STOPPED);
+ brickinfo->start_triggered = _gf_false;
+ }
break;
case RPC_CLNT_DESTROY:
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 9641b4f..5b8f833 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2402,18 +2402,25 @@ glusterd_start_bricks (glusterd_volinfo_t *volinfo)
GF_ASSERT (volinfo);
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
- ret = glusterd_brick_start (volinfo, brickinfo, _gf_false);
- if (ret) {
- gf_msg (THIS->name, GF_LOG_ERROR, 0,
- GD_MSG_BRICK_DISCONNECTED,
- "Failed to start %s:%s for %s",
- brickinfo->hostname, brickinfo->path,
- volinfo->volname);
- gf_event (EVENT_BRICK_START_FAILED,
- "peer=%s;volume=%s;brick=%s",
- brickinfo->hostname, volinfo->volname,
- brickinfo->path);
- goto out;
+ if (!brickinfo->start_triggered) {
+ pthread_mutex_lock (&brickinfo->restart_mutex);
+ {
+ ret = glusterd_brick_start (volinfo, brickinfo,
+ _gf_false);
+ }
+ pthread_mutex_unlock (&brickinfo->restart_mutex);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_DISCONNECTED,
+ "Failed to start %s:%s for %s",
+ brickinfo->hostname, brickinfo->path,
+ volinfo->volname);
+ gf_event (EVENT_BRICK_START_FAILED,
+ "peer=%s;volume=%s;brick=%s",
+ brickinfo->hostname, volinfo->volname,
+ brickinfo->path);
+ goto out;
+ }
}
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
index 4706403..995a568 100644
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
@@ -362,10 +362,19 @@ glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo,
list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
if (!glusterd_is_local_brick (this, volinfo, brickinfo))
continue;
- if (quorum_status == DOESNT_MEET_QUORUM)
+ if (quorum_status == DOESNT_MEET_QUORUM) {
glusterd_brick_stop (volinfo, brickinfo, _gf_false);
- else
- glusterd_brick_start (volinfo, brickinfo, _gf_false);
+ } else {
+ if (!brickinfo->start_triggered) {
+ pthread_mutex_lock (&brickinfo->restart_mutex);
+ {
+ glusterd_brick_start (volinfo,
+ brickinfo,
+ _gf_false);
+ }
+ pthread_mutex_unlock (&brickinfo->restart_mutex);
+ }
+ }
}
volinfo->quorum_status = quorum_status;
if (quorum_status == MEETS_QUORUM) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index bb236df..18de517 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1084,7 +1084,7 @@ glusterd_brickinfo_new (glusterd_brickinfo_t **brickinfo)
goto out;
CDS_INIT_LIST_HEAD (&new_brickinfo->brick_list);
-
+ pthread_mutex_init (&new_brickinfo->restart_mutex, NULL);
*brickinfo = new_brickinfo;
ret = 0;
@@ -2481,7 +2481,7 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
(void) sys_unlink (pidfile);
brickinfo->status = GF_BRICK_STOPPED;
-
+ brickinfo->start_triggered = _gf_false;
if (del_brick)
glusterd_delete_brick (volinfo, brickinfo);
out:
@@ -5817,13 +5817,14 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
* three different triggers for an attempt to start the brick process
* due to the quorum handling code in glusterd_friend_sm.
*/
- if (brickinfo->status == GF_BRICK_STARTING) {
+ if (brickinfo->status == GF_BRICK_STARTING ||
+ brickinfo->start_triggered) {
gf_msg_debug (this->name, 0, "brick %s is already in starting "
"phase", brickinfo->path);
ret = 0;
goto out;
}
-
+ brickinfo->start_triggered = _gf_true;
GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, conf);
if (gf_is_service_running (pidfile, &pid)) {
if (brickinfo->status != GF_BRICK_STARTING &&
@@ -5936,6 +5937,9 @@ run:
}
out:
+ if (ret && brickinfo) {
+ brickinfo->start_triggered = _gf_false;
+ }
gf_msg_debug (this->name, 0, "returning %d ", ret);
return ret;
}
@@ -5997,11 +6001,19 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
start_svcs = _gf_true;
glusterd_svcs_manager (NULL);
}
-
cds_list_for_each_entry (brickinfo, &volinfo->bricks,
brick_list) {
- glusterd_brick_start (volinfo, brickinfo,
- _gf_false);
+ if (!brickinfo->start_triggered) {
+ pthread_mutex_lock
+ (&brickinfo->restart_mutex);
+ {
+ glusterd_brick_start
+ (volinfo, brickinfo,
+ _gf_false);
+ }
+ pthread_mutex_unlock
+ (&brickinfo->restart_mutex);
+ }
}
ret = glusterd_store_volinfo
(volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
@@ -6040,8 +6052,17 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
"volume %s", volinfo->volname);
cds_list_for_each_entry (brickinfo, &volinfo->bricks,
brick_list) {
- glusterd_brick_start (volinfo, brickinfo,
- _gf_false);
+ if (!brickinfo->start_triggered) {
+ pthread_mutex_lock
+ (&brickinfo->restart_mutex);
+ {
+ glusterd_brick_start
+ (volinfo, brickinfo,
+ _gf_false);
+ }
+ pthread_mutex_unlock
+ (&brickinfo->restart_mutex);
+ }
}
ret = glusterd_store_volinfo
(volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 834acab..bec5f72 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -2545,6 +2545,14 @@ glusterd_start_volume (glusterd_volinfo_t *volinfo, int flags,
GF_ASSERT (volinfo);
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ /* Mark start_triggered to false so that in case if this brick
+ * was brought down through gf_attach utility, the
+ * brickinfo->start_triggered wouldn't have been updated to
+ * _gf_false
+ */
+ if (flags & GF_CLI_FLAG_OP_FORCE) {
+ brickinfo->start_triggered = _gf_false;
+ }
ret = glusterd_brick_start (volinfo, brickinfo, wait);
/* If 'force' try to start all bricks regardless of success or
* failure
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 722d2f8..d4bb236 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -240,6 +240,8 @@ struct glusterd_brickinfo {
uint64_t statfs_fsid;
uint32_t fs_share_count;
gf_boolean_t port_registered;
+ gf_boolean_t start_triggered;
+ pthread_mutex_t restart_mutex;
};
typedef struct glusterd_brickinfo glusterd_brickinfo_t;
--
1.8.3.1

View File

@ -1,265 +0,0 @@
From b027d2fdd184d2ee2b2c4236603200be344156f8 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Thu, 10 Aug 2017 18:31:55 +0530
Subject: [PATCH 45/74] glusterd: introduce max-port range
glusterd.vol file always had an option (commented out) to indicate the
base-port to start the portmapper allocation. This patch brings in the
max-port configuration where one can limit the range of ports which
gluster can be allowed to bind.
>Fixes: #305
>Change-Id: Id7a864f818227b9530a07e13d605138edacd9aa9
>Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
>Reviewed-on: https://review.gluster.org/18016
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Prashanth Pai <ppai@redhat.com>
>Reviewed-by: Niels de Vos <ndevos@redhat.com>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>Reviewed-by: Gaurav Yadav <gyadav@redhat.com>
Change-Id: Id7a864f818227b9530a07e13d605138edacd9aa9
BUG: 1474745
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123060
Reviewed-by: Gaurav Yadav <gyadav@redhat.com>
---
extras/glusterd.vol.in | 1 +
xlators/mgmt/glusterd/src/glusterd-messages.h | 10 +++++++++-
xlators/mgmt/glusterd/src/glusterd-pmap.c | 20 +++++++++++---------
xlators/mgmt/glusterd/src/glusterd-pmap.h | 3 ++-
xlators/mgmt/glusterd/src/glusterd-snapd-svc.c | 8 ++++++++
xlators/mgmt/glusterd/src/glusterd-utils.c | 18 +++++++++++++++++-
xlators/mgmt/glusterd/src/glusterd.c | 17 +++++++++++++++--
xlators/mgmt/glusterd/src/glusterd.h | 1 +
8 files changed, 64 insertions(+), 14 deletions(-)
diff --git a/extras/glusterd.vol.in b/extras/glusterd.vol.in
index 957b277..0152996 100644
--- a/extras/glusterd.vol.in
+++ b/extras/glusterd.vol.in
@@ -9,4 +9,5 @@ volume management
option event-threads 1
# option transport.address-family inet6
# option base-port 49152
+# option max-port 65535
end-volume
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index 8bb4c43..de9ae92 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 611
+#define GLFS_NUM_MESSAGES 612
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
@@ -4945,6 +4945,14 @@
*/
#define GD_MSG_SVC_START_FAIL (GLUSTERD_COMP_BASE + 590)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define GD_MSG_PORTS_EXHAUSTED (GLUSTERD_COMP_BASE + 612)
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index 1b547e7..4f045ab 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -61,8 +61,8 @@ pmap_registry_new (xlator_t *this)
pmap->base_port = pmap->last_alloc =
((glusterd_conf_t *)(this->private))->base_port;
-
- for (i = pmap->base_port; i <= GF_PORT_MAX; i++) {
+ pmap->max_port = ((glusterd_conf_t *)(this->private))->max_port;
+ for (i = pmap->base_port; i <= pmap->max_port; i++) {
if (pmap_port_isfree (i))
pmap->ports[i].type = GF_PMAP_PORT_FREE;
else
@@ -184,10 +184,12 @@ pmap_registry_search_by_xprt (xlator_t *this, void *xprt,
static char *
pmap_registry_search_by_port (xlator_t *this, int port)
{
- struct pmap_registry *pmap = NULL;
- char *brickname = NULL;
+ struct pmap_registry *pmap = NULL;
+ char *brickname = NULL;
+ int max_port = 0;
- if (port > GF_PORT_MAX)
+ max_port = ((glusterd_conf_t *)(this->private))->max_port;
+ if (port > max_port)
goto out;
pmap = pmap_registry_get (this);
@@ -209,7 +211,7 @@ pmap_registry_alloc (xlator_t *this)
pmap = pmap_registry_get (this);
- for (p = pmap->base_port; p <= GF_PORT_MAX; p++) {
+ for (p = pmap->base_port; p <= pmap->max_port; p++) {
/* GF_PMAP_PORT_FOREIGN may be freed up ? */
if ((pmap->ports[p].type == GF_PMAP_PORT_FREE) ||
(pmap->ports[p].type == GF_PMAP_PORT_FOREIGN)) {
@@ -261,7 +263,7 @@ pmap_registry_bind (xlator_t *this, int port, const char *brickname,
pmap = pmap_registry_get (this);
- if (port > GF_PORT_MAX)
+ if (port > pmap->max_port)
goto out;
p = port;
@@ -297,7 +299,7 @@ pmap_registry_extend (xlator_t *this, int port, const char *brickname)
pmap = pmap_registry_get (this);
- if (port > GF_PORT_MAX) {
+ if (port > pmap->max_port) {
return -1;
}
@@ -357,7 +359,7 @@ pmap_registry_remove (xlator_t *this, int port, const char *brickname,
goto out;
if (port) {
- if (port > GF_PORT_MAX)
+ if (port > pmap->max_port)
goto out;
p = port;
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.h b/xlators/mgmt/glusterd/src/glusterd-pmap.h
index 253b4cc..f642d66 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.h
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.h
@@ -31,8 +31,9 @@ struct pmap_port_status {
struct pmap_registry {
int base_port;
+ int max_port;
int last_alloc;
- struct pmap_port_status ports[65536];
+ struct pmap_port_status ports[GF_PORT_MAX + 1];
};
int pmap_assign_port (xlator_t *this, int port, const char *path);
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
index 59d8fbd..5621852 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
@@ -300,6 +300,14 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags)
"-S", svc->conn.sockpath, NULL);
snapd_port = pmap_assign_port (THIS, volinfo->snapd.port, snapd_id);
+ if (!snapd_port) {
+ gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_PORTS_EXHAUSTED,
+ "All the ports in the range are exhausted, can't start "
+ "snapd for volume %s", volinfo->volname);
+ ret = -1;
+ goto out;
+ }
+
volinfo->snapd.port = snapd_port;
runner_add_arg (&runner, "--brick-port");
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 18de517..55c4fa7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -2002,7 +2002,14 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
}
port = pmap_assign_port (THIS, brickinfo->port, brickinfo->path);
-
+ if (!port) {
+ gf_msg (this->name, GF_LOG_ERROR, 0, GD_MSG_PORTS_EXHAUSTED,
+ "All the ports in the range are exhausted, can't start "
+ "brick %s for volume %s", brickinfo->path,
+ volinfo->volname);
+ ret = -1;
+ goto out;
+ }
/* Build the exp_path, before starting the glusterfsd even in
valgrind mode. Otherwise all the glusterfsd processes start
writing the valgrind log to the same file.
@@ -2076,6 +2083,15 @@ retry:
brickinfo->path);
rdma_port = pmap_assign_port (THIS, brickinfo->rdma_port,
rdma_brick_path);
+ if (!rdma_port) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_PORTS_EXHAUSTED, "All rdma ports in the "
+ "range are exhausted, can't start brick %s for "
+ "volume %s", rdma_brick_path,
+ volinfo->volname);
+ ret = -1;
+ goto out;
+ }
runner_argprintf (&runner, "%d,%d", port, rdma_port);
runner_add_arg (&runner, "--xlator-option");
runner_argprintf (&runner, "%s-server.transport.rdma.listen-port=%d",
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 81a3206..68d3e90 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1824,12 +1824,20 @@ init (xlator_t *this)
if (ret)
goto out;
- conf->base_port = GF_IANA_PRIV_PORTS_START;
- if (dict_get_uint32(this->options, "base-port", &conf->base_port) == 0) {
+ conf->base_port = GF_IANA_PRIV_PORTS_START;
+ if (dict_get_uint32 (this->options, "base-port",
+ &conf->base_port) == 0) {
gf_msg (this->name, GF_LOG_INFO, 0,
GD_MSG_DICT_SET_FAILED,
"base-port override: %d", conf->base_port);
}
+ conf->max_port = GF_PORT_MAX;
+ if (dict_get_uint32 (this->options, "max-port",
+ &conf->max_port) == 0) {
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_DICT_SET_FAILED,
+ "max-port override: %d", conf->max_port);
+ }
/* Set option to run bricks on valgrind if enabled in glusterd.vol */
this->ctx->cmd_args.valgrind = valgrind;
@@ -2135,6 +2143,11 @@ struct volume_options options[] = {
.type = GF_OPTION_TYPE_INT,
.description = "Sets the base port for portmap query"
},
+ { .key = {"max-port"},
+ .type = GF_OPTION_TYPE_INT,
+ .max = GF_PORT_MAX,
+ .description = "Sets the max port for portmap query"
+ },
{ .key = {"snap-brick-path"},
.type = GF_OPTION_TYPE_STR,
.description = "directory where the bricks for the snapshots will be created"
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index d4bb236..291f2f7 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -187,6 +187,7 @@ typedef struct {
gf_boolean_t restart_done;
rpcsvc_t *uds_rpc; /* RPCSVC for the unix domain socket */
uint32_t base_port;
+ uint32_t max_port;
char *snap_bricks_directory;
gf_store_handle_t *missed_snaps_list_shandle;
struct cds_list_head missed_snaps_list;
--
1.8.3.1

View File

@ -1,424 +0,0 @@
From 538b92ebe180186d84e3f5288f168c404e8957d4 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Mon, 13 Nov 2017 18:41:58 +0530
Subject: [PATCH 46/74] Revert "build: conditionally build legacy gNFS server
and associated sub-packaging"
This reverts commit 83abcba6b42f94eb5a6495a634d4055362a9d79d.
Conflicts:
glusterfs.spec.in
xlators/Makefile.am
xlators/mgmt/glusterd/src/glusterd-messages.h
---
configure.ac | 12 -----
extras/LinuxRPM/Makefile.am | 4 +-
glusterfs.spec.in | 65 +++++++--------------------
xlators/Makefile.am | 6 +--
xlators/mgmt/glusterd/src/Makefile.am | 4 +-
xlators/mgmt/glusterd/src/glusterd-nfs-svc.c | 28 ++++++------
xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h | 1 +
xlators/mgmt/glusterd/src/glusterd-utils.c | 7 ++-
xlators/mgmt/glusterd/src/glusterd.c | 35 ++++++++++++---
9 files changed, 68 insertions(+), 94 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3841959..dfccd40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1345,17 +1345,6 @@ 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],
@@ -1590,5 +1579,4 @@ 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 f028537..61fd6da 100644
--- a/extras/LinuxRPM/Makefile.am
+++ b/extras/LinuxRPM/Makefile.am
@@ -18,7 +18,7 @@ autogen:
cd ../.. && \
rm -rf autom4te.cache && \
./autogen.sh && \
- ./configure --enable-gnfs --with-previous-options
+ ./configure --with-previous-options
prep:
$(MAKE) -C ../.. dist;
@@ -36,7 +36,7 @@ srcrpm:
mv rpmbuild/SRPMS/* .
rpms:
- rpmbuild --define '_topdir $(shell pwd)/rpmbuild' --with gnfs -bb rpmbuild/SPECS/glusterfs.spec
+ rpmbuild --define '_topdir $(shell pwd)/rpmbuild' -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 8c16477..10339fe 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -47,10 +47,6 @@
%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}
@@ -122,7 +118,7 @@
%endif
# From https://fedoraproject.org/wiki/Packaging:Python#Macros
-%if ( 0%{?rhel} && 0%{?rhel} <= 6 )
+%if ( 0%{?rhel} && 0%{?rhel} <= 5 )
%{!?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))")}
%global _rundir %{_localstatedir}/run
@@ -461,26 +457,6 @@ This package provides support to geo-replication.
%endif
%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
@@ -621,6 +597,7 @@ 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
@@ -736,19 +713,18 @@ export LDFLAGS
./autogen.sh && %configure \
%{?_with_cmocka} \
%{?_with_debug} \
- %{?_with_firewalld} \
- %{?_with_gnfs} \
- %{?_with_tmpfilesdir} \
%{?_with_valgrind} \
+ %{?_with_tmpfilesdir} \
%{?_without_bd} \
%{?_without_epoll} \
- %{?_without_events} \
%{?_without_fusermount} \
%{?_without_georeplication} \
+ %{?_with_firewalld} \
%{?_without_ocf} \
%{?_without_rdma} \
%{?_without_syslog} \
- %{?_without_tiering}
+ %{?_without_tiering} \
+ %{?_without_events}
# fix hardening and remove rpath in shlibs
%if ( 0%{?fedora} && 0%{?fedora} > 17 ) || ( 0%{?rhel} && 0%{?rhel} > 6 )
@@ -1105,6 +1081,7 @@ exit 0
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/trash.so
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/upcall.so
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mgmt*
+%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs*
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/performance/decompounder.so
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol/server*
%exclude %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/storage*
@@ -1297,19 +1274,6 @@ exit 0
%endif
%if ( 0%{?_build_server} )
-%if ( 0%{?_with_gnfs:1} )
-%files gnfs
-%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator
-%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs
- %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs/server.so
-%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
-%endif
-
-%if ( 0%{?_build_server} )
%files ganesha
%endif
@@ -1399,11 +1363,6 @@ 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
@@ -1450,6 +1409,7 @@ exit 0
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/trash.so
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/upcall.so
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/features/leases.so
+ %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/nfs*
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mgmt
%{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/mgmt/glusterd.so
%dir %{_libdir}/glusterfs/%{version}%{?prereltag}/xlator/protocol
@@ -1517,7 +1477,11 @@ 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
-%config(noreplace) %ghost %attr(0600,-,-) %{_sharedstatedir}/glusterd/options
+%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
%ghost %dir %attr(0755,-,-) %{_sharedstatedir}/glusterd/scrub
@@ -2156,6 +2120,9 @@ fi
%endif
%changelog
+* Mon Nov 13 2017 Jiffin Tony Thottan <jthottan@redhat.com>
+- DOWNSTREAM ONLY - revert of 83abcb(gnfs in an optional subpackage)
+
* Tue Oct 10 2017 Milind Changire <mchangir@redhat.com>
- DOWNSTREAM ONLY patch - launch glusterd in upgrade mode after all new bits have been installed
diff --git a/xlators/Makefile.am b/xlators/Makefile.am
index 29549db..c3c9cf2 100644
--- a/xlators/Makefile.am
+++ b/xlators/Makefile.am
@@ -1,12 +1,8 @@
-if BUILD_GNFS
- GNFS_DIR = nfs
-endif
-
DIST_SUBDIRS = cluster storage protocol performance debug features encryption \
mount nfs mgmt system playground meta
SUBDIRS = cluster storage protocol performance debug features encryption \
- mount ${GNFS_DIR} mgmt system playground meta
+ mount nfs mgmt system playground meta
EXTRA_DIST = xlator.sym
diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am
index b0f5a9b..4858dee 100644
--- a/xlators/mgmt/glusterd/src/Makefile.am
+++ b/xlators/mgmt/glusterd/src/Makefile.am
@@ -1,8 +1,6 @@
xlator_LTLIBRARIES = glusterd.la
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/mgmt
-glusterd_la_CPPFLAGS = $(AM_CPPFLAGS) \
- -DFILTERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/filter\" \
- -DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\"
+glusterd_la_CPPFLAGS = $(AM_CPPFLAGS) "-DFILTERDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/filter\""
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-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
index 32b1064..eab9746 100644
--- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
@@ -10,7 +10,6 @@
#include "globals.h"
#include "run.h"
-#include "syscall.h"
#include "glusterd.h"
#include "glusterd-utils.h"
#include "glusterd-volgen.h"
@@ -18,6 +17,8 @@
#include "glusterd-messages.h"
#include "glusterd-svc-helper.h"
+static char *nfs_svc_name = "nfs";
+
static gf_boolean_t
glusterd_nfssvc_need_start ()
{
@@ -40,13 +41,19 @@ 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 (conf->nfs_svc.name, conf->workdir,
+ glusterd_svc_build_volfile_path (nfs_svc_name, conf->workdir,
filepath, sizeof (filepath));
return glusterd_create_global_volfile (build_nfs_graph,
filepath, NULL);
@@ -58,16 +65,15 @@ glusterd_nfssvc_manager (glusterd_svc_t *svc, void *data, int flags)
int ret = -1;
if (!svc->inited) {
- ret = glusterd_svc_init (svc, "nfs");
+ ret = glusterd_nfssvc_init (svc);
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");
}
}
@@ -75,14 +81,6 @@ 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 8b70a62..c505d1e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.h
@@ -29,6 +29,7 @@ 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 55c4fa7..f611fbb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -668,8 +668,11 @@ glusterd_volinfo_new (glusterd_volinfo_t **volinfo)
new_volinfo->xl = THIS;
- glusterd_snapdsvc_build (&new_volinfo->snapd.svc);
- glusterd_tierdsvc_build (&new_volinfo->tierd.svc);
+ 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));
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 68d3e90..6ce4156 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1330,6 +1330,34 @@ 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)
{
@@ -1864,12 +1892,7 @@ init (xlator_t *this)
this->private = conf;
glusterd_mgmt_v3_lock_init ();
glusterd_txn_opinfo_dict_init ();
-
- 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);
+ glusterd_svcs_build ();
/* Make install copies few of the hook-scripts by creating hooks
* directory. Hence purposefully not doing the check for the presence of
--
1.8.3.1

View File

@ -1,34 +0,0 @@
From 7dd54e4e500a41105f375b2aa3620fcd619d5148 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Mon, 13 Nov 2017 18:43:00 +0530
Subject: [PATCH 47/74] Revert "glusterd: skip nfs svc reconfigure if nfs
xlator is not installed"
This reverts commit 316e3300cfaa646b7fa45fcc7f57b81c7bb15a0e.
---
xlators/mgmt/glusterd/src/glusterd-nfs-svc.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
index eab9746..da34342 100644
--- a/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-nfs-svc.c
@@ -154,15 +154,6 @@ glusterd_nfssvc_reconfigure ()
priv = this->private;
GF_VALIDATE_OR_GOTO (this->name, priv, 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");
- ret = 0;
- goto out;
- }
-
cds_list_for_each_entry (volinfo, &priv->volumes, vol_list) {
if (GLUSTERD_STATUS_STARTED == volinfo->status) {
vol_started = _gf_true;
--
1.8.3.1

View File

@ -1,473 +0,0 @@
From f37a409a8c0fa683ad95a61bf71e949f215e2f81 Mon Sep 17 00:00:00 2001
From: Gaurav Yadav <gyadav@redhat.com>
Date: Thu, 5 Oct 2017 23:44:46 +0530
Subject: [PATCH 48/74] glusterd : introduce timer in mgmt_v3_lock
Problem:
In a multinode environment, if two of the op-sm transactions
are initiated on one of the receiver nodes at the same time,
there might be a possibility that glusterd may end up in
stale lock.
Solution:
During mgmt_v3_lock a registration is made to gf_timer_call_after
which release the lock after certain period of time
>mainline patch : https://review.gluster.org/#/c/18437
Change-Id: I16cc2e5186a2e8a5e35eca2468b031811e093843
BUG: 1442983
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123069
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
extras/glusterd.vol.in | 1 +
libglusterfs/src/common-utils.h | 2 +-
libglusterfs/src/mem-types.h | 1 +
xlators/mgmt/glusterd/src/glusterd-locks.c | 219 +++++++++++++++++++++++++++--
xlators/mgmt/glusterd/src/glusterd-locks.h | 13 ++
xlators/mgmt/glusterd/src/glusterd.c | 28 +++-
xlators/mgmt/glusterd/src/glusterd.h | 2 +
7 files changed, 246 insertions(+), 20 deletions(-)
diff --git a/extras/glusterd.vol.in b/extras/glusterd.vol.in
index 0152996..fe413a9 100644
--- a/extras/glusterd.vol.in
+++ b/extras/glusterd.vol.in
@@ -7,6 +7,7 @@ volume management
option transport.socket.read-fail-log off
option ping-timeout 0
option event-threads 1
+# option lock-timer 180
# option transport.address-family inet6
# option base-port 49152
# option max-port 65535
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index e1c5f66..0131070 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -102,7 +102,7 @@ void trap (void);
#define GF_CLNT_INSECURE_PORT_CEILING (GF_IANA_PRIV_PORTS_START - 1)
#define GF_PORT_MAX 65535
#define GF_PORT_ARRAY_SIZE ((GF_PORT_MAX + 7) / 8)
-
+#define GF_LOCK_TIMER 180
#define GF_MINUTE_IN_SECONDS 60
#define GF_HOUR_IN_SECONDS (60*60)
#define GF_DAY_IN_SECONDS (24*60*60)
diff --git a/libglusterfs/src/mem-types.h b/libglusterfs/src/mem-types.h
index d244fb5..85cb5d2 100644
--- a/libglusterfs/src/mem-types.h
+++ b/libglusterfs/src/mem-types.h
@@ -177,6 +177,7 @@ enum gf_common_mem_types_ {
gf_common_mt_pthread_t,
gf_common_ping_local_t,
gf_common_volfile_t,
+ gf_common_mt_mgmt_v3_lock_timer_t,
gf_common_mt_end
};
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
index 146092d..bd73b37 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
@@ -94,6 +94,50 @@ glusterd_mgmt_v3_lock_fini ()
dict_unref (priv->mgmt_v3_lock);
}
+/* Initialize the global mgmt_v3_timer lock list(dict) when
+ * glusterd is spawned */
+int32_t
+glusterd_mgmt_v3_lock_timer_init ()
+{
+ int32_t ret = -1;
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("glusterd", this, out);
+
+ priv = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, priv, out);
+
+ priv->mgmt_v3_lock_timer = dict_new ();
+ if (!priv->mgmt_v3_lock_timer)
+ goto out;
+
+ ret = 0;
+out:
+ return ret;
+}
+
+/* Destroy the global mgmt_v3_timer lock list(dict) when
+ * glusterd cleanup is performed */
+void
+glusterd_mgmt_v3_lock_timer_fini ()
+{
+ xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("glusterd", this, out);
+
+ priv = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, priv, out);
+
+ if (priv->mgmt_v3_lock_timer)
+ dict_unref (priv->mgmt_v3_lock_timer);
+out:
+ return;
+}
+
int32_t
glusterd_get_mgmt_v3_lock_owner (char *key, uuid_t *uuid)
{
@@ -513,17 +557,23 @@ int32_t
glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
char *type)
{
- char key[PATH_MAX] = "";
- int32_t ret = -1;
- glusterd_mgmt_v3_lock_obj *lock_obj = NULL;
- glusterd_conf_t *priv = NULL;
- gf_boolean_t is_valid = _gf_true;
- uuid_t owner = {0};
- xlator_t *this = NULL;
- char *bt = NULL;
+ char key[PATH_MAX] = "";
+ int32_t ret = -1;
+ glusterd_mgmt_v3_lock_obj *lock_obj = NULL;
+ glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL;
+ glusterd_conf_t *priv = NULL;
+ gf_boolean_t is_valid = _gf_true;
+ uuid_t owner = {0};
+ xlator_t *this = NULL;
+ char *bt = NULL;
+ struct timespec delay = {0};
+ char *key_dup = NULL;
+ glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL;
+ xlator_t *mgmt_lock_timer_xl = NULL;
this = THIS;
GF_ASSERT (this);
+
priv = this->private;
GF_ASSERT (priv);
@@ -594,6 +644,42 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, uint32_t *op_errno,
goto out;
}
+ mgmt_lock_timer = GF_CALLOC (1, sizeof(glusterd_mgmt_v3_lock_timer),
+ gf_common_mt_mgmt_v3_lock_timer_t);
+
+ if (!mgmt_lock_timer) {
+ ret = -1;
+ goto out;
+ }
+
+ mgmt_lock_timer->xl = THIS;
+ key_dup = gf_strdup (key);
+ delay.tv_sec = priv->mgmt_v3_lock_timeout;
+ delay.tv_nsec = 0;
+
+ ret = -1;
+ mgmt_lock_timer_xl = mgmt_lock_timer->xl;
+ GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_xl, out);
+
+ mgmt_lock_timer_ctx = mgmt_lock_timer_xl->ctx;
+ GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_ctx, out);
+
+ mgmt_lock_timer->timer = gf_timer_call_after
+ (mgmt_lock_timer_ctx, delay,
+ gd_mgmt_v3_unlock_timer_cbk,
+ key_dup);
+
+ ret = dict_set_bin (priv->mgmt_v3_lock_timer, key, mgmt_lock_timer,
+ sizeof (glusterd_mgmt_v3_lock_timer));
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
+ "Unable to set timer in mgmt_v3 lock");
+ GF_FREE (mgmt_lock_timer);
+ goto out;
+ }
+
+
/* Saving the backtrace into the pre-allocated buffer, ctx->btbuf*/
if ((bt = gf_backtrace_save (NULL))) {
snprintf (key, sizeof (key), "debug.last-success-bt-%s-%s",
@@ -617,18 +703,98 @@ out:
return ret;
}
+/*
+ * This call back will ensure to unlock the lock_obj, in case we hit a situation
+ * where unlocking failed and stale lock exist*/
+void
+gd_mgmt_v3_unlock_timer_cbk (void *data)
+{
+ xlator_t *this = NULL;
+ glusterd_conf_t *conf = NULL;
+ glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL;
+ char *key = NULL;
+ char *type = NULL;
+ char bt_key[PATH_MAX] = "";
+ char name[PATH_MAX] = "";
+ int32_t ret = -1;
+ glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL;
+ xlator_t *mgmt_lock_timer_xl = NULL;
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("glusterd", this, out);
+
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, conf, out);
+
+ gf_log (THIS->name, GF_LOG_INFO, "In gd_mgmt_v3_unlock_timer_cbk");
+ GF_ASSERT (NULL != data);
+ key = (char *)data;
+
+ dict_del (conf->mgmt_v3_lock, key);
+
+ type = strrchr (key, '_');
+ strncpy (name, key, strlen (key) - strlen (type) - 1);
+
+ ret = snprintf (bt_key, PATH_MAX, "debug.last-success-bt-%s-%s",
+ name, type + 1);
+ if (ret != strlen ("debug.last-success-bt-") + strlen (name) +
+ strlen (type)) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_CREATE_KEY_FAIL, "Unable to create backtrace "
+ "key");
+ goto out;
+ }
+
+ dict_del (conf->mgmt_v3_lock, bt_key);
+
+ ret = dict_get_bin (conf->mgmt_v3_lock_timer, key,
+ (void **)&mgmt_lock_timer);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
+ "Unable to get lock owner in mgmt_v3 lock");
+ goto out;
+ }
+
+out:
+ if (mgmt_lock_timer->timer) {
+ mgmt_lock_timer_xl = mgmt_lock_timer->xl;
+ GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_xl,
+ ret_function);
+
+ mgmt_lock_timer_ctx = mgmt_lock_timer_xl->ctx;
+ GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_ctx,
+ ret_function);
+
+ gf_timer_call_cancel (mgmt_lock_timer_ctx,
+ mgmt_lock_timer->timer);
+ GF_FREE(key);
+ dict_del (conf->mgmt_v3_lock_timer, bt_key);
+ mgmt_lock_timer->timer = NULL;
+ }
+
+ret_function:
+
+ return;
+}
+
int32_t
glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
{
- char key[PATH_MAX] = "";
- int32_t ret = -1;
- gf_boolean_t is_valid = _gf_true;
- glusterd_conf_t *priv = NULL;
- uuid_t owner = {0};
- xlator_t *this = NULL;
+ char key[PATH_MAX] = "";
+ char key_dup[PATH_MAX] = "";
+ int32_t ret = -1;
+ gf_boolean_t is_valid = _gf_true;
+ glusterd_conf_t *priv = NULL;
+ glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL;
+ uuid_t owner = {0};
+ xlator_t *this = NULL;
+ glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL;
+ xlator_t *mgmt_lock_timer_xl = NULL;
this = THIS;
GF_ASSERT (this);
+
priv = this->private;
GF_ASSERT (priv);
@@ -657,6 +823,7 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
ret = -1;
goto out;
}
+ strncpy (key_dup, key, strlen(key));
gf_msg_debug (this->name, 0,
"Trying to release lock of %s %s for %s as %s",
@@ -690,6 +857,15 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
/* Removing the mgmt_v3 lock from the global list */
dict_del (priv->mgmt_v3_lock, key);
+ ret = dict_get_bin (priv->mgmt_v3_lock_timer, key,
+ (void **)&mgmt_lock_timer);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
+ "Unable to get mgmt lock key in mgmt_v3 lock");
+ goto out;
+ }
+
/* Remove the backtrace key as well */
ret = snprintf (key, sizeof(key), "debug.last-success-bt-%s-%s", name,
type);
@@ -708,7 +884,22 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
type, name);
ret = 0;
+ /* Release owner refernce which was held during lock */
+ if (mgmt_lock_timer->timer) {
+ ret = -1;
+ mgmt_lock_timer_xl = mgmt_lock_timer->xl;
+ GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_xl, out);
+
+ mgmt_lock_timer_ctx = mgmt_lock_timer_xl->ctx;
+ GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_ctx, out);
+ ret = 0;
+ gf_timer_call_cancel (mgmt_lock_timer_ctx,
+ mgmt_lock_timer->timer);
+ dict_del (priv->mgmt_v3_lock_timer, key_dup);
+ mgmt_lock_timer->timer = NULL;
+ }
out:
+
gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.h b/xlators/mgmt/glusterd/src/glusterd-locks.h
index 437053d..226d5c6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.h
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.h
@@ -14,6 +14,11 @@ typedef struct glusterd_mgmt_v3_lock_object_ {
uuid_t lock_owner;
} glusterd_mgmt_v3_lock_obj;
+typedef struct glusterd_mgmt_v3_lock_timer_ {
+ gf_timer_t *timer;
+ xlator_t *xl;
+} glusterd_mgmt_v3_lock_timer;
+
typedef struct glusterd_mgmt_v3_lock_valid_entities {
char *type; /* Entity type like vol, snap */
gf_boolean_t default_value; /* The default value that *
@@ -29,6 +34,12 @@ void
glusterd_mgmt_v3_lock_fini ();
int32_t
+glusterd_mgmt_v3_lock_timer_init ();
+
+void
+glusterd_mgmt_v3_lock_timer_fini ();
+
+int32_t
glusterd_get_mgmt_v3_lock_owner (char *volname, uuid_t *uuid);
int32_t
@@ -44,4 +55,6 @@ glusterd_multiple_mgmt_v3_lock (dict_t *dict, uuid_t uuid, uint32_t *op_errno);
int32_t
glusterd_multiple_mgmt_v3_unlock (dict_t *dict, uuid_t uuid);
+void
+gd_mgmt_v3_unlock_timer_cbk(void *data);
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 6ce4156..ed01b93 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1858,14 +1858,22 @@ init (xlator_t *this)
gf_msg (this->name, GF_LOG_INFO, 0,
GD_MSG_DICT_SET_FAILED,
"base-port override: %d", conf->base_port);
- }
- conf->max_port = GF_PORT_MAX;
- if (dict_get_uint32 (this->options, "max-port",
- &conf->max_port) == 0) {
+ }
+ conf->max_port = GF_PORT_MAX;
+ if (dict_get_uint32 (this->options, "max-port",
+ &conf->max_port) == 0) {
gf_msg (this->name, GF_LOG_INFO, 0,
GD_MSG_DICT_SET_FAILED,
"max-port override: %d", conf->max_port);
- }
+ }
+
+ conf->mgmt_v3_lock_timeout = GF_LOCK_TIMER;
+ if (dict_get_uint32 (this->options, "lock-timer",
+ &conf->mgmt_v3_lock_timeout) == 0) {
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_DICT_SET_FAILED,
+ "lock-timer override: %d", conf->mgmt_v3_lock_timeout);
+ }
/* Set option to run bricks on valgrind if enabled in glusterd.vol */
this->ctx->cmd_args.valgrind = valgrind;
@@ -1891,6 +1899,7 @@ init (xlator_t *this)
this->private = conf;
glusterd_mgmt_v3_lock_init ();
+ glusterd_mgmt_v3_lock_timer_init();
glusterd_txn_opinfo_dict_init ();
glusterd_svcs_build ();
@@ -2048,6 +2057,7 @@ fini (xlator_t *this)
gf_store_handle_destroy (conf->handle);
glusterd_sm_tr_log_delete (&conf->op_sm_log);
glusterd_mgmt_v3_lock_fini ();
+ glusterd_mgmt_v3_lock_timer_fini ();
glusterd_txn_opinfo_dict_fini ();
GF_FREE (conf);
@@ -2171,6 +2181,14 @@ struct volume_options options[] = {
.max = GF_PORT_MAX,
.description = "Sets the max port for portmap query"
},
+ { .key = {"mgmt-v3-lock-timeout"},
+ .type = GF_OPTION_TYPE_INT,
+ .max = 600,
+ .description = "Sets the mgmt-v3-lock-timeout for transactions."
+ "Specifes the default timeout value after which "
+ "lock acquired while performing transaction will "
+ "be released."
+ },
{ .key = {"snap-brick-path"},
.type = GF_OPTION_TYPE_STR,
.description = "directory where the bricks for the snapshots will be created"
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 291f2f7..59b1775 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -174,6 +174,7 @@ typedef struct {
* cluster with no
* transaction ids */
+ dict_t *mgmt_v3_lock_timer;
struct cds_list_head mount_specs;
pthread_t brick_thread;
void *hooks_priv;
@@ -195,6 +196,7 @@ typedef struct {
uint32_t generation;
int32_t workers;
uint32_t blockers;
+ uint32_t mgmt_v3_lock_timeout;
} glusterd_conf_t;
--
1.8.3.1

View File

@ -1,514 +0,0 @@
From 2278782dddf80611c7305ed982532647e38b5664 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Mon, 16 Oct 2017 14:18:31 +0530
Subject: [PATCH 49/74] Revert "packaging: (ganesha) remove glusterfs-ganesha
subpackage and related files)"
This reverts commit 0cf2963f12a8b540a7042605d8c79f638fdf6cee.
Change-Id: Id6e7585021bd4dd78a59580cfa4838bdd4e539a0
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
---
configure.ac | 3 +
extras/Makefile.am | 2 +-
extras/ganesha/Makefile.am | 2 +
extras/ganesha/config/Makefile.am | 4 +
extras/ganesha/config/ganesha-ha.conf.sample | 19 ++++
extras/ganesha/scripts/Makefile.am | 4 +
extras/ganesha/scripts/create-export-ganesha.sh | 91 +++++++++++++++
extras/ganesha/scripts/dbus-send.sh | 61 +++++++++++
extras/ganesha/scripts/generate-epoch.py | 48 ++++++++
extras/hook-scripts/start/post/Makefile.am | 2 +-
extras/hook-scripts/start/post/S31ganesha-start.sh | 122 +++++++++++++++++++++
glusterfs.spec.in | 10 +-
12 files changed, 362 insertions(+), 6 deletions(-)
create mode 100644 extras/ganesha/Makefile.am
create mode 100644 extras/ganesha/config/Makefile.am
create mode 100644 extras/ganesha/config/ganesha-ha.conf.sample
create mode 100644 extras/ganesha/scripts/Makefile.am
create mode 100755 extras/ganesha/scripts/create-export-ganesha.sh
create mode 100755 extras/ganesha/scripts/dbus-send.sh
create mode 100755 extras/ganesha/scripts/generate-epoch.py
create mode 100755 extras/hook-scripts/start/post/S31ganesha-start.sh
diff --git a/configure.ac b/configure.ac
index dfccd40..c8e6e44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,6 +207,9 @@ AC_CONFIG_FILES([Makefile
extras/init.d/glustereventsd-Debian
extras/init.d/glustereventsd-Redhat
extras/init.d/glustereventsd-FreeBSD
+ extras/ganesha/Makefile
+ extras/ganesha/config/Makefile
+ extras/ganesha/scripts/Makefile
extras/systemd/Makefile
extras/systemd/glusterd.service
extras/systemd/glustereventsd.service
diff --git a/extras/Makefile.am b/extras/Makefile.am
index 6863772..2812a4c 100644
--- a/extras/Makefile.am
+++ b/extras/Makefile.am
@@ -8,7 +8,7 @@ EditorModedir = $(docdir)
EditorMode_DATA = glusterfs-mode.el glusterfs.vim
SUBDIRS = init.d systemd benchmarking hook-scripts $(OCF_SUBDIR) LinuxRPM \
- $(GEOREP_EXTRAS_SUBDIR) snap_scheduler firewalld cliutils
+ $(GEOREP_EXTRAS_SUBDIR) ganesha snap_scheduler firewalld cliutils
confdir = $(sysconfdir)/glusterfs
conf_DATA = glusterfs-logrotate gluster-rsyslog-7.2.conf gluster-rsyslog-5.8.conf \
diff --git a/extras/ganesha/Makefile.am b/extras/ganesha/Makefile.am
new file mode 100644
index 0000000..542de68
--- /dev/null
+++ b/extras/ganesha/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = scripts config
+CLEANFILES =
diff --git a/extras/ganesha/config/Makefile.am b/extras/ganesha/config/Makefile.am
new file mode 100644
index 0000000..c729273
--- /dev/null
+++ b/extras/ganesha/config/Makefile.am
@@ -0,0 +1,4 @@
+EXTRA_DIST= ganesha-ha.conf.sample
+
+confdir = $(sysconfdir)/ganesha
+conf_DATA = ganesha-ha.conf.sample
diff --git a/extras/ganesha/config/ganesha-ha.conf.sample b/extras/ganesha/config/ganesha-ha.conf.sample
new file mode 100644
index 0000000..c22892b
--- /dev/null
+++ b/extras/ganesha/config/ganesha-ha.conf.sample
@@ -0,0 +1,19 @@
+# Name of the HA cluster created.
+# must be unique within the subnet
+HA_NAME="ganesha-ha-360"
+#
+# N.B. you may use short names or long names; you may not use IP addrs.
+# Once you select one, stay with it as it will be mildly unpleasant to
+# clean up if you switch later on. Ensure that all names - short and/or
+# long - are in DNS or /etc/hosts on all machines in the cluster.
+#
+# The subset of nodes of the Gluster Trusted Pool that form the ganesha
+# HA cluster. Hostname is specified.
+HA_CLUSTER_NODES="server1,server2,..."
+#HA_CLUSTER_NODES="server1.lab.redhat.com,server2.lab.redhat.com,..."
+#
+# Virtual IPs for each of the nodes specified above.
+VIP_server1="10.0.2.1"
+VIP_server2="10.0.2.2"
+#VIP_server1_lab_redhat_com="10.0.2.1"
+#VIP_server2_lab_redhat_com="10.0.2.2"
diff --git a/extras/ganesha/scripts/Makefile.am b/extras/ganesha/scripts/Makefile.am
new file mode 100644
index 0000000..9ee8867
--- /dev/null
+++ b/extras/ganesha/scripts/Makefile.am
@@ -0,0 +1,4 @@
+EXTRA_DIST= create-export-ganesha.sh generate-epoch.py dbus-send.sh
+
+scriptsdir = $(libexecdir)/ganesha
+scripts_SCRIPTS = create-export-ganesha.sh generate-epoch.py
diff --git a/extras/ganesha/scripts/create-export-ganesha.sh b/extras/ganesha/scripts/create-export-ganesha.sh
new file mode 100755
index 0000000..1ffba42
--- /dev/null
+++ b/extras/ganesha/scripts/create-export-ganesha.sh
@@ -0,0 +1,91 @@
+#!/bin/bash
+
+#This script is called by glusterd when the user
+#tries to export a volume via NFS-Ganesha.
+#An export file specific to a volume
+#is created in GANESHA_DIR/exports.
+
+# Try loading the config from any of the distro
+# specific configuration locations
+if [ -f /etc/sysconfig/ganesha ]
+ then
+ . /etc/sysconfig/ganesha
+fi
+if [ -f /etc/conf.d/ganesha ]
+ then
+ . /etc/conf.d/ganesha
+fi
+if [ -f /etc/default/ganesha ]
+ then
+ . /etc/default/ganesha
+fi
+
+GANESHA_DIR=${1%/}
+OPTION=$2
+VOL=$3
+CONF=$GANESHA_DIR"/ganesha.conf"
+declare -i EXPORT_ID
+
+function check_cmd_status()
+{
+ if [ "$1" != "0" ]
+ then
+ rm -rf $GANESHA_DIR/exports/export.$VOL.conf
+ sed -i /$VOL.conf/d $CONF
+ exit 1
+ fi
+}
+
+
+if [ ! -d "$GANESHA_DIR/exports" ];
+ then
+ mkdir $GANESHA_DIR/exports
+ check_cmd_status `echo $?`
+fi
+
+function write_conf()
+{
+echo -e "# WARNING : Using Gluster CLI will overwrite manual
+# changes made to this file. To avoid it, edit the
+# file and run ganesha-ha.sh --refresh-config."
+
+echo "EXPORT{"
+echo " Export_Id = 2;"
+echo " Path = \"/$VOL\";"
+echo " FSAL {"
+echo " name = "GLUSTER";"
+echo " hostname=\"localhost\";"
+echo " volume=\"$VOL\";"
+echo " }"
+echo " Access_type = RW;"
+echo " Disable_ACL = true;"
+echo ' Squash="No_root_squash";'
+echo " Pseudo=\"/$VOL\";"
+echo ' Protocols = "3", "4" ;'
+echo ' Transports = "UDP","TCP";'
+echo ' SecType = "sys";'
+echo " }"
+}
+if [ "$OPTION" = "on" ];
+then
+ if ! (cat $CONF | grep $VOL.conf\"$ )
+ then
+ write_conf $@ > $GANESHA_DIR/exports/export.$VOL.conf
+ echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF
+ count=`ls -l $GANESHA_DIR/exports/*.conf | wc -l`
+ if [ "$count" = "1" ] ; then
+ EXPORT_ID=2
+ else
+ EXPORT_ID=`cat $GANESHA_DIR/.export_added`
+ check_cmd_status `echo $?`
+ EXPORT_ID=EXPORT_ID+1
+ sed -i s/Export_Id.*/"Export_Id= $EXPORT_ID ;"/ \
+ $GANESHA_DIR/exports/export.$VOL.conf
+ check_cmd_status `echo $?`
+ fi
+ echo $EXPORT_ID > $GANESHA_DIR/.export_added
+ fi
+else
+ rm -rf $GANESHA_DIR/exports/export.$VOL.conf
+ sed -i /$VOL.conf/d $CONF
+fi
diff --git a/extras/ganesha/scripts/dbus-send.sh b/extras/ganesha/scripts/dbus-send.sh
new file mode 100755
index 0000000..c071d03
--- /dev/null
+++ b/extras/ganesha/scripts/dbus-send.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+# Try loading the config from any of the distro
+# specific configuration locations
+if [ -f /etc/sysconfig/ganesha ]
+ then
+ . /etc/sysconfig/ganesha
+fi
+if [ -f /etc/conf.d/ganesha ]
+ then
+ . /etc/conf.d/ganesha
+fi
+if [ -f /etc/default/ganesha ]
+ then
+ . /etc/default/ganesha
+fi
+
+GANESHA_DIR=${1%/}
+OPTION=$2
+VOL=$3
+CONF=$GANESHA_DIR"/ganesha.conf"
+
+function check_cmd_status()
+{
+ if [ "$1" != "0" ]
+ then
+ logger "dynamic export failed on node :${hostname -s}"
+ fi
+}
+
+#This function keeps track of export IDs and increments it with every new entry
+function dynamic_export_add()
+{
+ dbus-send --system \
+--dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
+org.ganesha.nfsd.exportmgr.AddExport string:$GANESHA_DIR/exports/export.$VOL.conf \
+string:"EXPORT(Path=/$VOL)"
+ check_cmd_status `echo $?`
+}
+
+#This function removes an export dynamically(uses the export_id of the export)
+function dynamic_export_remove()
+{
+ removed_id=`cat $GANESHA_DIR/exports/export.$VOL.conf |\
+grep Export_Id | awk -F"[=,;]" '{print$2}'| tr -d '[[:space:]]'`
+ dbus-send --print-reply --system \
+--dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
+org.ganesha.nfsd.exportmgr.RemoveExport uint16:$removed_id
+ check_cmd_status `echo $?`
+}
+
+if [ "$OPTION" = "on" ];
+then
+ dynamic_export_add $@
+fi
+
+if [ "$OPTION" = "off" ];
+then
+ dynamic_export_remove $@
+fi
+
diff --git a/extras/ganesha/scripts/generate-epoch.py b/extras/ganesha/scripts/generate-epoch.py
new file mode 100755
index 0000000..5db5e56
--- /dev/null
+++ b/extras/ganesha/scripts/generate-epoch.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
+# This file is part of GlusterFS.
+#
+# This file is licensed to you under your choice of the GNU Lesser
+# General Public License, version 3 or any later version (LGPLv3 or
+# later), or the GNU General Public License, version 2 (GPLv2), in all
+# cases as published by the Free Software Foundation.
+#
+# Generates unique epoch value on each gluster node to be used by
+# nfs-ganesha service on that node.
+#
+# Configure 'EPOCH_EXEC' option to this script path in
+# '/etc/sysconfig/ganesha' file used by nfs-ganesha service.
+#
+# Construct epoch as follows -
+# first 32-bit contains the now() time
+# rest 32-bit value contains the local glusterd node uuid
+
+import time
+import binascii
+
+# Calculate the now() time into a 64-bit integer value
+def epoch_now():
+ epoch_time = int(time.mktime(time.localtime())) << 32
+ return epoch_time
+
+# Read glusterd UUID and extract first 32-bit of it
+def epoch_uuid():
+ file_name = '/var/lib/glusterd/glusterd.info'
+
+ for line in open(file_name):
+ if "UUID" in line:
+ glusterd_uuid = line.split('=')[1].strip()
+
+ uuid_bin = binascii.unhexlify(glusterd_uuid.replace("-",""))
+
+ epoch_uuid = int(uuid_bin.encode('hex'), 32) & 0xFFFF0000
+ return epoch_uuid
+
+# Construct epoch as follows -
+# first 32-bit contains the now() time
+# rest 32-bit value contains the local glusterd node uuid
+epoch = (epoch_now() | epoch_uuid())
+print str(epoch)
+
+exit(0)
diff --git a/extras/hook-scripts/start/post/Makefile.am b/extras/hook-scripts/start/post/Makefile.am
index 384a582..03bb300 100644
--- a/extras/hook-scripts/start/post/Makefile.am
+++ b/extras/hook-scripts/start/post/Makefile.am
@@ -1,4 +1,4 @@
-EXTRA_DIST = S29CTDBsetup.sh S30samba-start.sh
+EXTRA_DIST = S29CTDBsetup.sh S30samba-start.sh S31ganesha-start.sh
hookdir = $(GLUSTERD_WORKDIR)/hooks/1/start/post/
hook_SCRIPTS = $(EXTRA_DIST)
diff --git a/extras/hook-scripts/start/post/S31ganesha-start.sh b/extras/hook-scripts/start/post/S31ganesha-start.sh
new file mode 100755
index 0000000..90ba6bc
--- /dev/null
+++ b/extras/hook-scripts/start/post/S31ganesha-start.sh
@@ -0,0 +1,122 @@
+#!/bin/bash
+PROGNAME="Sganesha-start"
+OPTSPEC="volname:,gd-workdir:"
+VOL=
+declare -i EXPORT_ID
+ganesha_key="ganesha.enable"
+GANESHA_DIR="/var/run/gluster/shared_storage/nfs-ganesha"
+CONF1="$GANESHA_DIR/ganesha.conf"
+GLUSTERD_WORKDIR=
+
+function parse_args ()
+{
+ ARGS=$(getopt -l $OPTSPEC -o "o" -name $PROGNAME $@)
+ eval set -- "$ARGS"
+
+ while true; do
+ case $1 in
+ --volname)
+ shift
+ VOL=$1
+ ;;
+ --gd-workdir)
+ shift
+ GLUSTERD_WORKDIR=$1
+ ;;
+ *)
+ shift
+ break
+ ;;
+ esac
+ shift
+ done
+}
+
+
+
+#This function generates a new export entry as export.volume_name.conf
+function write_conf()
+{
+echo -e "# WARNING : Using Gluster CLI will overwrite manual
+# changes made to this file. To avoid it, edit the
+# file, copy it over to all the NFS-Ganesha nodes
+# and run ganesha-ha.sh --refresh-config."
+
+echo "EXPORT{"
+echo " Export_Id = 2;"
+echo " Path = \"/$VOL\";"
+echo " FSAL {"
+echo " name = \"GLUSTER\";"
+echo " hostname=\"localhost\";"
+echo " volume=\"$VOL\";"
+echo " }"
+echo " Access_type = RW;"
+echo " Disable_ACL = true;"
+echo " Squash=\"No_root_squash\";"
+echo " Pseudo=\"/$VOL\";"
+echo " Protocols = \"3\", \"4\" ;"
+echo " Transports = \"UDP\",\"TCP\";"
+echo " SecType = \"sys\";"
+echo "}"
+}
+
+#It adds the export dynamically by sending dbus signals
+function export_add()
+{
+ dbus-send --print-reply --system --dest=org.ganesha.nfsd \
+/org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.AddExport \
+string:$GANESHA_DIR/exports/export.$VOL.conf string:"EXPORT(Export_Id=$EXPORT_ID)"
+
+}
+
+# based on src/scripts/ganeshactl/Ganesha/export_mgr.py
+function is_exported()
+{
+ local volume="${1}"
+
+ dbus-send --type=method_call --print-reply --system \
+ --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
+ org.ganesha.nfsd.exportmgr.ShowExports \
+ | grep -w -q "/${volume}"
+
+ return $?
+}
+
+# Check the info file (contains the volume options) to see if Ganesha is
+# enabled for this volume.
+function ganesha_enabled()
+{
+ local volume="${1}"
+ local info_file="${GLUSTERD_WORKDIR}/vols/${VOL}/info"
+ local enabled="off"
+
+ enabled=$(grep -w ${ganesha_key} ${info_file} | cut -d"=" -f2)
+
+ [ "${enabled}" == "on" ]
+
+ return $?
+}
+
+parse_args $@
+
+if ganesha_enabled ${VOL} && ! is_exported ${VOL}
+then
+ if [ ! -e ${GANESHA_DIR}/exports/export.${VOL}.conf ]
+ then
+ #Remove export entry from nfs-ganesha.conf
+ sed -i /$VOL.conf/d $CONF1
+ write_conf ${VOL} > ${GANESHA_DIR}/exports/export.${VOL}.conf
+ EXPORT_ID=`cat $GANESHA_DIR/.export_added`
+ EXPORT_ID=EXPORT_ID+1
+ echo $EXPORT_ID > $GANESHA_DIR/.export_added
+ sed -i s/Export_Id.*/"Export_Id=$EXPORT_ID;"/ \
+ $GANESHA_DIR/exports/export.$VOL.conf
+ echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF1
+ else
+ EXPORT_ID=$(grep ^[[:space:]]*Export_Id $GANESHA_DIR/exports/export.$VOL.conf |\
+ awk -F"[=,;]" '{print $2}' | tr -d '[[:space:]]')
+ fi
+ export_add $VOL
+fi
+
+exit 0
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 10339fe..6e710e5 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -262,7 +262,6 @@ Obsoletes: hekafs
Obsoletes: %{name}-common < %{version}-%{release}
Obsoletes: %{name}-core < %{version}-%{release}
Obsoletes: %{name}-ufo
-Obsoletes: %{name}-ganesha
Provides: %{name}-common = %{version}-%{release}
Provides: %{name}-core = %{version}-%{release}
@@ -1275,6 +1274,9 @@ exit 0
%if ( 0%{?_build_server} )
%files ganesha
+%{_sysconfdir}/ganesha/*
+%{_libexecdir}/ganesha/*
+%{_sharedstatedir}/glusterd/hooks/1/start/post/S31ganesha-start.sh
%endif
%if ( 0%{?_build_server} )
@@ -2121,6 +2123,9 @@ fi
%changelog
* Mon Nov 13 2017 Jiffin Tony Thottan <jthottan@redhat.com>
+- Adding ganesha bits back in gluster repository #1499784
+
+* Mon Nov 13 2017 Jiffin Tony Thottan <jthottan@redhat.com>
- DOWNSTREAM ONLY - revert of 83abcb(gnfs in an optional subpackage)
* Tue Oct 10 2017 Milind Changire <mchangir@redhat.com>
@@ -2178,9 +2183,6 @@ fi
* Thu Feb 16 2017 Niels de Vos <ndevos@redhat.com>
- Obsolete and Provide python-gluster for upgrading from glusterfs < 3.10
-* Tue Feb 7 2017 Kaleb S. KEITHLEY <kkeithle@redhat.com>
-- remove ganesha (#1418417)
-
* Wed Feb 1 2017 Poornima G <pgurusid@redhat.com>
- Install /var/lib/glusterd/groups/metadata-cache by default
--
1.8.3.1

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,235 +0,0 @@
From a4d7f6c1999f2c7837aaa674177edca9298d1c00 Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Fri, 7 Apr 2017 09:09:29 -0400
Subject: [PATCH 52/74] common-ha: fixes for Debian-based systems
1) Debian-based systems don't have /usr/libexec/... and there is
a hard-coded invocation of /usr/libexec/ganesha/ganesha-ha.sh within
ganesha-ha.sh itself.
Fix: save $0 and use it instead for further invocations of self.
2) default shell is /bin/dash (not /bin/bash). Various runner_run()
invocations for ganesha used what amounts to
exec("sh /usr/$libexec/ganesha/ganesha-ha.sh ...);
which executes the script using the default shell, but there are
some bash-specific idioms that don't work if the shell is dash.
Fix: change to exec("/usr/$libexec/ganesha/ganesha-ha.sh ...); so that
the shebang forces the use of /bin/bash
3) Fedora and RHEL7 have merged /bin/ and /usr/bin, /bin is a symlink
to /usr/bin. Debian-based systems are not merged, and systemd systems
have /bin/systemctl. The logic to find .../bin/systemctl is backwards.
If the logic looks for /usr/bin/systemctl it will not find it on
Debian-based systems; if it looks for /bin/systemctl it will find it
on Fedora and RHEL by virtue of the symlink. (RHEL6 and others will
find their respective init regardless.)
Fix: change the logic to look for /bin/systemctl instead.
4) The logic for deciding to run systemctl (or not) is a bit silly.
Fix: simply invoke the found method via the function pointer in the
table.
Change-Id: I33681b296a73aebb078bda6ac0d3a1d3b9770a21
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/17013
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
---
extras/ganesha/scripts/ganesha-ha.sh | 21 ++++++-------
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 44 +++++++++++++---------------
2 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index e4135ba..d4844e4 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -20,6 +20,7 @@
# ensure that the NFS GRACE DBUS signal is sent after the VIP moves to
# the new host.
+GANESHA_HA_SH=$(realpath $0)
HA_NUM_SERVERS=0
HA_SERVERS=""
HA_VOL_NAME="gluster_shared_storage"
@@ -68,9 +69,9 @@ function find_rhel7_conf
done
}
-if [ -z $CONFFILE ]
+if [ -z ${CONFFILE} ]
then
- find_rhel7_conf $OPTIONS
+ find_rhel7_conf ${OPTIONS}
fi
@@ -90,9 +91,9 @@ usage() {
determine_service_manager () {
- if [ -e "/usr/bin/systemctl" ];
+ if [ -e "/bin/systemctl" ];
then
- SERVICE_MAN="/usr/bin/systemctl"
+ SERVICE_MAN="/bin/systemctl"
elif [ -e "/sbin/invoke-rc.d" ];
then
SERVICE_MAN="/sbin/invoke-rc.d"
@@ -100,7 +101,7 @@ determine_service_manager () {
then
SERVICE_MAN="/sbin/service"
fi
- if [ "$SERVICE_MAN" == "DISTRO_NOT_FOUND" ]
+ if [ "${SERVICE_MAN}" == "DISTRO_NOT_FOUND" ]
then
echo "Service manager not recognized, exiting"
exit 1
@@ -113,21 +114,21 @@ manage_service ()
local new_node=${2}
local option=
- if [ "$action" == "start" ]; then
+ if [ "${action}" == "start" ]; then
option="yes"
else
option="no"
fi
ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
-${SECRET_PEM} root@${new_node} "/usr/libexec/ganesha/ganesha-ha.sh --setup-ganesha-conf-files $HA_CONFDIR $option"
+${SECRET_PEM} root@${new_node} "${GANESHA_HA_SH} --setup-ganesha-conf-files $HA_CONFDIR $option"
- if [ "$SERVICE_MAN" == "/usr/bin/systemctl" ]
+ if [ "${SERVICE_MAN}" == "/bin/systemctl" ]
then
ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
-${SECRET_PEM} root@${new_node} "$SERVICE_MAN ${action} nfs-ganesha"
+${SECRET_PEM} root@${new_node} "${SERVICE_MAN} ${action} nfs-ganesha"
else
ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
-${SECRET_PEM} root@${new_node} "$SERVICE_MAN nfs-ganesha ${action}"
+${SECRET_PEM} root@${new_node} "${SERVICE_MAN} nfs-ganesha ${action}"
fi
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index 4346bad..c16dd72 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -119,11 +119,10 @@ sc_service_action (struct service_command *sc, char *command)
static int
manage_service (char *action)
{
- struct stat stbuf = {0,};
int i = 0;
int ret = 0;
struct service_command sc_list[] = {
- { .binary = "/usr/bin/systemctl",
+ { .binary = "/bin/systemctl",
.service = "nfs-ganesha",
.action = sc_systemctl_action
},
@@ -140,16 +139,11 @@ manage_service (char *action)
};
while (sc_list[i].binary != NULL) {
- ret = sys_stat (sc_list[i].binary, &stbuf);
+ ret = sys_access (sc_list[i].binary, X_OK);
if (ret == 0) {
gf_msg_debug (THIS->name, 0,
- "%s found.", sc_list[i].binary);
- if (strcmp (sc_list[i].binary, "/usr/bin/systemctl") == 0)
- ret = sc_systemctl_action (&sc_list[i], action);
- else
- ret = sc_service_action (&sc_list[i], action);
-
- return ret;
+ "%s found.", sc_list[i].binary);
+ return sc_list[i].action (&sc_list[i], action);
}
i++;
}
@@ -465,9 +459,9 @@ manage_export_config (char *volname, char *value, char **op_errstr)
GF_ASSERT(volname);
runinit (&runner);
- runner_add_args (&runner, "sh",
- GANESHA_PREFIX"/create-export-ganesha.sh",
- CONFDIR, value, volname, NULL);
+ runner_add_args (&runner,
+ GANESHA_PREFIX"/create-export-ganesha.sh",
+ CONFDIR, value, volname, NULL);
ret = runner_run(&runner);
if (ret)
@@ -570,8 +564,9 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr)
}
if (check_host_list()) {
- runner_add_args (&runner, "sh", GANESHA_PREFIX"/dbus-send.sh",
- CONFDIR, value, volname, NULL);
+ runner_add_args (&runner,
+ GANESHA_PREFIX"/dbus-send.sh",
+ CONFDIR, value, volname, NULL);
ret = runner_run (&runner);
if (ret) {
gf_asprintf(op_errstr, "Dynamic export"
@@ -610,9 +605,9 @@ tear_down_cluster(gf_boolean_t run_teardown)
if (run_teardown) {
runinit (&runner);
- runner_add_args (&runner, "sh",
- GANESHA_PREFIX"/ganesha-ha.sh", "teardown",
- CONFDIR, NULL);
+ runner_add_args (&runner,
+ GANESHA_PREFIX"/ganesha-ha.sh", "teardown",
+ CONFDIR, NULL);
ret = runner_run(&runner);
/* *
* Remove all the entries in CONFDIR expect ganesha.conf and
@@ -675,7 +670,8 @@ setup_cluster(gf_boolean_t run_setup)
if (run_setup) {
runinit (&runner);
- runner_add_args (&runner, "sh", GANESHA_PREFIX"/ganesha-ha.sh",
+ runner_add_args (&runner,
+ GANESHA_PREFIX"/ganesha-ha.sh",
"setup", CONFDIR, NULL);
ret = runner_run (&runner);
}
@@ -702,8 +698,9 @@ teardown (gf_boolean_t run_teardown, char **op_errstr)
}
runinit (&runner);
- runner_add_args (&runner, "sh", GANESHA_PREFIX"/ganesha-ha.sh",
- "cleanup", CONFDIR, NULL);
+ runner_add_args (&runner,
+ GANESHA_PREFIX"/ganesha-ha.sh",
+ "cleanup", CONFDIR, NULL);
ret = runner_run (&runner);
if (ret)
gf_msg_debug (THIS->name, 0, "Could not clean up"
@@ -747,7 +744,8 @@ stop_ganesha (char **op_errstr) {
runner_t runner = {0,};
runinit (&runner);
- runner_add_args (&runner, "sh", GANESHA_PREFIX"/ganesha-ha.sh",
+ runner_add_args (&runner,
+ GANESHA_PREFIX"/ganesha-ha.sh",
"--setup-ganesha-conf-files", CONFDIR, "no", NULL);
ret = runner_run (&runner);
if (ret) {
@@ -810,7 +808,7 @@ start_ganesha (char **op_errstr)
if (check_host_list()) {
runinit (&runner);
- runner_add_args (&runner, "sh", GANESHA_PREFIX"/ganesha-ha.sh",
+ runner_add_args (&runner, GANESHA_PREFIX"/ganesha-ha.sh",
"--setup-ganesha-conf-files", CONFDIR, "yes",
NULL);
ret = runner_run (&runner);
--
1.8.3.1

View File

@ -1,33 +0,0 @@
From bfad2cafc9cbb58161386ee71dd086f01176558e Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Wed, 22 Feb 2017 14:37:04 +0530
Subject: [PATCH 53/74] ganesha/scripts : Remove export entries from
ganesha.conf during cleanup
Change-Id: I288f7c9ced23d258a7ce1242d8efe03a4bf6f746
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/16708
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
---
extras/ganesha/scripts/ganesha-ha.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index d4844e4..2d6b06f 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -342,6 +342,7 @@ cleanup_ganesha_config ()
rm -f /etc/corosync/corosync.conf
rm -rf /etc/cluster/cluster.conf*
rm -rf /var/lib/pacemaker/cib/*
+ sed -r -i -e '/^%include[[:space:]]+".+\.conf"$/d' $HA_CONFDIR/ganesha.conf
}
do_create_virt_ip_constraints()
--
1.8.3.1

View File

@ -1,55 +0,0 @@
From 1a9717eb9fb0c6ebd4fce5aa85e3ed53bdd69d59 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Wed, 22 Feb 2017 14:20:41 +0530
Subject: [PATCH 54/74] glusterd/ganesha : During volume delete remove the
ganesha export configuration file
Change-Id: I0363e7f4d7cefd3f1b3c4f91e495767ec52e230e
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/16707
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 2 +-
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index c16dd72..e176df9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -464,7 +464,7 @@ manage_export_config (char *volname, char *value, char **op_errstr)
CONFDIR, value, volname, NULL);
ret = runner_run(&runner);
- if (ret)
+ if (ret && !(*op_errstr))
gf_asprintf (op_errstr, "Failed to create"
" NFS-Ganesha export config file.");
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 0914fb1..92db458 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -2853,6 +2853,14 @@ glusterd_op_delete_volume (dict_t *dict)
volname);
goto out;
}
+ if (glusterd_check_ganesha_export (volinfo)) {
+ ret = manage_export_config (volname, "off", NULL);
+ if (ret)
+ gf_msg (this->name, GF_LOG_WARNING, 0, 0,
+ "Could not delete ganesha export conf file "
+ "for %s", volname);
+ }
+
ret = glusterd_delete_volume (volinfo);
out:
--
1.8.3.1

View File

@ -1,125 +0,0 @@
From 6683f3c2702f635a95623c427f343385a1ad8c63 Mon Sep 17 00:00:00 2001
From: jiffin tony thottan <jthottan@redhat.com>
Date: Mon, 7 Dec 2015 14:38:54 +0530
Subject: [PATCH 55/74] glusterd/ganesha : throw proper error for "gluster
nfs-ganesha disable"
For first time or if "gluster nfs-ganesha enable" fails the global option
"nfs-ganesha" won't be stored in glusterd's dictionary. In both cases the
"gluster nfs-ganesha disable" throws following error :
"nfs-ganesha: failed: nfs-ganesha is already (null)d."
Also this patch provides the missing prompt for nfs-ganesha disable in 3.10
Change-Id: I7c9fd6dabedc0cfb14c5190b3554bc63a6bc0340
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/16791
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
---
cli/src/cli-cmd-parser.c | 30 ++++++++++++++++++----------
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 28 +++++++++-----------------
2 files changed, 28 insertions(+), 30 deletions(-)
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index a4c601b..a35fc74 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -897,18 +897,26 @@ cli_cmd_ganesha_parse (struct cli_state *state,
goto out;
}
- question = "Enabling NFS-Ganesha requires Gluster-NFS to be"
- " disabled across the trusted pool. Do you "
- "still want to continue?\n";
-
if (strcmp (value, "enable") == 0) {
- answer = cli_cmd_get_confirmation (state, question);
- if (GF_ANSWER_NO == answer) {
- gf_log ("cli", GF_LOG_ERROR, "Global operation "
- "cancelled, exiting");
- ret = -1;
- goto out;
- }
+ question = "Enabling NFS-Ganesha requires Gluster-NFS to be "
+ "disabled across the trusted pool. Do you "
+ "still want to continue?\n";
+
+ } else if (strcmp (value, "disable") == 0) {
+ question = "Disabling NFS-Ganesha will tear down the entire "
+ "ganesha cluster across the trusted pool. Do you "
+ "still want to continue?\n";
+ } else {
+ ret = -1;
+ goto out;
+ }
+
+ answer = cli_cmd_get_confirmation (state, question);
+ if (GF_ANSWER_NO == answer) {
+ gf_log ("cli", GF_LOG_ERROR, "Global operation "
+ "cancelled, exiting");
+ ret = -1;
+ goto out;
}
cli_out ("This will take a few minutes to complete. Please wait ..");
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index e176df9..5c582cd 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -258,8 +258,7 @@ int
glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr)
{
int ret = -1;
- int value = -1;
- gf_boolean_t option = _gf_false;
+ char *value = NULL;
char *str = NULL;
glusterd_conf_t *priv = NULL;
xlator_t *this = NULL;
@@ -270,8 +269,8 @@ glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr)
priv = this->private;
GF_ASSERT (priv);
- value = dict_get_str_boolean (dict, "value", _gf_false);
- if (value == -1) {
+ ret = dict_get_str (dict, "value", &value);
+ if (value == NULL) {
gf_msg (this->name, GF_LOG_ERROR, errno,
GD_MSG_DICT_GET_FAILED,
"value not present.");
@@ -280,22 +279,13 @@ glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr)
/* This dict_get will fail if the user had never set the key before */
/*Ignoring the ret value and proceeding */
ret = dict_get_str (priv->opts, GLUSTERD_STORE_KEY_GANESHA_GLOBAL, &str);
- if (ret == -1) {
- gf_msg (this->name, GF_LOG_WARNING, errno,
- GD_MSG_DICT_GET_FAILED, "Global dict not present.");
- ret = 0;
- goto out;
+ /* Check if the feature is already enabled/disable, fail in that case */
+ if (str ? strcmp (value, str) == 0 : strcmp (value, "disable") == 0) {
+ gf_asprintf (op_errstr, "nfs-ganesha is already %sd.", value);
+ ret = -1;
+ goto out;
}
- /* Validity of the value is already checked */
- ret = gf_string2boolean (str, &option);
- /* Check if the feature is already enabled, fail in that case */
- if (value == option) {
- gf_asprintf (op_errstr, "nfs-ganesha is already %sd.", str);
- ret = -1;
- goto out;
- }
-
- if (value) {
+ if (strcmp (value, "enable") == 0) {
ret = start_ganesha (op_errstr);
if (ret) {
gf_msg (THIS->name, GF_LOG_ERROR, 0,
--
1.8.3.1

View File

@ -1,54 +0,0 @@
From 72869da97db070bc00cc0934aebdb8f247b05b55 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Thu, 2 Mar 2017 12:22:30 +0530
Subject: [PATCH 56/74] ganesha/scripts : Stop ganesha process on all nodes if
cluster setup fails
During staging phase of volume option "nfs-ganesha", symlink "ganesha.conf"
will be created plus ganesha process will be started. The cluster setup
happens during commit phase of that option. So if cluster set up fails, the
ganesha process will be running on all cluster nodes.
Change-Id: Ib2cb85364b7ef5b702acb4826ffdf8e6f31a2acd
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/16823
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: soumya k <skoduri@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
---
extras/ganesha/scripts/ganesha-ha.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index 2d6b06f..df4f0b8 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -175,6 +175,13 @@ determine_servers()
fi
}
+stop_ganesha_all()
+{
+ local serverlist=${1}
+ for node in ${serverlist} ; do
+ manage_service "stop" ${node}
+ done
+}
setup_cluster()
{
@@ -191,6 +198,8 @@ setup_cluster()
pcs cluster setup ${RHEL6_PCS_CNAME_OPTION} ${name} --transport udpu ${servers}
if [ $? -ne 0 ]; then
logger "pcs cluster setup ${RHEL6_PCS_CNAME_OPTION} ${name} ${servers} failed"
+ #set up failed stop all ganesha process and clean up symlinks in cluster
+ stop_ganesha_all ${servers}
exit 1;
fi
pcs cluster start --all
--
1.8.3.1

View File

@ -1,117 +0,0 @@
From 17b75c3bf216c53b4303a9c59adaf89d3da328ea Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Wed, 19 Apr 2017 16:12:10 +0530
Subject: [PATCH 57/74] ganesha : allow refresh-config and volume
export/unexport in failover state
If ganesha is not running on one of nodes in HA cluster, then alli dbus
commands send to that ganesha server will fail. This results in both
refresh-config and volume export/unepxort failure. This change will
gracefully handle those scenarios.
Change-Id: I3f1b7b7ca98e54c273c266e56357d8e24dd1b14b
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/17081
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
---
extras/ganesha/scripts/ganesha-ha.sh | 6 ++----
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 25 ++++++++++++++++---------
xlators/mgmt/glusterd/src/glusterd-messages.h | 10 +++++++++-
3 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index df4f0b8..db2fa54 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -275,8 +275,7 @@ string:\"EXPORT(Export_Id=$export_id)\" 2>&1")
ret=$?
logger <<< "${output}"
if [ ${ret} -ne 0 ]; then
- echo "Error: refresh-config failed on ${current_host}."
- exit 1
+ echo "Refresh-config failed on ${current_host}"
else
echo "Refresh-config completed on ${current_host}."
fi
@@ -297,8 +296,7 @@ string:"EXPORT(Export_Id=$export_id)" 2>&1)
ret=$?
logger <<< "${output}"
if [ ${ret} -ne 0 ] ; then
- echo "Error: refresh-config failed on localhost."
- exit 1
+ echo "Refresh-config failed on localhost."
else
echo "Success: refresh-config completed."
fi
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index 5c582cd..38fa378 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -554,15 +554,22 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr)
}
if (check_host_list()) {
- runner_add_args (&runner,
- GANESHA_PREFIX"/dbus-send.sh",
- CONFDIR, value, volname, NULL);
- ret = runner_run (&runner);
- if (ret) {
- gf_asprintf(op_errstr, "Dynamic export"
- " addition/deletion failed."
- " Please see log file for details");
- goto out;
+ /* Check whether ganesha is running on this node */
+ if (manage_service ("status")) {
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ GD_MSG_GANESHA_NOT_RUNNING,
+ "Export failed, NFS-Ganesha is not running");
+ } else {
+ runner_add_args (&runner,
+ GANESHA_PREFIX"/dbus-send.sh",
+ CONFDIR, value, volname, NULL);
+ ret = runner_run (&runner);
+ if (ret) {
+ gf_asprintf(op_errstr, "Dynamic export"
+ " addition/deletion failed."
+ " Please see log file for details");
+ goto out;
+ }
}
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index cc7f371..fb2079f 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 612
+#define GLFS_NUM_MESSAGES 613
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
@@ -4961,6 +4961,14 @@
*/
#define GD_MSG_PORTS_EXHAUSTED (GLUSTERD_COMP_BASE + 612)
+#define GD_MSG_GANESHA_NOT_RUNNING (GLUSTERD_COMP_BASE + 613)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
--
1.8.3.1

View File

@ -1,54 +0,0 @@
From 06a24c4e6ec4d876bb5c9216a6b5f5364d58dc10 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Fri, 28 Apr 2017 17:27:46 +0530
Subject: [PATCH 58/74] glusterd/ganesha : perform removal of ganesha.conf on
nodes only in ganesha cluster
Change-Id: I864ecd9391adf80fb1fa6ad2f9891a9ce77135e7
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/17138
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index 38fa378..2392341 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -740,17 +740,18 @@ stop_ganesha (char **op_errstr) {
int ret = 0;
runner_t runner = {0,};
- runinit (&runner);
- runner_add_args (&runner,
- GANESHA_PREFIX"/ganesha-ha.sh",
- "--setup-ganesha-conf-files", CONFDIR, "no", NULL);
- ret = runner_run (&runner);
- if (ret) {
- gf_asprintf (op_errstr, "removal of symlink ganesha.conf "
- "in /etc/ganesha failed");
- }
-
if (check_host_list ()) {
+ runinit (&runner);
+ runner_add_args (&runner,
+ GANESHA_PREFIX"/ganesha-ha.sh",
+ "--setup-ganesha-conf-files", CONFDIR,
+ "no", NULL);
+ ret = runner_run (&runner);
+ if (ret) {
+ gf_asprintf (op_errstr, "removal of symlink ganesha.conf "
+ "in /etc/ganesha failed");
+ }
+
ret = manage_service ("stop");
if (ret)
gf_asprintf (op_errstr, "NFS-Ganesha service could not"
--
1.8.3.1

View File

@ -1,134 +0,0 @@
From 2cd1f86d0bd47f93f6e278530fc76a1e44aa9333 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Tue, 25 Apr 2017 16:36:40 +0530
Subject: [PATCH 59/74] glusterd/ganesha : update cache invalidation properly
during volume stop
As per current code, during volume stop for ganesha enabled volume the
feature.cache-invalidation was turned "off" in ganesha_manage_export().
And it never turn back to "on" when volume is started. It is not desire
to modify the volume options during stop, this patch fixes above mentioned
issue.
Change-Id: Iea9c62e5cda4f54805b41ea6055cf0c3652a634c
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/17111
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 30 ++++++++++++++-----------
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 4 ++--
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 2 +-
xlators/mgmt/glusterd/src/glusterd.h | 3 ++-
4 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index 2392341..5d6144a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -463,7 +463,8 @@ manage_export_config (char *volname, char *value, char **op_errstr)
/* Exports and unexports a particular volume via NFS-Ganesha */
int
-ganesha_manage_export (dict_t *dict, char *value, char **op_errstr)
+ganesha_manage_export (dict_t *dict, char *value,
+ gf_boolean_t update_cache_invalidation, char **op_errstr)
{
runner_t runner = {0,};
int ret = -1;
@@ -573,17 +574,20 @@ ganesha_manage_export (dict_t *dict, char *value, char **op_errstr)
}
}
- vol_opts = volinfo->dict;
- ret = dict_set_dynstr_with_alloc (vol_opts,
- "features.cache-invalidation", value);
- if (ret)
- gf_asprintf (op_errstr, "Cache-invalidation could not"
- " be set to %s.", value);
- ret = glusterd_store_volinfo (volinfo,
- GLUSTERD_VOLINFO_VER_AC_INCREMENT);
- if (ret)
- gf_asprintf (op_errstr, "failed to store volinfo for %s"
- , volinfo->volname);
+ if (update_cache_invalidation) {
+ vol_opts = volinfo->dict;
+ ret = dict_set_dynstr_with_alloc (vol_opts,
+ "features.cache-invalidation",
+ value);
+ if (ret)
+ gf_asprintf (op_errstr, "Cache-invalidation could not"
+ " be set to %s.", value);
+ ret = glusterd_store_volinfo (volinfo,
+ GLUSTERD_VOLINFO_VER_AC_INCREMENT);
+ if (ret)
+ gf_asprintf (op_errstr, "failed to store volinfo for %s"
+ , volinfo->volname);
+ }
out:
return ret;
@@ -858,7 +862,7 @@ glusterd_handle_ganesha_op (dict_t *dict, char **op_errstr,
if (strcmp (key, "ganesha.enable") == 0) {
- ret = ganesha_manage_export (dict, value, op_errstr);
+ ret = ganesha_manage_export (dict, value, _gf_true, op_errstr);
if (ret < 0)
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 06e9e25..86f18f0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1128,7 +1128,7 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
if ((strcmp (key, "ganesha.enable") == 0) &&
(strcmp (value, "off") == 0)) {
- ret = ganesha_manage_export (dict, "off", op_errstr);
+ ret = ganesha_manage_export (dict, "off", _gf_true, op_errstr);
if (ret)
goto out;
}
@@ -1655,7 +1655,7 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr)
*/
if (volinfo && (!strcmp (key, "all") || !strcmp(key, "ganesha.enable"))) {
if (glusterd_check_ganesha_export (volinfo)) {
- ret = ganesha_manage_export (dict, "off", op_errstr);
+ ret = ganesha_manage_export (dict, "off", _gf_true, op_errstr);
if (ret)
gf_msg (this->name, GF_LOG_WARNING, 0,
GD_MSG_NFS_GNS_RESET_FAIL,
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 92db458..725d194 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1739,7 +1739,7 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr)
}
ret = glusterd_check_ganesha_export (volinfo);
if (ret) {
- ret = ganesha_manage_export(dict, "off", op_errstr);
+ ret = ganesha_manage_export(dict, "off", _gf_false, op_errstr);
if (ret) {
gf_msg (THIS->name, GF_LOG_WARNING, 0,
GD_MSG_NFS_GNS_UNEXPRT_VOL_FAIL, "Could not "
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 2d8dbb9..3ad5ed6 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -1176,7 +1176,8 @@ int glusterd_check_ganesha_cmd (char *key, char *value,
char **errstr, dict_t *dict);
int glusterd_op_stage_set_ganesha (dict_t *dict, char **op_errstr);
int glusterd_op_set_ganesha (dict_t *dict, char **errstr);
-int ganesha_manage_export (dict_t *dict, char *value, char **op_errstr);
+int ganesha_manage_export (dict_t *dict, char *value,
+ gf_boolean_t update_cache_invalidation, char **op_errstr);
int manage_export_config (char *volname, char *value, char **op_errstr);
gf_boolean_t
--
1.8.3.1

View File

@ -1,44 +0,0 @@
From 0ae0579f3c92ecf6270eea308905518ce75efb7b Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Wed, 22 Feb 2017 18:26:30 +0530
Subject: [PATCH 60/74] glusterd/ganesha : return proper value in pre_setup()
Change-Id: I6f7ce82488904c7d418ee078162f26f1ec81e9d9
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/16733
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Tested-by: Raghavendra Talur <rtalur@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
---
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index 5d6144a..cd591df 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -834,15 +834,14 @@ pre_setup (gf_boolean_t run_setup, char **op_errstr)
{
int ret = 0;
- ret = check_host_list();
-
- if (ret) {
+ if (check_host_list()) {
ret = setup_cluster(run_setup);
if (ret == -1)
gf_asprintf (op_errstr, "Failed to set up HA "
"config for NFS-Ganesha. "
"Please check the log file for details");
- }
+ } else
+ ret = -1;
return ret;
}
--
1.8.3.1

View File

@ -1,51 +0,0 @@
From e3dd661b5c8fce818a8e8b601d30bf1af8c3466e Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Thu, 23 Feb 2017 16:21:52 +0530
Subject: [PATCH 61/74] ganesha/scripts : remove dependency over export
configuration file for unexport
Currently unexport is performed by reading export id from volume configuration
file. So unexport has dependency over that file. This patch will unexport with
help of dbus command ShowExport. And it will only unexport the share which is
added via cli.
Change-Id: I6f3c9b2bb48f0328b18e9cc0e4b9356174afd596
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/16771
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
---
extras/ganesha/scripts/dbus-send.sh | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/extras/ganesha/scripts/dbus-send.sh b/extras/ganesha/scripts/dbus-send.sh
index c071d03..a602cd4 100755
--- a/extras/ganesha/scripts/dbus-send.sh
+++ b/extras/ganesha/scripts/dbus-send.sh
@@ -41,8 +41,18 @@ string:"EXPORT(Path=/$VOL)"
#This function removes an export dynamically(uses the export_id of the export)
function dynamic_export_remove()
{
- removed_id=`cat $GANESHA_DIR/exports/export.$VOL.conf |\
-grep Export_Id | awk -F"[=,;]" '{print$2}'| tr -d '[[:space:]]'`
+ # Below bash fetch all the export from ShowExport command and search
+ # export entry based on path and then get its export entry.
+ # There are two possiblities for path, either entire volume will be
+ # exported or subdir. It handles both cases. But it remove only first
+ # entry from the list based on assumption that entry exported via cli
+ # has lowest export id value
+ removed_id=$(dbus-send --type=method_call --print-reply --system \
+ --dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
+ org.ganesha.nfsd.exportmgr.ShowExports | grep -B 1 -we \
+ "/"$VOL -e "/"$VOL"/" | grep uint16 | awk '{print $2}' \
+ | head -1)
+
dbus-send --print-reply --system \
--dest=org.ganesha.nfsd /org/ganesha/nfsd/ExportMgr \
org.ganesha.nfsd.exportmgr.RemoveExport uint16:$removed_id
--
1.8.3.1

View File

@ -1,34 +0,0 @@
From 05c63817ac715fdcf9065568d796b93d97c0be7f Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Tue, 2 May 2017 14:06:00 +0530
Subject: [PATCH 62/74] glusterd/ganesha : add proper NULL check in
manage_export_config
Change-Id: I872b2b6b027f04e61f60ad85588f50e1ef2f988c
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/17150
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
---
xlators/mgmt/glusterd/src/glusterd-ganesha.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-ganesha.c b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
index cd591df..7ba25ee 100644
--- a/xlators/mgmt/glusterd/src/glusterd-ganesha.c
+++ b/xlators/mgmt/glusterd/src/glusterd-ganesha.c
@@ -454,7 +454,7 @@ manage_export_config (char *volname, char *value, char **op_errstr)
CONFDIR, value, volname, NULL);
ret = runner_run(&runner);
- if (ret && !(*op_errstr))
+ if (ret && op_errstr)
gf_asprintf (op_errstr, "Failed to create"
" NFS-Ganesha export config file.");
--
1.8.3.1

View File

@ -1,34 +0,0 @@
From 1212ea61f7c2e04529ec6fa40bba447fc2bd0fe8 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Wed, 3 May 2017 12:47:14 +0530
Subject: [PATCH 63/74] ganesha : minor improvments for commit e91cdf4 (17081)
Change-Id: I3af13e081c5e46cc6f2c132e7a5106ac3355c850
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://review.gluster.org/17152
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
---
extras/ganesha/scripts/ganesha-ha.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index db2fa54..0e4d23a 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -275,7 +275,7 @@ string:\"EXPORT(Export_Id=$export_id)\" 2>&1")
ret=$?
logger <<< "${output}"
if [ ${ret} -ne 0 ]; then
- echo "Refresh-config failed on ${current_host}"
+ echo "Refresh-config failed on ${current_host}. Please check logs on ${current_host}"
else
echo "Refresh-config completed on ${current_host}."
fi
--
1.8.3.1

View File

@ -1,51 +0,0 @@
From 16d3a7d636d115c44516dc415b26d2c6d0d17424 Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Tue, 13 Jun 2017 07:36:50 -0400
Subject: [PATCH 64/74] common-ha: surviving ganesha.nfsd not put in grace on
fail-over
Behavior change is seen in new HA in RHEL 7.4 Beta. Up to now clone
RAs have been created with "pcs resource create ... meta notify=true".
Their notify method is invoked with pre-start or post-stop when one of
the clone RAs is started or stopped.
In 7.4 Beta the notify method we observe that the notify method is not
invoked when one of the clones is stopped (or started).
Ken Gaillot, one of the pacemaker devs, wrote:
With the above command, pcs puts the notify=true meta-attribute
on the primitive instead of the clone. Looking at the pcs help,
that seems expected (--clone notify=true would put it on the clone,
meta notify=true puts it on the primitive). If you drop the "meta"
above, I think it will work again.
And indeed his suggested fix does work on both RHEL 7.4 Beta and RHEL
7.3 and presumably Fedora.
Change-Id: Idbb539f1366df6d39f77431c357dff4e53a2df6d
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/17534
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
---
extras/ganesha/scripts/ganesha-ha.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index 0e4d23a..ce5ff20 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -445,7 +445,7 @@ setup_create_resources()
# ganesha-active crm_attribute
sleep 5
- pcs resource create nfs-grace ocf:heartbeat:ganesha_grace --clone meta notify=true
+ pcs resource create nfs-grace ocf:heartbeat:ganesha_grace --clone notify=true
if [ $? -ne 0 ]; then
logger "warning: pcs resource create nfs-grace ocf:heartbeat:ganesha_grace --clone failed"
fi
--
1.8.3.1

View File

@ -1,85 +0,0 @@
From f16ba446e30197ff1724a5e257b35fb41330835d Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Wed, 21 Jun 2017 10:01:20 -0400
Subject: [PATCH 65/74] common-ha: enable and disable selinux
ganesha_use_fusefs
Starting in Fedora 26 and RHEL 7.4 there are new targeted policies
in selinux which include a tuneable to allow ganesha.nfsd to access
the gluster (FUSE) shared_storage volume where ganesha maintains its
state.
N.B. rpm doesn't have a way to distinguish between RHEL 7.3 or 7.4
so it can't be enabled for RHEL at this time. /usr/sbin/semanage is
in policycoreutils-python in RHEL (versus policycoreutils-python-utils
in Fedora.) Once RHEL 7.4 GAs we may also wish to specify the version
for RHEL 7 explicitly, i.e.
Requires: selinux-policy >= 3.13.1-160.
But beware, the corresponding version in Fedora 26 seems to be
selinux-policy-3.13.1.258 or so. (Maybe earlier versions, but that's
what's currently in the F26 beta.
release-3.10 is the upstream master branch for glusterfs-ganesha. For
release-3.11 and later storhaug needs a similar change, which is
tracked by https://github.com/linux-ha-storage/storhaug/issues/11
Maybe at some point we would want to consider migrating the targeted
policies for glusterfs (and nfs-ganesha) from selinux-policy to a
glusterfs-selinux (and nfs-ganesha-selinux) subpackage?
Change-Id: I04a5443edd00636cbded59a2baddfa98095bf7ac
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/17597
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
---
glusterfs.spec.in | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 0bad6cf..17f814b 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -410,6 +410,10 @@ Requires: pcs, dbus
%if ( 0%{?rhel} && 0%{?rhel} == 6 )
Requires: cman, pacemaker, corosync
%endif
+%if ( 0%{?fedora} && 0%{?fedora} > 25 )
+Requires(post): policycoreutils-python-utils
+Requires(postun): policycoreutils-python-utils
+%endif
%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} > 5 )
# we need portblock resource-agent in 3.9.5 and later.
Requires: resource-agents >= 3.9.5
@@ -876,6 +880,12 @@ modprobe fuse
exit 0
%endif
+%if ( 0%{?fedora} && 0%{?fedora} > 25 )
+%post ganesha
+semanage boolean -m ganesha_use_fusefs --on
+exit 0
+%endif
+
%if ( 0%{?_build_server} )
%if ( 0%{!?_without_georeplication:1} )
%post geo-replication
@@ -998,6 +1008,12 @@ fi
%postun api
/sbin/ldconfig
+%if ( 0%{?fedora} && 0%{?fedora} > 25 )
+%postun ganesha
+semanage boolean -m ganesha_use_fusefs --off
+exit 0
+%endif
+
%postun libs
/sbin/ldconfig
--
1.8.3.1

View File

@ -1,66 +0,0 @@
From f472b5db12723f1a478ad5886fac82958a04e131 Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Wed, 12 Jul 2017 07:43:51 -0400
Subject: [PATCH 66/74] packaging: glusterfs-ganesha update sometimes fails
semanage
Depending on how dnf orders updates, the updated version of
selinux-policy-targeted with ganesha_use_fusefs may not be updated
before the glusterfs-ganesha update execute its %post scriptlet
containing the `semanage ganesha_use_fusefs ...` command. In such
situations the semanage command (silently) fails.
Use a %trigger (and %triggerun) to run the scriptlet (again) after
selinux-policy-targeted with ganesha_use_fusefs has been installed
or updated.
Note: the %triggerun is probably unnecessary, but it doesn't hurt.
The release-3.10 branch is the "upstream master" for the glusterfs-
ganesha subpackage.
Note: to be merged after https://review.gluster.org/17806
Change-Id: I1ad06d79fa1711e4abf038baf9f0a5b7bb665934
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/17756
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
---
glusterfs.spec.in | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 17f814b..e6e2ba3 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1027,6 +1027,24 @@ exit 0
%endif
##-----------------------------------------------------------------------------
+## All %%trigger should be placed here and keep them sorted
+##
+%if ( 0%{?fedora} && 0%{?fedora} > 25 )
+%trigger ganesha -- selinux-policy-targeted
+semanage boolean -m ganesha_use_fusefs --on
+exit 0
+%endif
+
+##-----------------------------------------------------------------------------
+## All %%triggerun should be placed here and keep them sorted
+##
+%if ( 0%{?fedora} && 0%{?fedora} > 25 )
+%triggerun ganesha -- selinux-policy-targeted
+semanage boolean -m ganesha_use_fusefs --off
+exit 0
+%endif
+
+##-----------------------------------------------------------------------------
## All %%files should be placed here and keep them grouped
##
%files
--
1.8.3.1

View File

@ -1,70 +0,0 @@
From aa20e41c3087f9ec68d0a7890ed953e5bc7aa096 Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Wed, 26 Jul 2017 10:36:11 -0400
Subject: [PATCH 67/74] packaging: own files in
(/var)/run/gluster/shared_storage/nfs-ganesha
The nfs-ganesha rpm owns /etc/ganesha and /etc/ganesha/ganesha.conf,
but gluster-ganesha installs a ganesha-ha.conf.sample in /etc/ganesha/
Ganesha HA expects to find the config files in /var/run/.../nfs-ganesha
and for there to be symlinks from /etc/ganesha/* to /var/run/...
As exports are created the ganesha export files are written to
/var/run/gluster/shared_storage/nfs-ganesha/exports/*
This change creates rpm %ghosts for most of these files to manage
ownership within rpm and ensure they are not deleted or overwritten
during package install/upgrade/removal. The name of the exports varies,
so it's not possible AFAIK to create wildcard %ghosts for them.
Change-Id: Ic4389291c0af0bd72c22fa742cdfa2011b9286f3
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/17883
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
---
glusterfs.spec.in | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index e6e2ba3..cbc77c3 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -818,6 +818,13 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha
install -D -p -m 0644 extras/glusterfs-logrotate \
%{buildroot}%{_sysconfdir}/logrotate.d/glusterfs
+# ganesha ghosts
+mkdir -p %{buildroot}%{_sysconfdir}/ganesha
+touch %{buildroot}%{_sysconfdir}/ganesha/ganesha-ha.conf
+mkdir -p %{buildroot}%{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/exports
+touch %{buildroot}%{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/ganesha.conf
+touch %{buildroot}%{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/ganesha-ha.conf
+
%if ( 0%{!?_without_georeplication:1} )
mkdir -p %{buildroot}%{_sharedstatedir}/glusterd/geo-replication
touch %{buildroot}%{_sharedstatedir}/glusterd/geo-replication/gsyncd_template.conf
@@ -1309,10 +1316,16 @@ exit 0
%if ( 0%{?_build_server} )
%files ganesha
-%{_sysconfdir}/ganesha/*
+%dir %{_libexecdir}/ganesha
%{_libexecdir}/ganesha/*
%{_prefix}/lib/ocf/resource.d/heartbeat/*
%{_sharedstatedir}/glusterd/hooks/1/start/post/S31ganesha-start.sh
+%{_sysconfdir}/ganesha/ganesha-ha.conf.sample
+%ghost %config(noreplace) %{_sysconfdir}/ganesha/ganesha-ha.conf
+%ghost %dir %{_localstatedir}/run/gluster/shared_storage/nfs-ganesha
+%ghost %dir %{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/exports
+%ghost %config(noreplace) %{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/ganesha.conf
+%ghost %config(noreplace) %{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/ganesha-ha.conf
%endif
%if ( 0%{?_build_server} )
--
1.8.3.1

View File

@ -1,59 +0,0 @@
From c90038f9a3e01d07f1e797c613b0863a43e06d35 Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Mon, 17 Jul 2017 11:07:40 -0400
Subject: [PATCH 68/74] common-ha: enable and disable selinux
gluster_use_execmem
Starting in Fedora 26 and RHEL 7.4 there are new targeted policies in
selinux which include a tuneable to allow glusterd->ganesha-ha.sh->pcs
to access the pcs config, i.e. gluster-use-execmem.
Note. rpm doesn't have a way to distinguish between RHEL 7.3 or 7.4
or between 3.13.1-X and 3.13.1-Y so it can't be enabled for RHEL at
this time.
/usr/sbin/semanage is in policycoreutils-python in RHEL (versus
policycoreutils-python-utils in Fedora.)
Requires selinux-policy >= 3.13.1-160 in RHEL7. The corresponding
version in Fedora 26 seems to be selinux-policy-3.13.1-259 or so. (Maybe
earlier versions, but that's what was in F26 when I checked.)
Change-Id: Ic474b3f7739ff5be1e99d94d00b55caae4ceb5a0
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/17806
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
extras/ganesha/scripts/ganesha-ha.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index ce5ff20..0b7642d 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -984,6 +984,9 @@ main()
usage
exit 0
fi
+
+ semanage boolean -m gluster_use_execmem --on
+
HA_CONFDIR=${1%/}; shift
local ha_conf=${HA_CONFDIR}/ganesha-ha.conf
local node=""
@@ -1129,6 +1132,9 @@ $HA_CONFDIR/ganesha-ha.conf
;;
esac
+
+ semanage boolean -m gluster_use_execmem --off
+
}
main $*
--
1.8.3.1

View File

@ -1,53 +0,0 @@
From 9b299dff3811a48978a76cbdd5f4f66f0cf68d78 Mon Sep 17 00:00:00 2001
From: Ambarish <asoman@redhat.com>
Date: Tue, 12 Sep 2017 18:34:29 +0530
Subject: [PATCH 69/74] ganesha-ha: don't set SELinux booleans if SELinux is
disabled
semanage commands inside ganesha-ha.sh script will fail if selinux is
Disabled. This patch introduces a check if selinux is enabled or not,
and subsequently run semange commands only on selinux enabled systems.
Change-Id: Ibee61cbb1d51a73e6c326b49bac5c7ce06feb310
Signed-off-by: Ambarish <asoman@redhat.com>
Reviewed-on: https://review.gluster.org/18264
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Reviewed-by: Daniel Gryniewicz <dang@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
---
extras/ganesha/scripts/ganesha-ha.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index 0b7642d..3a18a1a 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -985,7 +985,9 @@ main()
exit 0
fi
- semanage boolean -m gluster_use_execmem --on
+ if (selinuxenabled) ;then
+ semanage boolean -m gluster_use_execmem --on
+ fi
HA_CONFDIR=${1%/}; shift
local ha_conf=${HA_CONFDIR}/ganesha-ha.conf
@@ -1133,8 +1135,9 @@ $HA_CONFDIR/ganesha-ha.conf
esac
- semanage boolean -m gluster_use_execmem --off
-
+ if (selinuxenabled) ;then
+ semanage boolean -m gluster_use_execmem --off
+ fi
}
main $*
--
1.8.3.1

View File

@ -1,41 +0,0 @@
From 1d9693e542fb63ad985a6d6647c0c613f2e677b6 Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Fri, 23 Jun 2017 20:43:16 +0530
Subject: [PATCH 70/74] build: remove ganesha dependency on selinux-policy
Problem:
Puddle creation fails with unresolved dependencies
unresolved deps:
*** selinux-policy >= 0:3.13.1-160
Solution:
We know a priori about the version at RHEL 7.4 is already the desired
version. So removing this explicit dependency *should* not be a gluster
test blocker.
Label: DOWNSTREAM ONLY
Change-Id: Id53ac0e41adc14704932787ee0dd3143e6615aaf
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/109945
Reviewed-by: Kaleb Keithley <kkeithle@redhat.com>
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
---
glusterfs.spec.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index cbc77c3..05eff07 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -411,6 +411,7 @@ Requires: pcs, dbus
Requires: cman, pacemaker, corosync
%endif
%if ( 0%{?fedora} && 0%{?fedora} > 25 )
+Requires: selinux-policy >= 3.13.1-160
Requires(post): policycoreutils-python-utils
Requires(postun): policycoreutils-python-utils
%endif
--
1.8.3.1

View File

@ -1,62 +0,0 @@
From 50b87b03d6460b7c5d733924f611efdac134f37d Mon Sep 17 00:00:00 2001
From: "Kaleb S. KEITHLEY" <kkeithle@redhat.com>
Date: Wed, 7 Jun 2017 08:15:48 -0400
Subject: [PATCH 71/74] common-ha: enable pacemaker at end of setup
Label: DOWNSTREAM ONLY
Change-Id: I3ccd59b67ed364bfc5d27e88321ab5b9f8d471fd
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/108431
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
---
extras/ganesha/scripts/ganesha-ha.sh | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index 3a18a1a..b252818 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -787,6 +787,22 @@ setup_state_volume()
}
+enable_pacemaker()
+{
+ while [[ ${1} ]]; do
+ if [ "${SERVICE_MAN}" == "/usr/bin/systemctl" ]; then
+${SECRET_PEM} root@${1} ${SERVICE_MAN} enable pacemaker"
+ ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
+${SECRET_PEM} root@${1} "${SERVICE_MAN} enable pacemaker"
+ else
+ ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
+${SECRET_PEM} root@${1} "${SERVICE_MAN} pacemaker enable"
+ fi
+ shift
+ done
+}
+
+
addnode_state_volume()
{
local newnode=${1}; shift
@@ -1011,6 +1027,8 @@ main()
if [ "X${HA_NUM_SERVERS}X" != "X1X" ]; then
+ determine_service_manager
+
setup_cluster ${HA_NAME} ${HA_NUM_SERVERS} "${HA_SERVERS}"
setup_create_resources ${HA_SERVERS}
@@ -1019,6 +1037,8 @@ main()
setup_state_volume ${HA_SERVERS}
+ enable_pacemaker ${HA_SERVERS}
+
else
logger "insufficient servers for HA, aborting"
--
1.8.3.1

View File

@ -1,39 +0,0 @@
From eeaf040d3231c30d6d559a70c5e8ae36098d3a9a Mon Sep 17 00:00:00 2001
From: Soumya Koduri <skoduri@redhat.com>
Date: Wed, 14 Jun 2017 15:20:22 +0530
Subject: [PATCH 72/74] common-ha: Fix an incorrect syntax during setup
There was an invalid line introduced as part of
https://code.engineering.redhat.com/gerrit/#/c/108431/
Detected by rpmdiff -
https://errata.devel.redhat.com/rpmdiff/show/175336?result_id=4796901
This change is to fix the same.
Label: DOWNSTREAM ONLY
Change-Id: I55cdd7d866cb175fb620dbbd2d02c36eab291a74
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/109017
Reviewed-by: Kaleb Keithley <kkeithle@redhat.com>
Tested-by: Kaleb Keithley <kkeithle@redhat.com>
---
extras/ganesha/scripts/ganesha-ha.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index b252818..623fb64 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -791,7 +791,6 @@ enable_pacemaker()
{
while [[ ${1} ]]; do
if [ "${SERVICE_MAN}" == "/usr/bin/systemctl" ]; then
-${SECRET_PEM} root@${1} ${SERVICE_MAN} enable pacemaker"
ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \
${SECRET_PEM} root@${1} "${SERVICE_MAN} enable pacemaker"
else
--
1.8.3.1

View File

@ -1,103 +0,0 @@
From 77c5fda269bffe16d8564a5d26ed838ad9b6fcea Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Tue, 14 Nov 2017 12:43:29 +0530
Subject: [PATCH 73/74] Fix build issues related to nfs-ganesha package
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
---
glusterfs.spec.in | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 05eff07..b6ba91c 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -822,9 +822,6 @@ install -D -p -m 0644 extras/glusterfs-logrotate \
# ganesha ghosts
mkdir -p %{buildroot}%{_sysconfdir}/ganesha
touch %{buildroot}%{_sysconfdir}/ganesha/ganesha-ha.conf
-mkdir -p %{buildroot}%{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/exports
-touch %{buildroot}%{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/ganesha.conf
-touch %{buildroot}%{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/ganesha-ha.conf
%if ( 0%{!?_without_georeplication:1} )
mkdir -p %{buildroot}%{_sharedstatedir}/glusterd/geo-replication
@@ -888,11 +885,13 @@ modprobe fuse
exit 0
%endif
+%if ( 0%{?_build_server} )
%if ( 0%{?fedora} && 0%{?fedora} > 25 )
%post ganesha
semanage boolean -m ganesha_use_fusefs --on
exit 0
%endif
+%endif
%if ( 0%{?_build_server} )
%if ( 0%{!?_without_georeplication:1} )
@@ -1016,11 +1015,13 @@ fi
%postun api
/sbin/ldconfig
+%if ( 0%{?_build_server} )
%if ( 0%{?fedora} && 0%{?fedora} > 25 )
%postun ganesha
semanage boolean -m ganesha_use_fusefs --off
exit 0
%endif
+%endif
%postun libs
/sbin/ldconfig
@@ -1037,20 +1038,24 @@ exit 0
##-----------------------------------------------------------------------------
## All %%trigger should be placed here and keep them sorted
##
+%if ( 0%{?_build_server} )
%if ( 0%{?fedora} && 0%{?fedora} > 25 )
%trigger ganesha -- selinux-policy-targeted
semanage boolean -m ganesha_use_fusefs --on
exit 0
%endif
+%endif
##-----------------------------------------------------------------------------
## All %%triggerun should be placed here and keep them sorted
##
+%if ( 0%{?_build_server} )
%if ( 0%{?fedora} && 0%{?fedora} > 25 )
%triggerun ganesha -- selinux-policy-targeted
semanage boolean -m ganesha_use_fusefs --off
exit 0
%endif
+%endif
##-----------------------------------------------------------------------------
## All %%files should be placed here and keep them grouped
@@ -1074,6 +1079,11 @@ exit 0
%if ( ! 0%{?_build_server} )
# exclude ganesha files
%exclude %{_prefix}/lib/ocf/*
+%exclude %{_libexecdir}/ganesha/*
+%exclude %{_prefix}/lib/ocf/resource.d/heartbeat/*
+%exclude %{_sysconfdir}/ganesha/ganesha-ha.conf.sample
+%exclude %{_sysconfdir}/ganesha/ganesha-ha.conf
+
# exclude incrementalapi
%exclude %{_libexecdir}/glusterfs/*
%exclude %{_sbindir}/gfind_missing_files
@@ -1323,10 +1333,6 @@ exit 0
%{_sharedstatedir}/glusterd/hooks/1/start/post/S31ganesha-start.sh
%{_sysconfdir}/ganesha/ganesha-ha.conf.sample
%ghost %config(noreplace) %{_sysconfdir}/ganesha/ganesha-ha.conf
-%ghost %dir %{_localstatedir}/run/gluster/shared_storage/nfs-ganesha
-%ghost %dir %{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/exports
-%ghost %config(noreplace) %{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/ganesha.conf
-%ghost %config(noreplace) %{_localstatedir}/run/gluster/shared_storage/nfs-ganesha/ganesha-ha.conf
%endif
%if ( 0%{?_build_server} )
--
1.8.3.1

View File

@ -1,31 +0,0 @@
From c59e78a5e8b7a1802f1f7caa1eab480a3395ba91 Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Wed, 15 Nov 2017 12:18:57 +0530
Subject: [PATCH 74/74] build: make /var/run available on RHEL-6
make /var/run available on RHEL-6 as well
Label: DOWNSTREAM ONLY
Change-Id: Iec79478e2233bd3194030a2c75273fc2ba3d17bb
Signed-off-by: Milind Changire <mchangir@redhat.com>
---
glusterfs.spec.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index b6ba91c..da8a3e5 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -118,7 +118,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))")}
%global _rundir %{_localstatedir}/run
--
1.8.3.1

View File

@ -1,749 +0,0 @@
From fb84f6c69385e35f3a62504dfebc11b21ff4082a Mon Sep 17 00:00:00 2001
From: N Balachandran <nbalacha@redhat.com>
Date: Mon, 6 Nov 2017 09:30:54 +0530
Subject: [PATCH 075/128] cli: gluster help changes
gluster cli help now shows only the top level
help commands. gluster <component> help will now show
help commands for <component>.
> BUG: 1474768
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
> BUG: 1509786
> https://review.gluster.org/#/c/18666/
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
(cherry picked from commit 89dc54f50c9f800ca4446ea8fe736e4860588845)
Change-Id: I263f53a0870d80ef4cfaad455fdaa47e2ac4423b
BUG: 1498730
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123525
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
cli/src/cli-cmd-global.c | 3 +
cli/src/cli-cmd-misc.c | 77 ++++++++--
cli/src/cli-cmd-parser.c | 20 ++-
cli/src/cli-cmd-peer.c | 9 +-
cli/src/cli-cmd-snapshot.c | 5 +
cli/src/cli-cmd-volume.c | 347 ++++++++++++++++++++++++++++++++++++++-------
cli/src/cli.c | 2 +-
7 files changed, 387 insertions(+), 76 deletions(-)
diff --git a/cli/src/cli-cmd-global.c b/cli/src/cli-cmd-global.c
index 881506b..1f9cb54 100644
--- a/cli/src/cli-cmd-global.c
+++ b/cli/src/cli-cmd-global.c
@@ -68,11 +68,14 @@ cli_cmd_global_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
count = (sizeof (global_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
+ cli_out ("\ngluster global commands");
+ cli_out ("========================\n");
for (global_cmd = cmd; global_cmd->pattern; global_cmd++)
if (_gf_false == global_cmd->disable)
cli_out ("%s - %s", global_cmd->pattern,
global_cmd->desc);
+ cli_out ("\n");
GF_FREE (cmd);
return 0;
}
diff --git a/cli/src/cli-cmd-misc.c b/cli/src/cli-cmd-misc.c
index 9f8c159..c887515 100644
--- a/cli/src/cli-cmd-misc.c
+++ b/cli/src/cli-cmd-misc.c
@@ -23,6 +23,9 @@ extern struct rpc_clnt *global_rpc;
extern rpc_clnt_prog_t *cli_rpc_prog;
extern struct cli_cmd volume_cmds[];
+extern struct cli_cmd bitrot_cmds[];
+extern struct cli_cmd quota_cmds[];
+extern struct cli_cmd tier_cmds[];
extern struct cli_cmd cli_probe_cmds[];
extern struct cli_cmd cli_log_cmds[];
extern struct cli_cmd cli_system_cmds[];
@@ -38,37 +41,76 @@ cli_cmd_quit_cbk (struct cli_state *state, struct cli_cmd_word *word,
exit (0);
}
+
+static gf_boolean_t
+cli_is_help_command (const char *pattern)
+{
+ /* FixFixFix
+ * This is not the best way to determine whether
+ * this is a help command
+ */
+ if (strstr (pattern, "help"))
+ return _gf_true;
+
+ return _gf_false;
+}
+
+
int
cli_cmd_display_help (struct cli_state *state, struct cli_cmd_word *in_word,
const char **words, int wordcount)
{
- struct cli_cmd *cmd[] = {volume_cmds, cli_probe_cmds,
- cli_misc_cmds, snapshot_cmds,
- global_cmds, NULL};
- struct cli_cmd *cmd_ind = NULL;
- int i = 0;
+ struct cli_cmd *cmd[] = {cli_misc_cmds, cli_probe_cmds,
+ volume_cmds, bitrot_cmds, quota_cmds,
+#if !defined(__NetBSD__)
+ tier_cmds,
+#endif
+ snapshot_cmds, global_cmds, NULL};
+ struct cli_cmd *cmd_ind = NULL;
+ int i = 0;
+ gf_boolean_t list_all = _gf_false;
/* cli_system_cmds commands for internal usage
they are not exposed
*/
- for (i=0; cmd[i]!=NULL; i++)
- for (cmd_ind = cmd[i]; cmd_ind->pattern; cmd_ind++)
- if (_gf_false == cmd_ind->disable)
- cli_out ("%s - %s", cmd_ind->pattern,
- cmd_ind->desc);
+ /* If "help all" */
+ if (wordcount == 2)
+ list_all = _gf_true;
+
+ for (i = 0; cmd[i] != NULL; i++) {
+ for (cmd_ind = cmd[i]; cmd_ind->pattern; cmd_ind++) {
+ if ((_gf_false == cmd_ind->disable) &&
+ cli_is_help_command (cmd_ind->pattern)) {
+ if (list_all && (cmd_ind->cbk)) {
+ cmd_ind->cbk (state, in_word, words,
+ wordcount);
+ } else {
+ cli_out (" %-25s- %s", cmd_ind->pattern,
+ cmd_ind->desc);
+ }
+ }
+ }
+ }
+
+ cli_out ("\n");
return 0;
}
+
+struct cli_cmd cli_help_cmds[] = {
+ { "help [all]",
+ cli_cmd_display_help,
+ "display help for command classes"},
+
+ { NULL, NULL, NULL }
+};
+
+
struct cli_cmd cli_misc_cmds[] = {
{ "quit",
cli_cmd_quit_cbk,
"quit"},
-
- { "help",
- cli_cmd_display_help,
- "display command options"},
-
{ "exit",
cli_cmd_quit_cbk,
"exit"},
@@ -84,7 +126,12 @@ cli_cmd_misc_register (struct cli_state *state)
struct cli_cmd *cmd = NULL;
for (cmd = cli_misc_cmds; cmd->pattern; cmd++) {
+ ret = cli_cmd_register (&state->tree, cmd);
+ if (ret)
+ goto out;
+ }
+ for (cmd = cli_help_cmds; cmd->pattern; cmd++) {
ret = cli_cmd_register (&state->tree, cmd);
if (ret)
goto out;
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index a35fc74..c95b262 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1189,8 +1189,13 @@ cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options)
goto out;
}
- if (wordcount < 4)
+ if (wordcount < 4) {
+
+ if ((wordcount == 3) && !(strcmp (words[2], "help"))) {
+ ret = 1;
+ }
goto out;
+ }
volname = (char *)words[2];
if (!volname) {
@@ -5588,15 +5593,22 @@ cli_cmd_bitrot_parse (const char **words, int wordcount, dict_t **options)
GF_ASSERT (words);
GF_ASSERT (options);
- dict = dict_new ();
- if (!dict)
- goto out;
+
+ /* Hack to print out bitrot help properly */
+ if ((wordcount == 3) && !(strcmp (words[2], "help"))) {
+ ret = 1;
+ return ret;
+ }
if (wordcount < 4 || wordcount > 5) {
gf_log ("cli", GF_LOG_ERROR, "Invalid syntax");
goto out;
}
+ dict = dict_new ();
+ if (!dict)
+ goto out;
+
volname = (char *)words[2];
if (!volname) {
ret = -1;
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c
index 4802f71..7df60bc 100644
--- a/cli/src/cli-cmd-peer.c
+++ b/cli/src/cli-cmd-peer.c
@@ -264,7 +264,7 @@ struct cli_cmd cli_probe_cmds[] = {
{ "peer help",
cli_cmd_peer_help_cbk,
- "Help command for peer "},
+ "display help for peer commands"},
{ "pool list",
cli_cmd_pool_list_cbk,
@@ -281,17 +281,20 @@ cli_cmd_peer_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
struct cli_cmd *probe_cmd = NULL;
int count = 0;
+ cli_out ("\ngluster peer commands");
+ cli_out ("======================\n");
+
cmd = GF_CALLOC (1, sizeof (cli_probe_cmds), cli_mt_cli_cmd);
memcpy (cmd, cli_probe_cmds, sizeof (cli_probe_cmds));
count = (sizeof (cli_probe_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
-
-
for (probe_cmd = cmd; probe_cmd->pattern; probe_cmd++)
cli_out ("%s - %s", probe_cmd->pattern, probe_cmd->desc);
GF_FREE (cmd);
+
+ cli_out ("\n");
return 0;
}
diff --git a/cli/src/cli-cmd-snapshot.c b/cli/src/cli-cmd-snapshot.c
index e79128c..88b4737 100644
--- a/cli/src/cli-cmd-snapshot.c
+++ b/cli/src/cli-cmd-snapshot.c
@@ -140,9 +140,14 @@ cli_cmd_snapshot_help_cbk (struct cli_state *state,
count = (sizeof (snapshot_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
+ cli_out ("\ngluster snapshot commands");
+ cli_out ("=========================\n");
+
for (snap_cmd = cmd; snap_cmd->pattern; snap_cmd++)
if (_gf_false == snap_cmd->disable)
cli_out ("%s - %s", snap_cmd->pattern, snap_cmd->desc);
+ cli_out ("\n");
+
GF_FREE (cmd);
return 0;
}
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index ca9da0a..a1e5c51 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -36,7 +36,19 @@ extern rpc_clnt_prog_t cli_quotad_clnt;
int
cli_cmd_volume_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
- const char **words, int wordcount);
+ const char **words, int wordcount);
+
+int
+cli_cmd_bitrot_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
+ const char **words, int wordcount);
+
+int
+cli_cmd_quota_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
+ const char **words, int wordcount);
+
+int
+cli_cmd_tier_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
+ const char **words, int wordcount);
int
cli_cmd_volume_info_cbk (struct cli_state *state, struct cli_cmd_word *word,
@@ -1293,9 +1305,12 @@ cli_cmd_volume_tier_cbk (struct cli_state *state,
if (wordcount < 4) {
- cli_usage_out (word->pattern);
- if (wordcount == 3 && !strcmp(words[2], "help"))
+ if (wordcount == 3 && !strcmp(words[2], "help")) {
+ cli_cmd_tier_help_cbk (state, word, words, wordcount);
ret = 0;
+ } else {
+ cli_usage_out (word->pattern);
+ }
goto out;
}
@@ -1719,6 +1734,8 @@ out:
return ret;
}
+
+
int
cli_cmd_bitrot_cbk (struct cli_state *state, struct cli_cmd_word *word,
const char **words, int wordcount)
@@ -1746,6 +1763,13 @@ cli_cmd_bitrot_cbk (struct cli_state *state, struct cli_cmd_word *word,
goto out;
}
+ if (ret == 1) {
+ /* this is 'volume bitrot help' */
+ cli_cmd_bitrot_help_cbk (state, word, words, wordcount);
+ ret = 0;
+ goto out2;
+ }
+
frame = create_frame (THIS, THIS->ctx->pool);
if (!frame) {
ret = -1;
@@ -1834,7 +1858,7 @@ out:
#endif
CLI_STACK_DESTROY (frame);
-
+out2:
return ret;
}
@@ -1866,6 +1890,12 @@ cli_cmd_quota_cbk (struct cli_state *state, struct cli_cmd_word *word,
}
} else {
ret = cli_cmd_quota_parse (words, wordcount, &options);
+
+ if (ret == 1) {
+ cli_cmd_quota_help_cbk (state, word, words, wordcount);
+ ret = 0;
+ goto out;
+ }
if (ret < 0) {
cli_usage_out (word->pattern);
parse_err = 1;
@@ -3157,7 +3187,159 @@ out:
return ret;
}
+
+/* This is a bit of a hack to display the help. The current bitrot cmd
+ * format does not work well when registering the cmds.
+ * Ideally the should have been of the form
+ * gluster volume bitrot <subcommand> <volumename> ...
+ */
+
+struct cli_cmd bitrot_cmds[] = {
+
+ {"volume bitrot help",
+ cli_cmd_bitrot_help_cbk,
+ "display help for volume bitrot commands"
+ },
+
+ {"volume bitrot <VOLNAME> {enable|disable}",
+ NULL, /*cli_cmd_bitrot_cbk,*/
+ "Enable/disable bitrot for volume <VOLNAME>"
+ },
+
+ {"volume bitrot <VOLNAME> scrub-throttle {lazy|normal|aggressive}",
+ NULL, /*cli_cmd_bitrot_cbk,*/
+ "Set the speed of the scrubber for volume <VOLNAME>"
+ },
+
+ {"volume bitrot <VOLNAME> scrub-frequency {hourly|daily|weekly|biweekly"
+ "|monthly}",
+ NULL, /*cli_cmd_bitrot_cbk,*/
+ "Set the frequency of the scrubber for volume <VOLNAME>"
+ },
+
+ {"volume bitrot <VOLNAME> scrub {pause|resume|status|ondemand}",
+ NULL, /*cli_cmd_bitrot_cbk,*/
+ "Pause/resume the scrubber for <VOLNAME>. Status displays the status of "
+ "the scrubber. ondemand starts the scrubber immediately."
+ },
+
+ {"volume bitrot <VOLNAME> {enable|disable}\n"
+ "volume bitrot <volname> scrub-throttle {lazy|normal|aggressive}\n"
+ "volume bitrot <volname> scrub-frequency {hourly|daily|weekly|biweekly"
+ "|monthly}\n"
+ "volume bitrot <volname> scrub {pause|resume|status|ondemand}",
+ cli_cmd_bitrot_cbk,
+ NULL
+ },
+
+ { NULL, NULL, NULL }
+};
+
+
+struct cli_cmd quota_cmds[] = {
+
+ /* Quota commands */
+ {"volume quota help",
+ cli_cmd_quota_help_cbk,
+ "display help for volume quota commands"
+ },
+
+ {"volume quota <VOLNAME> {enable|disable|list [<path> ...]| "
+ "list-objects [<path> ...] | remove <path>| remove-objects <path> | "
+ "default-soft-limit <percent>}",
+ cli_cmd_quota_cbk,
+ "Enable/disable and configure quota for <VOLNAME>"
+ },
+
+ {"volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]}",
+ cli_cmd_quota_cbk,
+ "Set maximum size for <path> for <VOLNAME>"
+ },
+
+ {"volume quota <VOLNAME> {limit-objects <path> <number> [<percent>]}",
+ cli_cmd_quota_cbk,
+ "Set the maximum number of entries allowed in <path> for <VOLNAME>"
+ },
+
+ {"volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}",
+ cli_cmd_quota_cbk,
+ "Set quota timeout for <VOLNAME>"
+ },
+
+ { "volume inode-quota <VOLNAME> enable",
+ cli_cmd_quota_cbk,
+ "Enable/disable inode-quota for <VOLNAME>"
+ },
+
+ { "volume quota <VOLNAME> {enable|disable|list [<path> ...]| "
+ "list-objects [<path> ...] | remove <path>| remove-objects <path> | "
+ "default-soft-limit <percent>}\n"
+ "volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]}\n"
+ "volume quota <VOLNAME> {limit-objects <path> <number> [<percent>]}\n"
+ "volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}",
+ cli_cmd_quota_cbk,
+ NULL
+ },
+
+ { NULL, NULL, NULL }
+};
+
+struct cli_cmd tier_cmds[] = {
+
+ { "volume tier help",
+ cli_cmd_tier_help_cbk,
+ "display help for volume tier commands"},
+
+ { "volume tier <VOLNAME> status",
+ cli_cmd_volume_tier_cbk,
+ "Display tier status for <VOLNAME>"},
+
+ { "volume tier <VOLNAME> start [force]",
+ cli_cmd_volume_tier_cbk,
+ "Start the tier service for <VOLNAME>"},
+
+ { "volume tier <VOLNAME> stop [force]",
+ cli_cmd_volume_tier_cbk,
+ "Stop the tier service for <VOLNAME>"},
+
+ { "volume tier <VOLNAME> attach [<replica COUNT>] <NEW-BRICK>... [force]",
+ cli_cmd_volume_tier_cbk,
+ "Attach a hot tier to <VOLNAME>"},
+
+ { "volume tier <VOLNAME> detach <start|stop|status|commit|[force]>",
+ cli_cmd_volume_tier_cbk,
+ "Detach the hot tier from <VOLNAME>"},
+
+ { "volume attach-tier <VOLNAME> [<replica COUNT>] <NEW-BRICK>...",
+ cli_cmd_volume_tier_cbk,
+ "NOTE: this is old syntax, will be deprecated in next release. "
+ "Please use gluster volume tier <vol> attach "
+ "[<replica COUNT>] <NEW-BRICK>..."},
+
+ { "volume detach-tier <VOLNAME> "
+ "<start|stop|status|commit|force>",
+ cli_cmd_volume_tier_cbk,
+ "NOTE: this is old syntax, will be deprecated in next release. "
+ "Please use gluster volume tier <vol> detach "
+ "{start|stop|commit} [force]"},
+
+ { "volume tier <VOLNAME> status\n"
+ "volume tier <VOLNAME> start [force]\n"
+ "volume tier <VOLNAME> stop\n"
+ "volume tier <VOLNAME> attach [<replica COUNT>] <NEW-BRICK>... [force]\n"
+ "volume tier <VOLNAME> detach <start|stop|status|commit|[force]>\n",
+ cli_cmd_volume_tier_cbk,
+ NULL },
+
+ {NULL, NULL, NULL}
+
+ };
+
struct cli_cmd volume_cmds[] = {
+ { "volume help",
+ cli_cmd_volume_help_cbk,
+ "display help for volume commands"},
+
{ "volume info [all|<VOLNAME>]",
cli_cmd_volume_info_cbk,
"list information of all volumes"},
@@ -3190,29 +3372,6 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_volume_rename_cbk,
"rename volume <VOLNAME> to <NEW-VOLNAME>"},*/
-#if !defined(__NetBSD__)
- { "volume tier <VOLNAME> status\n"
- "volume tier <VOLNAME> start [force]\n"
- "volume tier <VOLNAME> stop\n"
- "volume tier <VOLNAME> attach [<replica COUNT>] <NEW-BRICK>... [force]\n"
- "volume tier <VOLNAME> detach <start|stop|status|commit|[force]>\n",
- cli_cmd_volume_tier_cbk,
- "Tier translator specific operations."},
-
- { "volume attach-tier <VOLNAME> [<replica COUNT>] <NEW-BRICK>...",
- cli_cmd_volume_tier_cbk,
- "NOTE: this is old syntax, will be depreciated in next release. "
- "Please use gluster volume tier <vol> attach "
- "[<replica COUNT>] <NEW-BRICK>..."},
-
- { "volume detach-tier <VOLNAME> "
- " <start|stop|status|commit|force>",
- cli_cmd_volume_tier_cbk,
- "NOTE: this is old syntax, will be depreciated in next release. "
- "Please use gluster volume tier <vol> detach "
- "{start|stop|commit} [force]"},
-#endif
-
{ "volume add-brick <VOLNAME> [<stripe|replica> <COUNT> "
"[arbiter <COUNT>]] <NEW-BRICK> ... [force]",
cli_cmd_volume_add_brick_cbk,
@@ -3240,9 +3399,6 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_volume_set_cbk,
"set options for volume <VOLNAME>"},
- { "volume help",
- cli_cmd_volume_help_cbk,
- "display help for the volume command"},
{ "volume log <VOLNAME> rotate [BRICK]",
cli_cmd_log_rotate_cbk,
@@ -3273,19 +3429,6 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_volume_profile_cbk,
"volume profile operations"},
- { "volume quota <VOLNAME> {enable|disable|list [<path> ...]| "
- "list-objects [<path> ...] | remove <path>| remove-objects <path> | "
- "default-soft-limit <percent>} |\n"
- "volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]} |\n"
- "volume quota <VOLNAME> {limit-objects <path> <number> [<percent>]} |\n"
- "volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}",
- cli_cmd_quota_cbk,
- "quota translator specific operations"},
-
- { "volume inode-quota <VOLNAME> enable",
- cli_cmd_quota_cbk,
- "quota translator specific operations"},
-
{ "volume top <VOLNAME> {open|read|write|opendir|readdir|clear} [nfs|brick <brick>] [list-cnt <value>] |\n"
"volume top <VOLNAME> {read-perf|write-perf} [bs <size> count <count>] [brick <brick>] [list-cnt <value>]",
cli_cmd_volume_top_cbk,
@@ -3329,26 +3472,99 @@ struct cli_cmd volume_cmds[] = {
" or all option. gluster volume get all all is to get all global "
"options"
},
- {"volume bitrot <VOLNAME> {enable|disable} |\n"
- "volume bitrot <volname> scrub-throttle {lazy|normal|aggressive} |\n"
- "volume bitrot <volname> scrub-frequency {hourly|daily|weekly|biweekly"
- "|monthly} |\n"
- "volume bitrot <volname> scrub {pause|resume|status|ondemand}",
- cli_cmd_bitrot_cbk,
- "Bitrot translator specific operation. For more information about "
- "bitrot command type 'man gluster'"
- },
+
{ "volume reset-brick <VOLNAME> <SOURCE-BRICK> {{start} |"
" {<NEW-BRICK> commit}}",
cli_cmd_volume_reset_brick_cbk,
"reset-brick operations"},
+
{ NULL, NULL, NULL }
};
int
+cli_cmd_quota_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
+ const char **words, int wordcount)
+{
+ struct cli_cmd *cmd = NULL;
+ struct cli_cmd *quota_cmd = NULL;
+ int count = 0;
+
+ cmd = GF_CALLOC (1, sizeof (quota_cmds), cli_mt_cli_cmd);
+ memcpy (cmd, quota_cmds, sizeof (quota_cmds));
+ count = (sizeof (quota_cmds) / sizeof (struct cli_cmd));
+ cli_cmd_sort (cmd, count);
+
+ cli_out ("\ngluster quota commands");
+ cli_out ("=======================\n");
+
+ for (quota_cmd = cmd; quota_cmd->pattern; quota_cmd++)
+ if ((_gf_false == quota_cmd->disable) && (quota_cmd->desc))
+ cli_out ("%s - %s", quota_cmd->pattern,
+ quota_cmd->desc);
+
+ cli_out ("\n");
+ GF_FREE (cmd);
+
+ return 0;
+}
+
+int
+cli_cmd_bitrot_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
+ const char **words, int wordcount)
+{
+ struct cli_cmd *cmd = NULL;
+ struct cli_cmd *bitrot_cmd = NULL;
+ int count = 0;
+
+ cmd = GF_CALLOC (1, sizeof (bitrot_cmds), cli_mt_cli_cmd);
+ memcpy (cmd, bitrot_cmds, sizeof (bitrot_cmds));
+ count = (sizeof (bitrot_cmds) / sizeof (struct cli_cmd));
+ cli_cmd_sort (cmd, count);
+
+ cli_out ("\ngluster bitrot commands");
+ cli_out ("========================\n");
+
+ for (bitrot_cmd = cmd; bitrot_cmd->pattern; bitrot_cmd++)
+ if ((_gf_false == bitrot_cmd->disable) && (bitrot_cmd->desc))
+ cli_out ("%s - %s", bitrot_cmd->pattern,
+ bitrot_cmd->desc);
+
+ cli_out ("\n");
+ GF_FREE (cmd);
+
+ return 0;
+}
+
+int
+cli_cmd_tier_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
+ const char **words, int wordcount)
+{
+ struct cli_cmd *cmd = NULL;
+ struct cli_cmd *tier_cmd = NULL;
+ int count = 0;
+
+ cmd = GF_CALLOC (1, sizeof (tier_cmds), cli_mt_cli_cmd);
+ memcpy (cmd, tier_cmds, sizeof (tier_cmds));
+ count = (sizeof (tier_cmds) / sizeof (struct cli_cmd));
+ cli_cmd_sort (cmd, count);
+
+ cli_out ("\ngluster tier commands");
+ cli_out ("======================\n");
+
+ for (tier_cmd = cmd; tier_cmd->pattern; tier_cmd++) {
+ if ((_gf_false == tier_cmd->disable) && tier_cmd->desc) {
+ cli_out ("%s - %s", tier_cmd->pattern, tier_cmd->desc);
+ }
+ }
+ cli_out ("\n");
+ GF_FREE (cmd);
+ return 0;
+}
+
+int
cli_cmd_volume_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
- const char **words, int wordcount)
+ const char **words, int wordcount)
{
struct cli_cmd *cmd = NULL;
struct cli_cmd *vol_cmd = NULL;
@@ -3359,10 +3575,14 @@ cli_cmd_volume_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,
count = (sizeof (volume_cmds) / sizeof (struct cli_cmd));
cli_cmd_sort (cmd, count);
+ cli_out ("\ngluster volume commands");
+ cli_out ("========================\n");
+
for (vol_cmd = cmd; vol_cmd->pattern; vol_cmd++)
if (_gf_false == vol_cmd->disable)
cli_out ("%s - %s", vol_cmd->pattern, vol_cmd->desc);
+ cli_out ("\n");
GF_FREE (cmd);
return 0;
}
@@ -3374,11 +3594,32 @@ cli_cmd_volume_register (struct cli_state *state)
struct cli_cmd *cmd = NULL;
for (cmd = volume_cmds; cmd->pattern; cmd++) {
+ ret = cli_cmd_register (&state->tree, cmd);
+ if (ret)
+ goto out;
+ }
+
+ for (cmd = bitrot_cmds; cmd->pattern; cmd++) {
+ ret = cli_cmd_register (&state->tree, cmd);
+ if (ret)
+ goto out;
+ }
+ for (cmd = quota_cmds; cmd->pattern; cmd++) {
ret = cli_cmd_register (&state->tree, cmd);
if (ret)
goto out;
}
+
+#if !defined(__NetBSD__)
+ for (cmd = tier_cmds; cmd->pattern; cmd++) {
+ ret = cli_cmd_register (&state->tree, cmd);
+ if (ret)
+ goto out;
+ }
+
+#endif
+
out:
return ret;
}
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 18ca5c8..ce06366 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -515,7 +515,7 @@ cli_usage_out (const char *usage)
if (!usage || usage[0] == '\0')
return -1;
- cli_err ("Usage: %s", usage);
+ cli_err ("\nUsage:\n%s\n", usage);
return 0;
}
--
1.8.3.1

View File

@ -1,376 +0,0 @@
From 6c176a6f9743ab0518619f784a1fc5ac9562b991 Mon Sep 17 00:00:00 2001
From: Pranith Kumar K <pkarampu@redhat.com>
Date: Tue, 18 Jul 2017 18:39:01 +0530
Subject: [PATCH 076/128] cluster/ec: Handle parallel get_size_version
upstream patch: https://review.gluster.org/#/c/17820/
>Updates #251
>Change-Id: I6244014dbc90af3239d63d75a064ae22ec12a054
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
BUG: 1459101
Change-Id: I6244014dbc90af3239d63d75a064ae22ec12a054
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123551
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Ashish Pandey <aspandey@redhat.com>
---
xlators/cluster/ec/src/ec-common.c | 151 +++++++++++++++++++++++--------------
xlators/cluster/ec/src/ec-common.h | 8 +-
xlators/cluster/ec/src/ec-types.h | 3 +-
3 files changed, 103 insertions(+), 59 deletions(-)
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
index 732d422..6963907 100644
--- a/xlators/cluster/ec/src/ec-common.c
+++ b/xlators/cluster/ec/src/ec-common.c
@@ -21,6 +21,10 @@
#include "ec.h"
#include "ec-messages.h"
+#define EC_XATTROP_ALL_WAITING_FLAGS (EC_FLAG_WAITING_XATTROP |\
+ EC_FLAG_WAITING_DATA_DIRTY |\
+ EC_FLAG_WAITING_METADATA_DIRTY)
+
uint32_t
ec_select_first_by_read_policy (ec_t *ec, ec_fop_data_t *fop)
{
@@ -882,11 +886,11 @@ void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags)
}
gf_boolean_t
-ec_config_check (ec_fop_data_t *fop, ec_config_t *config)
+ec_config_check (xlator_t *xl, ec_config_t *config)
{
ec_t *ec;
- ec = fop->xl->private;
+ ec = xl->private;
if ((config->version != EC_CONFIG_VERSION) ||
(config->algorithm != EC_CONFIG_ALGORITHM) ||
(config->gf_word_size != EC_GF_BITS) ||
@@ -911,11 +915,11 @@ ec_config_check (ec_fop_data_t *fop, ec_config_t *config)
!ec_is_power_of_2(config->gf_word_size) ||
((config->chunk_size * 8) % (config->gf_word_size * data_bricks)
!= 0)) {
- gf_msg (fop->xl->name, GF_LOG_ERROR, EINVAL,
+ gf_msg (xl->name, GF_LOG_ERROR, EINVAL,
EC_MSG_INVALID_CONFIG,
"Invalid or corrupted config");
} else {
- gf_msg (fop->xl->name, GF_LOG_ERROR, EINVAL,
+ gf_msg (xl->name, GF_LOG_ERROR, EINVAL,
EC_MSG_INVALID_CONFIG,
"Unsupported config "
"(V=%u, A=%u, W=%u, "
@@ -962,24 +966,28 @@ ec_prepare_update_cbk (call_frame_t *frame, void *cookie,
{
struct list_head list;
ec_fop_data_t *fop = cookie, *parent, *tmp;
- ec_lock_link_t *link = fop->data;
+ ec_lock_link_t *parent_link = fop->data;
+ ec_lock_link_t *link = NULL;
ec_lock_t *lock = NULL;
ec_inode_t *ctx;
gf_boolean_t release = _gf_false;
+ uint64_t waiting_flags = 0;
+ uint64_t dirty[EC_VERSION_SIZE] = {0, 0};
- lock = link->lock;
- parent = link->fop;
+ lock = parent_link->lock;
+ parent = parent_link->fop;
ctx = lock->ctx;
INIT_LIST_HEAD(&list);
+ waiting_flags = parent_link->waiting_flags & EC_XATTROP_ALL_WAITING_FLAGS;
LOCK(&lock->loc.inode->lock);
list_for_each_entry(link, &lock->owners, owner_list) {
- if ((link->fop->flags & EC_FLAG_WAITING_XATTROP) != 0) {
- link->fop->flags ^= EC_FLAG_WAITING_XATTROP;
-
- list_add_tail(&link->fop->cbk_list, &list);
+ if ((link->waiting_flags & waiting_flags) != 0) {
+ link->waiting_flags ^= (link->waiting_flags & waiting_flags);
+ if ((link->waiting_flags & EC_XATTROP_ALL_WAITING_FLAGS) == 0)
+ list_add_tail(&link->fop->cbk_list, &list);
}
}
@@ -991,8 +999,7 @@ ec_prepare_update_cbk (call_frame_t *frame, void *cookie,
goto unlock;
}
- if (parent->flags & EC_FLAG_QUERY_METADATA) {
- parent->flags ^= EC_FLAG_QUERY_METADATA;
+ if (waiting_flags & EC_FLAG_WAITING_XATTROP) {
op_errno = -ec_dict_del_array(dict, EC_XATTR_VERSION,
ctx->pre_version,
EC_VERSION_SIZE);
@@ -1036,7 +1043,7 @@ ec_prepare_update_cbk (call_frame_t *frame, void *cookie,
goto unlock;
}
} else {
- if (!ec_config_check(parent, &ctx->config)) {
+ if (!ec_config_check(parent->xl, &ctx->config)) {
gf_msg (this->name, GF_LOG_ERROR, EINVAL,
EC_MSG_CONFIG_XATTR_INVALID,
"Invalid config xattr");
@@ -1051,12 +1058,22 @@ ec_prepare_update_cbk (call_frame_t *frame, void *cookie,
ctx->have_info = _gf_true;
}
- ec_set_dirty_flag (fop->data, ctx, ctx->dirty);
+ ec_set_dirty_flag (fop->data, ctx, dirty);
+ if (dirty[EC_METADATA_TXN] &&
+ (waiting_flags & EC_FLAG_WAITING_METADATA_DIRTY)) {
+ GF_ASSERT (!ctx->dirty[EC_METADATA_TXN]);
+ ctx->dirty[EC_METADATA_TXN] = 1;
+ }
+
+ if (dirty[EC_DATA_TXN] &&
+ (waiting_flags & EC_FLAG_WAITING_DATA_DIRTY)) {
+ GF_ASSERT (!ctx->dirty[EC_DATA_TXN]);
+ ctx->dirty[EC_DATA_TXN] = 1;
+ }
op_errno = 0;
unlock:
- lock->getting_xattr = _gf_false;
- UNLOCK(&lock->loc.inode->lock);
+ lock->waiting_flags ^= waiting_flags;
if (op_errno == 0) {
/* If the fop fails on any of the good bricks, it is important to mark
@@ -1066,33 +1083,24 @@ unlock:
release = _gf_true;
}
- /* lock->release is a critical field that is checked and modified most
- * of the time inside a locked region. This use here is safe because we
- * are in a modifying fop and we currently don't allow two modifying
- * fops to be processed concurrently, so no one else could be checking
- * or modifying it.*/
- if (link->update[0] && !link->dirty[0]) {
+ if (parent_link->update[0] && !parent_link->dirty[0]) {
lock->release |= release;
}
- if (link->update[1] && !link->dirty[1]) {
+ if (parent_link->update[1] && !parent_link->dirty[1]) {
lock->release |= release;
}
/* We don't allow the main fop to be executed on bricks that have not
* succeeded the initial xattrop. */
- parent->mask &= fop->good;
ec_lock_update_good (lock, fop);
/*As of now only data healing marks bricks as healing*/
lock->healing |= fop->healing;
- if (ec_is_data_fop (parent->id)) {
- parent->healing |= fop->healing;
- }
- } else {
- ec_fop_set_error(parent, op_errno);
}
+ UNLOCK(&lock->loc.inode->lock);
+
while (!list_empty(&list)) {
tmp = list_entry(list.next, ec_fop_data_t, cbk_list);
list_del_init(&tmp->cbk_list);
@@ -1104,16 +1112,50 @@ unlock:
if (ec_is_data_fop (tmp->id)) {
tmp->healing |= fop->healing;
}
- } else {
- ec_fop_set_error(tmp, op_errno);
}
- ec_resume(tmp, 0);
+ ec_resume(tmp, op_errno);
}
return 0;
}
+static uint64_t
+ec_set_xattrop_flags_and_params (ec_lock_t *lock, ec_lock_link_t *link,
+ uint64_t *dirty)
+{
+ uint64_t oldflags = 0;
+ uint64_t newflags = 0;
+ ec_inode_t *ctx = lock->ctx;
+
+ oldflags = lock->waiting_flags & EC_XATTROP_ALL_WAITING_FLAGS;
+
+ if (lock->query && !ctx->have_info) {
+ lock->waiting_flags |= EC_FLAG_WAITING_XATTROP;
+ link->waiting_flags |= EC_FLAG_WAITING_XATTROP;
+ }
+
+ if (dirty[EC_DATA_TXN]) {
+ if (oldflags & EC_FLAG_WAITING_DATA_DIRTY) {
+ dirty[EC_DATA_TXN] = 0;
+ } else {
+ lock->waiting_flags |= EC_FLAG_WAITING_DATA_DIRTY;
+ }
+ link->waiting_flags |= EC_FLAG_WAITING_DATA_DIRTY;
+ }
+
+ if (dirty[EC_METADATA_TXN]) {
+ if (oldflags & EC_FLAG_WAITING_METADATA_DIRTY) {
+ dirty[EC_METADATA_TXN] = 0;
+ } else {
+ lock->waiting_flags |= EC_FLAG_WAITING_METADATA_DIRTY;
+ }
+ link->waiting_flags |= EC_FLAG_WAITING_METADATA_DIRTY;
+ }
+ newflags = lock->waiting_flags & EC_XATTROP_ALL_WAITING_FLAGS;
+ return oldflags ^ newflags;
+}
+
void ec_get_size_version(ec_lock_link_t *link)
{
loc_t loc;
@@ -1124,7 +1166,6 @@ void ec_get_size_version(ec_lock_link_t *link)
dict_t *xdata = NULL;
ec_t *ec = NULL;
int32_t error = 0;
- gf_boolean_t getting_xattr;
gf_boolean_t set_dirty = _gf_false;
uint64_t allzero[EC_VERSION_SIZE] = {0, 0};
uint64_t dirty[EC_VERSION_SIZE] = {0, 0};
@@ -1132,6 +1173,7 @@ void ec_get_size_version(ec_lock_link_t *link)
ctx = lock->ctx;
fop = link->fop;
ec = fop->xl->private;
+ uint64_t changed_flags = 0;
if (ec->optimistic_changelog &&
!(ec->node_mask & ~link->lock->good_mask) && !ec_is_data_fop (fop->id))
@@ -1159,19 +1201,20 @@ void ec_get_size_version(ec_lock_link_t *link)
LOCK(&lock->loc.inode->lock);
- getting_xattr = lock->getting_xattr;
- lock->getting_xattr = _gf_true;
- if (getting_xattr) {
- fop->flags |= EC_FLAG_WAITING_XATTROP;
-
- ec_sleep(fop);
+ changed_flags = ec_set_xattrop_flags_and_params (lock, link, dirty);
+ if (link->waiting_flags) {
+ /* This fop needs to wait until all its flags are cleared which
+ * potentially can be cleared by other xattrops that are already
+ * wound*/
+ ec_sleep(fop);
+ } else {
+ GF_ASSERT (!changed_flags);
}
UNLOCK(&lock->loc.inode->lock);
- if (getting_xattr) {
+ if (!changed_flags)
goto out;
- }
dict = dict_new();
if (dict == NULL) {
@@ -1179,17 +1222,7 @@ void ec_get_size_version(ec_lock_link_t *link)
goto out;
}
- if (lock->loc.inode->ia_type == IA_IFREG ||
- lock->loc.inode->ia_type == IA_INVAL) {
- xdata = dict_new();
- if (xdata == NULL || dict_set_int32 (xdata, GF_GET_SIZE, 1)) {
- error = -ENOMEM;
- goto out;
- }
- }
-
- if (lock->query && !ctx->have_info) {
- fop->flags |= EC_FLAG_QUERY_METADATA;
+ if (changed_flags & EC_FLAG_WAITING_XATTROP) {
/* Once we know that an xattrop will be needed,
* we try to get all available information in a
* single call. */
@@ -1208,9 +1241,17 @@ void ec_get_size_version(ec_lock_link_t *link)
if (error != 0) {
goto out;
}
+
+ xdata = dict_new();
+ if (xdata == NULL || dict_set_int32 (xdata, GF_GET_SIZE, 1)) {
+ error = -ENOMEM;
+ goto out;
+ }
+
}
}
- if (set_dirty) {
+
+ if (memcmp (allzero, dirty, sizeof (allzero))) {
error = ec_dict_set_array(dict, EC_XATTR_DIRTY, dirty,
EC_VERSION_SIZE);
if (error != 0) {
@@ -1943,7 +1984,7 @@ int32_t ec_update_size_version_done(call_frame_t * frame, void * cookie,
ctx->have_size = _gf_true;
}
if ((ec_dict_del_config(xdata, EC_XATTR_CONFIG, &ctx->config) == 0) &&
- ec_config_check(fop->parent, &ctx->config)) {
+ ec_config_check(fop->xl, &ctx->config)) {
ctx->have_config = _gf_true;
}
diff --git a/xlators/cluster/ec/src/ec-common.h b/xlators/cluster/ec/src/ec-common.h
index a03a590..8f5d20a 100644
--- a/xlators/cluster/ec/src/ec-common.h
+++ b/xlators/cluster/ec/src/ec-common.h
@@ -27,9 +27,11 @@ typedef enum {
#define EC_CONFIG_ALGORITHM 0
-#define EC_FLAG_LOCK_SHARED 0x0001
-#define EC_FLAG_WAITING_XATTROP 0x0002
-#define EC_FLAG_QUERY_METADATA 0x0004
+#define EC_FLAG_LOCK_SHARED 0x0001
+
+#define EC_FLAG_WAITING_XATTROP 0x0001
+#define EC_FLAG_WAITING_DATA_DIRTY 0x0002
+#define EC_FLAG_WAITING_METADATA_DIRTY 0x0004
#define EC_SELFHEAL_BIT 62
diff --git a/xlators/cluster/ec/src/ec-types.h b/xlators/cluster/ec/src/ec-types.h
index 3e93a1a..5601f96 100644
--- a/xlators/cluster/ec/src/ec-types.h
+++ b/xlators/cluster/ec/src/ec-types.h
@@ -227,8 +227,8 @@ struct _ec_lock {
uintptr_t healing;
uint32_t refs_owners; /* Refs for fops owning the lock */
uint32_t refs_pending; /* Refs assigned to fops being prepared */
+ uint32_t waiting_flags; /*Track xattrop/dirty marking*/
gf_boolean_t acquired;
- gf_boolean_t getting_xattr;
gf_boolean_t unlock_now;
gf_boolean_t release;
gf_boolean_t query;
@@ -250,6 +250,7 @@ struct _ec_lock_link {
gf_boolean_t optimistic_changelog;
loc_t *base;
uint64_t size;
+ uint32_t waiting_flags;
};
struct _ec_fop_data {
--
1.8.3.1

View File

@ -1,343 +0,0 @@
From c3161248afdb42d1bf5e06a32041180cc4be457d Mon Sep 17 00:00:00 2001
From: Xavier Hernandez <jahernan@redhat.com>
Date: Fri, 6 Oct 2017 10:39:58 +0200
Subject: [PATCH 077/128] cluster/ec: add functions for stripe alignment
This patch removes old functions to align offsets and sizes
to stripe size boundaries and adds new ones to offer more
possibilities.
The new functions are:
* ec_adjust_offset_down()
Aligns a given offset to a multiple of the stripe size
equal or smaller than the initial one. It returns the
size of the gap between the aligned offset and the given
one.
* ec_adjust_offset_up()
Aligns a given offset to a multiple of the stripe size
equal or greater than the initial one. It returns the
size of the skipped region between the given offset and
the aligned one. If an overflow happens, the returned
valid has negative sign (but correct value) and the
offset is set to the maximum value (not aligned).
* ec_adjust_size_down()
Aligns the given size to a multiple of the stripe size
equal or smaller than the initial one. It returns the
size of the missed region between the aligned size and
the given one.
* ec_adjust_size_up()
Aligns the given size to a multiple of the stripe size
equal or greater than the initial one. It returns the
size of the gap between the given size and the aligned
one. If an overflow happens, the returned value has
negative sign (but correct value) and the size is set
to the maximum value (not aligned).
These functions have been defined in ec-helpers.h as static
inline since they are very small and compilers can optimize
them (specially the 'scale' argument).
upstream patch: https://review.gluster.org/#/c/18440/
>Change-Id: I4c91009ad02f76c73772034dfde27ee1c78a80d7
>Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
BUG: 1499865
Change-Id: I4c91009ad02f76c73772034dfde27ee1c78a80d7
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123556
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Javier Hernandez Juan <jahernan@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/cluster/ec/src/ec-heal.c | 8 ++-
xlators/cluster/ec/src/ec-helpers.c | 29 ---------
xlators/cluster/ec/src/ec-helpers.h | 108 +++++++++++++++++++++++++++++++-
xlators/cluster/ec/src/ec-inode-read.c | 10 +--
xlators/cluster/ec/src/ec-inode-write.c | 13 ++--
xlators/cluster/ec/src/ec-locks.c | 8 +--
6 files changed, 129 insertions(+), 47 deletions(-)
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
index a6de3ee..bc25015 100644
--- a/xlators/cluster/ec/src/ec-heal.c
+++ b/xlators/cluster/ec/src/ec-heal.c
@@ -1670,7 +1670,8 @@ ec_heal_data_find_direction (ec_t *ec, default_args_cbk_t *replies,
* well*/
if (check_ondisksize) {
- source_size = ec_adjust_size (ec, size[source], 1);
+ source_size = size[source];
+ ec_adjust_size_up (ec, &source_size, _gf_true);
for (i = 0; i < ec->nodes; i++) {
if (sources[i]) {
@@ -1983,7 +1984,7 @@ ec_rebuild_data (call_frame_t *frame, ec_t *ec, fd_t *fd, uint64_t size,
heal->fd = fd_ref (fd);
heal->xl = ec->xl;
heal->data = &barrier;
- size = ec_adjust_size (ec, size, 0);
+ ec_adjust_size_up (ec, &size, _gf_false);
heal->total_size = size;
heal->size = (128 * GF_UNIT_KB * (ec->self_heal_window_size));
/* We need to adjust the size to a multiple of the stripe size of the
@@ -2038,7 +2039,8 @@ __ec_heal_trim_sinks (call_frame_t *frame, ec_t *ec,
ret = 0;
goto out;
}
- trim_offset = ec_adjust_size (ec, size, 1);
+ trim_offset = size;
+ ec_adjust_offset_up (ec, &trim_offset, _gf_true);
ret = cluster_ftruncate (ec->xl_list, trim, ec->nodes, replies, output,
frame, ec->xl, fd, trim_offset, NULL);
for (i = 0; i < ec->nodes; i++) {
diff --git a/xlators/cluster/ec/src/ec-helpers.c b/xlators/cluster/ec/src/ec-helpers.c
index 64b010f..0c66948 100644
--- a/xlators/cluster/ec/src/ec-helpers.c
+++ b/xlators/cluster/ec/src/ec-helpers.c
@@ -799,35 +799,6 @@ ec_fd_t * ec_fd_get(fd_t * fd, xlator_t * xl)
return ctx;
}
-uint32_t ec_adjust_offset(ec_t * ec, off_t * offset, int32_t scale)
-{
- off_t head, tmp;
-
- tmp = *offset;
- head = tmp % ec->stripe_size;
- tmp -= head;
- if (scale)
- {
- tmp /= ec->fragments;
- }
-
- *offset = tmp;
-
- return head;
-}
-
-uint64_t ec_adjust_size(ec_t * ec, uint64_t size, int32_t scale)
-{
- size += ec->stripe_size - 1;
- size -= size % ec->stripe_size;
- if (scale)
- {
- size /= ec->fragments;
- }
-
- return size;
-}
-
gf_boolean_t
ec_is_internal_xattr (dict_t *dict, char *key, data_t *value, void *data)
{
diff --git a/xlators/cluster/ec/src/ec-helpers.h b/xlators/cluster/ec/src/ec-helpers.h
index 4d2145c..cfd7daa 100644
--- a/xlators/cluster/ec/src/ec-helpers.h
+++ b/xlators/cluster/ec/src/ec-helpers.h
@@ -55,8 +55,112 @@ ec_inode_t * ec_inode_get(inode_t * inode, xlator_t * xl);
ec_fd_t * __ec_fd_get(fd_t * fd, xlator_t * xl);
ec_fd_t * ec_fd_get(fd_t * fd, xlator_t * xl);
-uint32_t ec_adjust_offset(ec_t * ec, off_t * offset, int32_t scale);
-uint64_t ec_adjust_size(ec_t * ec, uint64_t size, int32_t scale);
+static inline uint32_t
+ec_adjust_size_down(ec_t *ec, uint64_t *value, gf_boolean_t scale)
+{
+ uint64_t head, tmp;
+
+ tmp = *value;
+ head = tmp % ec->stripe_size;
+ tmp -= head;
+
+ if (scale) {
+ tmp /= ec->fragments;
+ }
+
+ *value = tmp;
+
+ return (uint32_t)head;
+}
+
+/* This function can cause an overflow if the passed value is too near to the
+ * uint64_t limit. If this happens, it returns the tail in negative form and
+ * the value is set to UINT64_MAX. */
+static inline int32_t
+ec_adjust_size_up(ec_t *ec, uint64_t *value, gf_boolean_t scale)
+{
+ uint64_t tmp;
+ int32_t tail;
+
+ tmp = *value;
+ /* We first adjust the value down. This never causes overflow. */
+ tail = ec_adjust_size_down(ec, &tmp, scale);
+
+ /* If the value was already aligned, tail will be 0 and nothing else
+ * needs to be done. */
+ if (tail != 0) {
+ /* Otherwise, we need to compute the real tail and adjust the
+ * returned value to the next stripe. */
+ tail = ec->stripe_size - tail;
+ if (scale) {
+ tmp += ec->fragment_size;
+ } else {
+ tmp += ec->stripe_size;
+ /* If no scaling is requested there's a posibility of
+ * overflow. */
+ if (tmp < ec->stripe_size) {
+ tmp = UINT64_MAX;
+ tail = -tail;
+ }
+ }
+ }
+
+ *value = tmp;
+
+ return tail;
+}
+
+/* This function is equivalent to ec_adjust_size_down() but with a potentially
+ * different parameter size (off_t vs uint64_t). */
+static inline uint32_t
+ec_adjust_offset_down(ec_t *ec, off_t *value, gf_boolean_t scale)
+{
+ off_t head, tmp;
+
+ tmp = *value;
+ head = tmp % ec->stripe_size;
+ tmp -= head;
+
+ if (scale) {
+ tmp /= ec->fragments;
+ }
+
+ *value = tmp;
+
+ return (uint32_t)head;
+}
+
+/* This function is equivalent to ec_adjust_size_up() but with a potentially
+ * different parameter size (off_t vs uint64_t). */
+static inline int32_t
+ec_adjust_offset_up(ec_t *ec, off_t *value, gf_boolean_t scale)
+{
+ uint64_t tail, tmp;
+
+ /* An offset is a signed type that can only have positive values, so
+ * we take advantage of this to avoid overflows. We simply convert it
+ * to an unsigned integer and operate normally. This won't cause an
+ * overflow. Overflow is only checked when converting back to an
+ * off_t. */
+ tmp = *value;
+ tail = ec->stripe_size;
+ tail -= (tmp + tail - 1) % tail + 1;
+ tmp += tail;
+ if (scale) {
+ /* If we are scaling, we'll never get an overflow. */
+ tmp /= ec->fragments;
+ } else {
+ /* Check if there has been an overflow. */
+ if ((off_t)tmp < 0) {
+ tmp = (1ULL << (sizeof(off_t) * 8 - 1)) - 1ULL;
+ tail = -tail;
+ }
+ }
+
+ *value = (off_t)tmp;
+
+ return (int32_t)tail;
+}
static inline int32_t ec_is_power_of_2(uint32_t value)
{
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c
index d925e82..829f47f 100644
--- a/xlators/cluster/ec/src/ec-inode-read.c
+++ b/xlators/cluster/ec/src/ec-inode-read.c
@@ -1356,9 +1356,10 @@ int32_t ec_manager_readv(ec_fop_data_t * fop, int32_t state)
{
case EC_STATE_INIT:
fop->user_size = fop->size;
- fop->head = ec_adjust_offset(fop->xl->private, &fop->offset, 1);
- fop->size = ec_adjust_size(fop->xl->private, fop->size + fop->head,
- 1);
+ fop->head = ec_adjust_offset_down(fop->xl->private, &fop->offset,
+ _gf_true);
+ fop->size += fop->head;
+ ec_adjust_size_up(fop->xl->private, &fop->size, _gf_true);
/* Fall through */
@@ -1561,7 +1562,8 @@ int32_t ec_manager_seek(ec_fop_data_t *fop, int32_t state)
switch (state) {
case EC_STATE_INIT:
fop->user_size = fop->offset;
- fop->head = ec_adjust_offset(fop->xl->private, &fop->offset, 1);
+ fop->head = ec_adjust_offset_down(fop->xl->private, &fop->offset,
+ _gf_true);
/* Fall through */
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c
index 68bea1a..3ed9b2a 100644
--- a/xlators/cluster/ec/src/ec-inode-write.c
+++ b/xlators/cluster/ec/src/ec-inode-write.c
@@ -870,8 +870,10 @@ int32_t ec_manager_fallocate(ec_fop_data_t *fop, int32_t state)
return EC_STATE_REPORT;
}
fop->user_size = fop->offset + fop->size;
- fop->head = ec_adjust_offset (fop->xl->private, &fop->offset, 1);
- fop->size = ec_adjust_size (fop->xl->private, fop->head + fop->size, 1);
+ fop->head = ec_adjust_offset_down (fop->xl->private, &fop->offset,
+ _gf_true);
+ fop->size += fop->head;
+ ec_adjust_size_up (fop->xl->private, &fop->size, _gf_true);
/* Fall through */
@@ -1145,7 +1147,7 @@ int32_t ec_manager_truncate(ec_fop_data_t * fop, int32_t state)
{
case EC_STATE_INIT:
fop->user_size = fop->offset;
- fop->offset = ec_adjust_size(fop->xl->private, fop->offset, 1);
+ ec_adjust_offset_up(fop->xl->private, &fop->offset, _gf_true);
/* Fall through */
@@ -1508,8 +1510,9 @@ ec_writev_prepare_buffers(ec_t *ec, ec_fop_data_t *fop)
int32_t err;
fop->user_size = iov_length(fop->vector, fop->int32);
- fop->head = ec_adjust_offset(ec, &fop->offset, 0);
- fop->size = ec_adjust_size(ec, fop->user_size + fop->head, 0);
+ fop->head = ec_adjust_offset_down(ec, &fop->offset, _gf_false);
+ fop->size = fop->user_size + fop->head;
+ ec_adjust_size_up(ec, &fop->size, _gf_false);
if ((fop->int32 != 1) || (fop->head != 0) ||
(fop->size > fop->user_size) ||
diff --git a/xlators/cluster/ec/src/ec-locks.c b/xlators/cluster/ec/src/ec-locks.c
index ff09852..996035d 100644
--- a/xlators/cluster/ec/src/ec-locks.c
+++ b/xlators/cluster/ec/src/ec-locks.c
@@ -572,10 +572,10 @@ int32_t ec_manager_inodelk(ec_fop_data_t * fop, int32_t state)
switch (state)
{
case EC_STATE_INIT:
- fop->flock.l_len += ec_adjust_offset(fop->xl->private,
- &fop->flock.l_start, 1);
- fop->flock.l_len = ec_adjust_size(fop->xl->private,
- fop->flock.l_len, 1);
+ fop->flock.l_len += ec_adjust_offset_down(fop->xl->private,
+ &fop->flock.l_start,
+ _gf_true);
+ ec_adjust_offset_up(fop->xl->private, &fop->flock.l_len, _gf_true);
if ((fop->int32 == F_SETLKW) && (fop->flock.l_type != F_UNLCK))
{
fop->uint32 = EC_LOCK_MODE_ALL;
--
1.8.3.1

View File

@ -1,76 +0,0 @@
From 1bcb5bbd42a4187ed385853f0364a3941bea9846 Mon Sep 17 00:00:00 2001
From: karthik-us <ksubrahm@redhat.com>
Date: Fri, 17 Nov 2017 17:29:36 +0530
Subject: [PATCH 078/128] cluster/afr: Honor default timeout of 5min for
analyzing split-brain files
Problem:
After setting split-brain-choice option to analyze the file to resolve
the split brain using the command
"setfattr -n replica.split-brain-choice -v "choiceX" <path-to-file>"
should allow to access the file from mount for default timeout of 5mins.
But the timeout was not honored and was able to access the file even after
the timeout.
Fix:
Call the inode_invalidate() in afr_set_split_brain_choice_cbk() so that
it will triger the cache invalidate after resetting the timer and the
split brain choice. So the next calls to access the file will fail with EIO.
Upstream patch: https://review.gluster.org/#/c/18546/
> Change-Id: I698cb833676b22ff3e4c6daf8b883a0958f51a64
> BUG: 1503519
> Signed-off-by: karthik-us <ksubrahm@redhat.com>
Change-Id: I698cb833676b22ff3e4c6daf8b883a0958f51a64
BUG: 1360331
Signed-off-by: karthik-us <ksubrahm@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123560
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/cluster/afr/src/afr-common.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 2925a1d..9c96056 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -730,6 +730,7 @@ afr_set_split_brain_choice_cbk (void *data)
xlator_t *this = THIS;
afr_spb_choice_timeout_cancel (this, inode);
+ inode_invalidate (inode);
inode_unref (inode);
return;
}
@@ -749,6 +750,7 @@ afr_set_split_brain_choice (int ret, call_frame_t *frame, void *opaque)
gf_boolean_t timer_set = _gf_false;
gf_boolean_t timer_cancelled = _gf_false;
gf_boolean_t timer_reset = _gf_false;
+ gf_boolean_t need_invalidate = _gf_true;
int old_spb_choice = -1;
frame = data->frame;
@@ -861,6 +863,7 @@ set_timer:
timer_set = _gf_true;
if (timer_reset && !ctx->timer)
timer_cancelled = _gf_true;
+ need_invalidate = _gf_false;
}
unlock:
UNLOCK(&inode->lock);
@@ -873,7 +876,8 @@ unlock:
* reads from an older cached value despite a change in spb_choice to
* a new value.
*/
- inode_invalidate (inode);
+ if (need_invalidate)
+ inode_invalidate (inode);
out:
if (data)
GF_FREE (data);
--
1.8.3.1

View File

@ -1,959 +0,0 @@
From c098fa2192eedbfaad7ac850d0fb152695a3becf Mon Sep 17 00:00:00 2001
From: Pranith Kumar K <pkarampu@redhat.com>
Date: Sun, 25 Jun 2017 16:34:01 +0530
Subject: [PATCH 079/128] cluster/ec: Allow parallel writes in EC if possible
Problem:
Ec at the moment sends one modification fop after another, so if some of
the disks become slow, for a while then the wait time for the writes that
are waiting in the queue becomes really bad.
Fix:
Allow parallel writes when possible. For this we need to make 3 changes.
1) Each fop now has range parameters they will be updating.
2) Xattrop is changed to handle parallel xattrop requests where some
would be modifying just dirty xattr.
3) Fops that refer to size now take locks and update the locks.
upstream patch: https://review.gluster.org/#/c/17625/
>Fixes #251
>Change-Id: Ibc3c15372f91bbd6fb617f0d99399b3149fa64b2
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Note:
There is a delta compared to upstream patch:
For "disperse.parallel-writes" key we have reverted the flags
to reflect old type. Added New OP_VERSION for 3.13.0 in globals.h.
BUG: 1459101
Change-Id: Ibc3c15372f91bbd6fb617f0d99399b3149fa64b2
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123561
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Ashish Pandey <aspandey@redhat.com>
---
libglusterfs/src/globals.h | 4 +-
xlators/cluster/ec/src/ec-common.c | 191 ++++++++++++++++--------
xlators/cluster/ec/src/ec-common.h | 10 +-
xlators/cluster/ec/src/ec-dir-read.c | 6 +-
xlators/cluster/ec/src/ec-generic.c | 12 +-
xlators/cluster/ec/src/ec-inode-read.c | 22 ++-
xlators/cluster/ec/src/ec-inode-write.c | 124 +++++++++------
xlators/cluster/ec/src/ec-types.h | 8 +-
xlators/cluster/ec/src/ec.c | 51 ++++---
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 6 +
10 files changed, 291 insertions(+), 143 deletions(-)
diff --git a/libglusterfs/src/globals.h b/libglusterfs/src/globals.h
index bd7cffe..c627cfe 100644
--- a/libglusterfs/src/globals.h
+++ b/libglusterfs/src/globals.h
@@ -43,7 +43,7 @@
*/
#define GD_OP_VERSION_MIN 1 /* MIN is the fresh start op-version, mostly
should not change */
-#define GD_OP_VERSION_MAX GD_OP_VERSION_3_12_2 /* MAX VERSION is the maximum
+#define GD_OP_VERSION_MAX GD_OP_VERSION_3_13_0 /* MAX VERSION is the maximum
count in VME table, should
keep changing with
introduction of newer
@@ -101,6 +101,8 @@
#define GD_OP_VERSION_3_12_2 31202 /* Op-version for GlusterFS 3.12.2 */
+#define GD_OP_VERSION_3_13_0 31300 /* Op-version for GlusterFS 3.13.0 */
+
#include "xlator.h"
/* THIS */
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
index 6963907..f86ecf8 100644
--- a/xlators/cluster/ec/src/ec-common.c
+++ b/xlators/cluster/ec/src/ec-common.c
@@ -25,6 +25,40 @@
EC_FLAG_WAITING_DATA_DIRTY |\
EC_FLAG_WAITING_METADATA_DIRTY)
+off_t
+ec_range_end_get (off_t fl_start, size_t fl_size)
+{
+ off_t fl_end = 0;
+ switch (fl_size) {
+ case 0:
+ return fl_start;
+ case LLONG_MAX: /*Infinity*/
+ return LLONG_MAX;
+ default:
+ fl_end = fl_start + fl_size - 1;
+ if (fl_end < 0) /*over-flow*/
+ return LLONG_MAX;
+ else
+ return fl_end;
+ }
+}
+
+static gf_boolean_t
+ec_is_range_conflict (ec_lock_link_t *l1, ec_lock_link_t *l2)
+{
+ return ((l1->fl_end >= l2->fl_start) && (l2->fl_end >= l1->fl_start));
+}
+
+static gf_boolean_t
+ec_lock_conflict (ec_lock_link_t *l1, ec_lock_link_t *l2)
+{
+ if ((l1->fop->flags & EC_FLAG_LOCK_SHARED) &&
+ (l2->fop->flags & EC_FLAG_LOCK_SHARED))
+ return _gf_false;
+
+ return ec_is_range_conflict (l1, l2);
+}
+
uint32_t
ec_select_first_by_read_policy (ec_t *ec, ec_fop_data_t *fop)
{
@@ -724,7 +758,7 @@ int32_t ec_lock_compare(ec_lock_t * lock1, ec_lock_t * lock2)
}
void ec_lock_insert(ec_fop_data_t *fop, ec_lock_t *lock, uint32_t flags,
- loc_t *base)
+ loc_t *base, off_t fl_start, size_t fl_size)
{
ec_lock_link_t *link;
@@ -758,12 +792,15 @@ void ec_lock_insert(ec_fop_data_t *fop, ec_lock_t *lock, uint32_t flags,
link->update[EC_DATA_TXN] = (flags & EC_UPDATE_DATA) != 0;
link->update[EC_METADATA_TXN] = (flags & EC_UPDATE_META) != 0;
link->base = base;
+ link->fl_start = fl_start;
+ link->fl_end = ec_range_end_get (fl_start, fl_size);
lock->refs_pending++;
}
void ec_lock_prepare_inode_internal(ec_fop_data_t *fop, loc_t *loc,
- uint32_t flags, loc_t *base)
+ uint32_t flags, loc_t *base,
+ off_t fl_start, size_t fl_size)
{
ec_lock_t *lock = NULL;
ec_inode_t *ctx;
@@ -824,16 +861,17 @@ void ec_lock_prepare_inode_internal(ec_fop_data_t *fop, loc_t *loc,
ctx->inode_lock = lock;
insert:
- ec_lock_insert(fop, lock, flags, base);
+ ec_lock_insert(fop, lock, flags, base, fl_start, fl_size);
update_query:
lock->query |= (flags & EC_QUERY_INFO) != 0;
unlock:
UNLOCK(&loc->inode->lock);
}
-void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags)
+void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags,
+ off_t fl_start, size_t fl_size)
{
- ec_lock_prepare_inode_internal(fop, loc, flags, NULL);
+ ec_lock_prepare_inode_internal(fop, loc, flags, NULL, fl_start, fl_size);
}
void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base,
@@ -859,12 +897,13 @@ void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base,
base = NULL;
}
- ec_lock_prepare_inode_internal(fop, &tmp, flags, base);
+ ec_lock_prepare_inode_internal(fop, &tmp, flags, base, 0, LLONG_MAX);
loc_wipe(&tmp);
}
-void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags)
+void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags,
+ off_t fl_start, size_t fl_size)
{
loc_t loc;
int32_t err;
@@ -880,7 +919,7 @@ void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags)
return;
}
- ec_lock_prepare_inode_internal(fop, &loc, flags, NULL);
+ ec_lock_prepare_inode_internal(fop, &loc, flags, NULL, fl_start, fl_size);
loc_wipe(&loc);
}
@@ -1314,17 +1353,16 @@ out:
}
}
-gf_boolean_t ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode,
- uint64_t *size)
+gf_boolean_t
+__ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode,
+ uint64_t *size)
{
ec_inode_t *ctx;
gf_boolean_t found = _gf_false;
- LOCK(&inode->lock);
-
ctx = __ec_inode_get(inode, fop->xl);
if (ctx == NULL) {
- goto unlock;
+ goto out;
}
if (ctx->have_size) {
@@ -1332,23 +1370,35 @@ gf_boolean_t ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode,
found = _gf_true;
}
-unlock:
+out:
+ return found;
+}
+
+gf_boolean_t
+ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode,
+ uint64_t *size)
+{
+ gf_boolean_t found = _gf_false;
+
+ LOCK(&inode->lock);
+ {
+ found = __ec_get_inode_size (fop, inode, size);
+ }
UNLOCK(&inode->lock);
return found;
}
-gf_boolean_t ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode,
- uint64_t size)
+gf_boolean_t
+__ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode,
+ uint64_t size)
{
ec_inode_t *ctx;
gf_boolean_t found = _gf_false;
- LOCK(&inode->lock);
-
ctx = __ec_inode_get(inode, fop->xl);
if (ctx == NULL) {
- goto unlock;
+ goto out;
}
/* Normal fops always have ctx->have_size set. However self-heal calls this
@@ -1363,8 +1413,21 @@ gf_boolean_t ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode,
found = _gf_true;
-unlock:
- UNLOCK(&inode->lock);
+out:
+ return found;
+}
+
+gf_boolean_t
+ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode,
+ uint64_t size)
+{
+ gf_boolean_t found = _gf_false;
+
+ LOCK (&inode->lock);
+ {
+ found = __ec_set_inode_size (fop, inode, size);
+ }
+ UNLOCK (&inode->lock);
return found;
}
@@ -1471,34 +1534,47 @@ ec_lock_update_fd(ec_lock_t *lock, ec_fop_data_t *fop)
}
}
+static gf_boolean_t
+ec_link_has_lock_conflict (ec_lock_link_t *link, struct list_head *owners)
+{
+ ec_lock_link_t *owner_link = NULL;
+ ec_t *ec = link->fop->xl->private;
+
+ if (!ec->parallel_writes)
+ return _gf_true;
+
+ list_for_each_entry (owner_link, owners, owner_list) {
+ if (ec_lock_conflict (owner_link, link))
+ return _gf_true;
+ }
+ return _gf_false;
+}
+
static void
ec_lock_wake_shared(ec_lock_t *lock, struct list_head *list)
{
ec_fop_data_t *fop;
ec_lock_link_t *link;
- gf_boolean_t exclusive = _gf_false;
+ gf_boolean_t conflict = _gf_false;
- while (!exclusive && !list_empty(&lock->waiting)) {
+ while (!conflict && !list_empty(&lock->waiting)) {
link = list_entry(lock->waiting.next, ec_lock_link_t, wait_list);
fop = link->fop;
/* If lock is not acquired, at most one fop can be assigned as owner.
* The following fops will need to wait in the lock->waiting queue
* until the lock has been fully acquired. */
- exclusive = !lock->acquired;
+ conflict = !lock->acquired;
/* If the fop is not shareable, only this fop can be assigned as owner.
* Other fops will need to wait until this one finishes. */
- if ((fop->flags & EC_FLAG_LOCK_SHARED) == 0) {
- exclusive = _gf_true;
-
- /* Avoid other requests to be assigned as owners. */
- lock->exclusive = 1;
+ if (ec_link_has_lock_conflict (link, &lock->owners)) {
+ conflict = _gf_true;
}
/* If only one fop is allowed, it can be assigned as the owner of the
* lock only if there weren't any other owner. */
- if (exclusive && !list_empty(&lock->owners)) {
+ if (conflict && !list_empty(&lock->owners)) {
break;
}
@@ -1565,9 +1641,7 @@ void ec_lock_acquired(ec_lock_link_t *link)
lock->acquired = _gf_true;
ec_lock_update_fd(lock, fop);
- if ((fop->flags & EC_FLAG_LOCK_SHARED) != 0) {
- ec_lock_wake_shared(lock, &list);
- }
+ ec_lock_wake_shared(lock, &list);
UNLOCK(&lock->loc.inode->lock);
@@ -1678,11 +1752,11 @@ ec_lock_assign_owner(ec_lock_link_t *link)
/* We are trying to acquire a lock that has an unlock timer active.
* This means that the lock must be idle, i.e. no fop can be in the
* owner, waiting or frozen lists. It also means that the lock cannot
- * have been marked as being released (this is done without timers)
- * and it must not be exclusive. There should only be one owner
- * reference, but it's possible that some fops are being prepared to
- * use this lock. */
- GF_ASSERT ((lock->exclusive == 0) && (lock->refs_owners == 1) &&
+ * have been marked as being released (this is done without timers).
+ * There should only be one owner reference, but it's possible that
+ * some fops are being prepared to use this lock.
+ */
+ GF_ASSERT ((lock->refs_owners == 1) &&
list_empty(&lock->owners) && list_empty(&lock->waiting));
/* We take the timer_link before cancelling the timer, since a
@@ -1730,13 +1804,15 @@ ec_lock_assign_owner(ec_lock_link_t *link)
lock->timer = NULL;
}
- lock->exclusive |= (fop->flags & EC_FLAG_LOCK_SHARED) == 0;
-
if (!list_empty(&lock->owners)) {
/* There are other owners of this lock. We can only take ownership if
- * the lock is already acquired and can be shared. Otherwise we need
- * to wait. */
- if (!lock->acquired || (lock->exclusive != 0)) {
+ * the lock is already acquired and doesn't have conflict with existing
+ * owners, or waiters(to prevent starvation).
+ * Otherwise we need to wait.
+ */
+ if (!lock->acquired ||
+ ec_link_has_lock_conflict (link, &lock->owners) ||
+ ec_link_has_lock_conflict (link, &lock->waiting)) {
ec_trace("LOCK_QUEUE_WAIT", fop, "lock=%p", lock);
list_add_tail(&link->wait_list, &lock->waiting);
@@ -1814,10 +1890,7 @@ ec_lock_next_owner(ec_lock_link_t *link, ec_cbk_data_t *cbk,
}
ec_lock_update_good(lock, fop);
- lock->exclusive -= (fop->flags & EC_FLAG_LOCK_SHARED) == 0;
- if (list_empty(&lock->owners)) {
- ec_lock_wake_shared(lock, &list);
- }
+ ec_lock_wake_shared(lock, &list);
UNLOCK(&lock->loc.inode->lock);
@@ -1871,11 +1944,11 @@ ec_lock_unfreeze(ec_lock_link_t *link)
lock->acquired = _gf_false;
/* We are unfreezing a lock. This means that the lock has already been
- * released. In this state it shouldn't be exclusive nor have a pending
- * timer nor have any owner, and the waiting list should be empty. Only
- * the frozen list can contain some fop. */
- GF_ASSERT((lock->exclusive == 0) && (lock->timer == NULL) &&
- list_empty(&lock->waiting) && list_empty(&lock->owners));
+ * released. In this state it shouldn't have a pending timer nor have any
+ * owner, and the waiting list should be empty. Only the frozen list can
+ * contain some fop. */
+ GF_ASSERT((lock->timer == NULL) && list_empty(&lock->waiting) &&
+ list_empty(&lock->owners));
/* We move all frozen fops to the waiting list. */
list_splice_init(&lock->frozen, &lock->waiting);
@@ -2008,7 +2081,7 @@ ec_update_size_version(ec_lock_link_t *link, uint64_t *version,
ec_fop_data_t *fop;
ec_lock_t *lock;
ec_inode_t *ctx;
- dict_t * dict;
+ dict_t *dict = NULL;
uintptr_t update_on = 0;
int32_t err = -ENOMEM;
@@ -2198,12 +2271,12 @@ ec_unlock_timer_del(ec_lock_link_t *link)
ec_trace("UNLOCK_DELAYED", link->fop, "lock=%p", lock);
/* The unlock timer has expired without anyone cancelling it.
- * This means that it shouldn't have any owner, and the
- * waiting and frozen lists should be empty. It shouldn't have
- * been marked as release nor be exclusive either. It must have
- * only one owner reference, but there can be fops being
- * prepared though. */
- GF_ASSERT(!lock->release && (lock->exclusive == 0) &&
+ * This means that it shouldn't have any owner, and the waiting
+ * and frozen lists should be empty. It must have only one
+ * owner reference, but there can be fops being prepared
+ * though.
+ * */
+ GF_ASSERT(!lock->release &&
(lock->refs_owners == 1) &&
list_empty(&lock->owners) &&
list_empty(&lock->waiting) &&
diff --git a/xlators/cluster/ec/src/ec-common.h b/xlators/cluster/ec/src/ec-common.h
index 8f5d20a..1a947cc 100644
--- a/xlators/cluster/ec/src/ec-common.h
+++ b/xlators/cluster/ec/src/ec-common.h
@@ -91,18 +91,24 @@ ec_fop_prepare_answer(ec_fop_data_t *fop, gf_boolean_t ro);
gf_boolean_t
ec_cbk_set_error(ec_cbk_data_t *cbk, int32_t error, gf_boolean_t ro);
-void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags);
+void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags,
+ off_t fl_start, size_t fl_size);
void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base,
uint32_t flags);
-void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags);
+void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags,
+ off_t fl_start, size_t fl_size);
void ec_lock(ec_fop_data_t * fop);
void ec_lock_reuse(ec_fop_data_t *fop);
void ec_unlock(ec_fop_data_t * fop);
gf_boolean_t ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode,
uint64_t *size);
+gf_boolean_t __ec_get_inode_size(ec_fop_data_t *fop, inode_t *inode,
+ uint64_t *size);
gf_boolean_t ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode,
uint64_t size);
+gf_boolean_t __ec_set_inode_size(ec_fop_data_t *fop, inode_t *inode,
+ uint64_t size);
void ec_clear_inode_info(ec_fop_data_t *fop, inode_t *inode);
void ec_flush_size_version(ec_fop_data_t * fop);
diff --git a/xlators/cluster/ec/src/ec-dir-read.c b/xlators/cluster/ec/src/ec-dir-read.c
index 4fe82e3..48afe54 100644
--- a/xlators/cluster/ec/src/ec-dir-read.c
+++ b/xlators/cluster/ec/src/ec-dir-read.c
@@ -141,7 +141,8 @@ int32_t ec_manager_opendir(ec_fop_data_t * fop, int32_t state)
/* Fall through */
case EC_STATE_LOCK:
- ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO);
+ ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO, 0,
+ LLONG_MAX);
ec_lock(fop);
return EC_STATE_DISPATCH;
@@ -432,7 +433,8 @@ int32_t ec_manager_readdir(ec_fop_data_t * fop, int32_t state)
}
fop->mask &= 1ULL << idx;
} else {
- ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO);
+ ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0,
+ LLONG_MAX);
ec_lock(fop);
}
diff --git a/xlators/cluster/ec/src/ec-generic.c b/xlators/cluster/ec/src/ec-generic.c
index ddb90ce..a5f986e 100644
--- a/xlators/cluster/ec/src/ec-generic.c
+++ b/xlators/cluster/ec/src/ec-generic.c
@@ -85,7 +85,7 @@ int32_t ec_manager_flush(ec_fop_data_t * fop, int32_t state)
{
case EC_STATE_INIT:
case EC_STATE_LOCK:
- ec_lock_prepare_fd(fop, fop->fd, 0);
+ ec_lock_prepare_fd(fop, fop->fd, 0, 0, LLONG_MAX);
ec_lock(fop);
return EC_STATE_DISPATCH;
@@ -300,7 +300,7 @@ int32_t ec_manager_fsync(ec_fop_data_t * fop, int32_t state)
{
case EC_STATE_INIT:
case EC_STATE_LOCK:
- ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO);
+ ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0, LLONG_MAX);
ec_lock(fop);
return EC_STATE_DISPATCH;
@@ -501,7 +501,7 @@ int32_t ec_manager_fsyncdir(ec_fop_data_t * fop, int32_t state)
{
case EC_STATE_INIT:
case EC_STATE_LOCK:
- ec_lock_prepare_fd(fop, fop->fd, 0);
+ ec_lock_prepare_fd(fop, fop->fd, 0, 0, LLONG_MAX);
ec_lock(fop);
return EC_STATE_DISPATCH;
@@ -1220,9 +1220,11 @@ int32_t ec_manager_xattrop(ec_fop_data_t * fop, int32_t state)
case EC_STATE_INIT:
case EC_STATE_LOCK:
if (fop->fd == NULL) {
- ec_lock_prepare_inode(fop, &fop->loc[0], EC_UPDATE_META);
+ ec_lock_prepare_inode(fop, &fop->loc[0], EC_UPDATE_META, 0,
+ LLONG_MAX);
} else {
- ec_lock_prepare_fd(fop, fop->fd, EC_UPDATE_META);
+ ec_lock_prepare_fd(fop, fop->fd, EC_UPDATE_META, 0,
+ LLONG_MAX);
}
ec_lock(fop);
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c
index 829f47f..33fd7f5 100644
--- a/xlators/cluster/ec/src/ec-inode-read.c
+++ b/xlators/cluster/ec/src/ec-inode-read.c
@@ -72,7 +72,8 @@ ec_manager_access(ec_fop_data_t *fop, int32_t state)
switch (state) {
case EC_STATE_INIT:
case EC_STATE_LOCK:
- ec_lock_prepare_inode (fop, &fop->loc[0], EC_QUERY_INFO);
+ ec_lock_prepare_inode (fop, &fop->loc[0], EC_QUERY_INFO, 0,
+ LLONG_MAX);
ec_lock (fop);
return EC_STATE_DISPATCH;
@@ -311,9 +312,11 @@ int32_t ec_manager_getxattr(ec_fop_data_t * fop, int32_t state)
(strncmp(fop->str[0], GF_XATTR_CLRLK_CMD,
strlen(GF_XATTR_CLRLK_CMD)) != 0)) {
if (fop->fd == NULL) {
- ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO);
+ ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO,
+ 0, LLONG_MAX);
} else {
- ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO);
+ ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0,
+ LLONG_MAX);
}
ec_lock(fop);
}
@@ -1029,7 +1032,8 @@ int32_t ec_manager_readlink(ec_fop_data_t * fop, int32_t state)
{
case EC_STATE_INIT:
case EC_STATE_LOCK:
- ec_lock_prepare_inode (fop, &fop->loc[0], EC_QUERY_INFO);
+ ec_lock_prepare_inode (fop, &fop->loc[0], EC_QUERY_INFO, 0,
+ LLONG_MAX);
ec_lock (fop);
return EC_STATE_DISPATCH;
@@ -1364,7 +1368,8 @@ int32_t ec_manager_readv(ec_fop_data_t * fop, int32_t state)
/* Fall through */
case EC_STATE_LOCK:
- ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO);
+ ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, fop->offset,
+ fop->size);
ec_lock(fop);
return EC_STATE_DISPATCH;
@@ -1568,7 +1573,7 @@ int32_t ec_manager_seek(ec_fop_data_t *fop, int32_t state)
/* Fall through */
case EC_STATE_LOCK:
- ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO);
+ ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, fop->offset, LLONG_MAX);
ec_lock(fop);
return EC_STATE_DISPATCH;
@@ -1788,9 +1793,10 @@ int32_t ec_manager_stat(ec_fop_data_t * fop, int32_t state)
case EC_STATE_INIT:
case EC_STATE_LOCK:
if (fop->fd == NULL) {
- ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO);
+ ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO, 0,
+ LLONG_MAX);
} else {
- ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO);
+ ec_lock_prepare_fd(fop, fop->fd, EC_QUERY_INFO, 0, LLONG_MAX);
}
ec_lock(fop);
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c
index 3ed9b2a..e6a67cf 100644
--- a/xlators/cluster/ec/src/ec-inode-write.c
+++ b/xlators/cluster/ec/src/ec-inode-write.c
@@ -127,10 +127,12 @@ ec_manager_xattr (ec_fop_data_t *fop, int32_t state)
case EC_STATE_LOCK:
if (fop->fd == NULL) {
ec_lock_prepare_inode(fop, &fop->loc[0],
- EC_UPDATE_META | EC_QUERY_INFO);
+ EC_UPDATE_META | EC_QUERY_INFO,
+ 0, LLONG_MAX);
} else {
ec_lock_prepare_fd(fop, fop->fd,
- EC_UPDATE_META | EC_QUERY_INFO);
+ EC_UPDATE_META | EC_QUERY_INFO,
+ 0, LLONG_MAX);
}
ec_lock(fop);
@@ -369,10 +371,11 @@ int32_t ec_manager_setattr(ec_fop_data_t * fop, int32_t state)
case EC_STATE_LOCK:
if (fop->fd == NULL) {
ec_lock_prepare_inode(fop, &fop->loc[0],
- EC_UPDATE_META | EC_QUERY_INFO);
+ EC_UPDATE_META | EC_QUERY_INFO,
+ 0, LLONG_MAX);
} else {
- ec_lock_prepare_fd(fop, fop->fd,
- EC_UPDATE_META | EC_QUERY_INFO);
+ ec_lock_prepare_fd(fop, fop->fd, EC_UPDATE_META | EC_QUERY_INFO,
+ 0, LLONG_MAX);
}
ec_lock(fop);
@@ -879,8 +882,8 @@ int32_t ec_manager_fallocate(ec_fop_data_t *fop, int32_t state)
case EC_STATE_LOCK:
ec_lock_prepare_fd(fop, fop->fd,
- EC_UPDATE_DATA | EC_UPDATE_META |
- EC_QUERY_INFO);
+ EC_UPDATE_DATA | EC_UPDATE_META | EC_QUERY_INFO,
+ fop->offset, fop->size);
ec_lock(fop);
return EC_STATE_DISPATCH;
@@ -898,24 +901,28 @@ int32_t ec_manager_fallocate(ec_fop_data_t *fop, int32_t state)
cbk->count);
/* This shouldn't fail because we have the inode locked. */
- GF_ASSERT(ec_get_inode_size(fop, fop->locks[0].lock->loc.inode,
- &cbk->iatt[0].ia_size));
+ LOCK(&fop->locks[0].lock->loc.inode->lock);
+ {
+ GF_ASSERT(__ec_get_inode_size(fop,
+ fop->locks[0].lock->loc.inode,
+ &cbk->iatt[0].ia_size));
- /*If mode has FALLOC_FL_KEEP_SIZE keep the size */
- if (fop->int32 & FALLOC_FL_KEEP_SIZE) {
- cbk->iatt[1].ia_size = cbk->iatt[0].ia_size;
- } else if (fop->user_size > cbk->iatt[0].ia_size) {
- cbk->iatt[1].ia_size = fop->user_size;
-
- /* This shouldn't fail because we have the inode
- * locked. */
- GF_ASSERT(ec_set_inode_size(fop,
- fop->locks[0].lock->loc.inode,
- cbk->iatt[1].ia_size));
- } else {
- cbk->iatt[1].ia_size = cbk->iatt[0].ia_size;
+ /*If mode has FALLOC_FL_KEEP_SIZE keep the size */
+ if (fop->int32 & FALLOC_FL_KEEP_SIZE) {
+ cbk->iatt[1].ia_size = cbk->iatt[0].ia_size;
+ } else if (fop->user_size > cbk->iatt[0].ia_size) {
+ cbk->iatt[1].ia_size = fop->user_size;
+
+ /* This shouldn't fail because we have the inode
+ * locked. */
+ GF_ASSERT(__ec_set_inode_size(fop,
+ fop->locks[0].lock->loc.inode,
+ cbk->iatt[1].ia_size));
+ } else {
+ cbk->iatt[1].ia_size = cbk->iatt[0].ia_size;
+ }
}
-
+ UNLOCK(&fop->locks[0].lock->loc.inode->lock);
}
return EC_STATE_REPORT;
@@ -1155,11 +1162,11 @@ int32_t ec_manager_truncate(ec_fop_data_t * fop, int32_t state)
if (fop->id == GF_FOP_TRUNCATE) {
ec_lock_prepare_inode(fop, &fop->loc[0],
EC_UPDATE_DATA | EC_UPDATE_META |
- EC_QUERY_INFO);
+ EC_QUERY_INFO, fop->offset, LLONG_MAX);
} else {
ec_lock_prepare_fd(fop, fop->fd,
EC_UPDATE_DATA | EC_UPDATE_META |
- EC_QUERY_INFO);
+ EC_QUERY_INFO, fop->offset, LLONG_MAX);
}
ec_lock(fop);
@@ -1179,6 +1186,9 @@ int32_t ec_manager_truncate(ec_fop_data_t * fop, int32_t state)
cbk->count);
/* This shouldn't fail because we have the inode locked. */
+ /* Inode size doesn't need to be updated under locks, because
+ * conflicting operations won't be in-flight
+ */
GF_ASSERT(ec_get_inode_size(fop, fop->locks[0].lock->loc.inode,
&cbk->iatt[0].ia_size));
cbk->iatt[1].ia_size = fop->user_size;
@@ -1582,6 +1592,9 @@ void ec_writev_start(ec_fop_data_t *fop)
ctx = ec_fd_get(fop->fd, fop->xl);
if (ctx != NULL) {
if ((ctx->flags & O_APPEND) != 0) {
+ /* Appending writes take full locks so size won't change because
+ * of any parallel operations
+ */
fop->offset = current;
}
}
@@ -1601,6 +1614,10 @@ void ec_writev_start(ec_fop_data_t *fop)
}
tail = fop->size - fop->user_size - fop->head;
if ((tail > 0) && ((fop->head == 0) || (fop->size > ec->stripe_size))) {
+ /* Current locking scheme will make sure the 'current' below will
+ * never decrease while the fop is in progress, so the checks will
+ * work as expected
+ */
if (current > fop->offset + fop->head + fop->user_size) {
if (ec_make_internal_fop_xdata (&xdata)) {
err = -ENOMEM;
@@ -1678,14 +1695,32 @@ ec_writev_encode(ec_fop_data_t *fop)
int32_t ec_manager_writev(ec_fop_data_t *fop, int32_t state)
{
ec_cbk_data_t *cbk;
+ ec_fd_t *ctx = NULL;
+ ec_t *ec = fop->xl->private;
+ off_t fl_start = 0;
+ size_t fl_size = LLONG_MAX;
switch (state)
{
case EC_STATE_INIT:
case EC_STATE_LOCK:
+ ctx = ec_fd_get(fop->fd, fop->xl);
+ if (ctx != NULL) {
+ if ((ctx->flags & O_APPEND) == 0) {
+ off_t user_size = 0;
+ off_t head = 0;
+
+ fl_start = fop->offset;
+ user_size = iov_length(fop->vector, fop->int32);
+ head = ec_adjust_offset_down(ec, &fl_start,
+ _gf_true);
+ fl_size = user_size + head;
+ ec_adjust_size_up(ec, &fl_size, _gf_true);
+ }
+ }
ec_lock_prepare_fd(fop, fop->fd,
EC_UPDATE_DATA | EC_UPDATE_META |
- EC_QUERY_INFO);
+ EC_QUERY_INFO, fl_start, fl_size);
ec_lock(fop);
return EC_STATE_DISPATCH;
@@ -1717,23 +1752,28 @@ int32_t ec_manager_writev(ec_fop_data_t *fop, int32_t state)
cbk->count);
/* This shouldn't fail because we have the inode locked. */
- GF_ASSERT(ec_get_inode_size(fop, fop->fd->inode,
- &cbk->iatt[0].ia_size));
- cbk->iatt[1].ia_size = cbk->iatt[0].ia_size;
- size = fop->offset + fop->head + fop->user_size;
- if (size > cbk->iatt[0].ia_size) {
- /* Only update inode size if this is a top level fop.
- * Otherwise this is an internal write and the top
- * level fop should take care of the real inode size.
- */
- if (fop->parent == NULL) {
- /* This shouldn't fail because we have the inode
- * locked. */
- GF_ASSERT(ec_set_inode_size(fop, fop->fd->inode,
- size));
- }
- cbk->iatt[1].ia_size = size;
+ LOCK(&fop->fd->inode->lock);
+ {
+ GF_ASSERT(__ec_get_inode_size(fop, fop->fd->inode,
+ &cbk->iatt[0].ia_size));
+ cbk->iatt[1].ia_size = cbk->iatt[0].ia_size;
+ size = fop->offset + fop->head + fop->user_size;
+ if (size > cbk->iatt[0].ia_size) {
+ /* Only update inode size if this is a top level fop.
+ * Otherwise this is an internal write and the top
+ * level fop should take care of the real inode size.
+ */
+ if (fop->parent == NULL) {
+ /* This shouldn't fail because we have the inode
+ * locked. */
+ GF_ASSERT(__ec_set_inode_size(fop,
+ fop->fd->inode, size));
+ }
+ cbk->iatt[1].ia_size = size;
+ }
}
+ UNLOCK(&fop->fd->inode->lock);
+
if (fop->error == 0) {
cbk->op_ret *= ec->fragments;
if (cbk->op_ret < fop->head) {
diff --git a/xlators/cluster/ec/src/ec-types.h b/xlators/cluster/ec/src/ec-types.h
index 5601f96..354b4ed 100644
--- a/xlators/cluster/ec/src/ec-types.h
+++ b/xlators/cluster/ec/src/ec-types.h
@@ -211,8 +211,8 @@ struct _ec_lock {
struct list_head owners;
/* List of fops waiting to be an owner of the lock. Fops are added to this
- * list when the current owner has an incompatible access (shared vs
- * exclusive) or the lock is not acquired yet. */
+ * list when the current owner has an incompatible access (conflicting lock)
+ * or the lock is not acquired yet. */
struct list_head waiting;
/* List of fops that will wait until the next unlock/lock cycle. This
@@ -221,7 +221,6 @@ struct _ec_lock {
* after the lock is reacquired. */
struct list_head frozen;
- int32_t exclusive;
uintptr_t mask;
uintptr_t good_mask;
uintptr_t healing;
@@ -251,6 +250,8 @@ struct _ec_lock_link {
loc_t *base;
uint64_t size;
uint32_t waiting_flags;
+ off_t fl_start;
+ off_t fl_end;
};
struct _ec_fop_data {
@@ -564,6 +565,7 @@ struct _ec {
gf_boolean_t shutdown;
gf_boolean_t eager_lock;
gf_boolean_t optimistic_changelog;
+ gf_boolean_t parallel_writes;
uint32_t background_heals;
uint32_t heal_wait_qlen;
uint32_t self_heal_window_size; /* max size of read/writes */
diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c
index c32f4ef..856d60c 100644
--- a/xlators/cluster/ec/src/ec.c
+++ b/xlators/cluster/ec/src/ec.c
@@ -295,6 +295,8 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("optimistic-change-log", ec->optimistic_changelog,
options, bool, failed);
+ GF_OPTION_RECONF ("parallel-writes", ec->parallel_writes,
+ options, bool, failed);
ret = 0;
if (ec_assign_read_policy (ec, read_policy)) {
ret = -1;
@@ -665,6 +667,7 @@ init (xlator_t *this)
GF_OPTION_INIT ("shd-max-threads", ec->shd.max_threads, uint32, failed);
GF_OPTION_INIT ("shd-wait-qlength", ec->shd.wait_qlength, uint32, failed);
GF_OPTION_INIT ("optimistic-change-log", ec->optimistic_changelog, bool, failed);
+ GF_OPTION_INIT ("parallel-writes", ec->parallel_writes, bool, failed);
this->itable = inode_table_new (EC_SHD_INODE_LRU_LIMIT, this);
if (!this->itable)
@@ -1466,28 +1469,34 @@ struct volume_options options[] =
"galois field computations."
},
{ .key = {"self-heal-window-size"},
- .type = GF_OPTION_TYPE_INT,
- .min = 1,
- .max = 1024,
- .default_value = "1",
- .description = "Maximum number blocks(128KB) per file for which "
- "self-heal process would be applied simultaneously."
+ .type = GF_OPTION_TYPE_INT,
+ .min = 1,
+ .max = 1024,
+ .default_value = "1",
+ .description = "Maximum number blocks(128KB) per file for which "
+ "self-heal process would be applied simultaneously."
},
- { .key = {"optimistic-change-log"},
- .type = GF_OPTION_TYPE_BOOL,
- .default_value = "on",
- .description = "Set/Unset dirty flag for every update fop at the start"
- "of the fop. If OFF, this option impacts performance of"
- "entry operations or metadata operations as it will"
- "set dirty flag at the start and unset it at the end of"
- "ALL update fop. If ON and all the bricks are good,"
- "dirty flag will be set at the start only for file fops"
- "For metadata and entry fops dirty flag will not be set"
- "at the start, if all the bricks are good. This does"
- "not impact performance for metadata operations and"
- "entry operation but has a very small window to miss"
- "marking entry as dirty in case it is required to be"
- "healed"
+ { .key = {"optimistic-change-log"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "on",
+ .description = "Set/Unset dirty flag for every update fop at the start"
+ "of the fop. If OFF, this option impacts performance of"
+ "entry operations or metadata operations as it will"
+ "set dirty flag at the start and unset it at the end of"
+ "ALL update fop. If ON and all the bricks are good,"
+ "dirty flag will be set at the start only for file fops"
+ "For metadata and entry fops dirty flag will not be set"
+ "at the start, if all the bricks are good. This does"
+ "not impact performance for metadata operations and"
+ "entry operation but has a very small window to miss"
+ "marking entry as dirty in case it is required to be"
+ "healed"
+ },
+ { .key = {"parallel-writes"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "on",
+ .description = "This controls if writes can be wound in parallel as long"
+ "as it doesn't modify same stripes"
},
{ .key = {NULL} }
};
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 7fe76e5..b15a5af 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -3510,6 +3510,12 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = GD_OP_VERSION_3_12_0,
.validate_fn = validate_boolean
},
+ { .key = "disperse.parallel-writes",
+ .voltype = "cluster/disperse",
+ .type = NO_DOC,
+ .op_version = GD_OP_VERSION_3_13_0,
+ .flags = OPT_FLAG_CLIENT_OPT
+ },
{ .key = NULL
}
};
--
1.8.3.1

View File

@ -1,607 +0,0 @@
From dd892d811ec66841b274f5ed6e22040cbdc003b0 Mon Sep 17 00:00:00 2001
From: karthik-us <ksubrahm@redhat.com>
Date: Mon, 20 Nov 2017 11:46:59 +0530
Subject: [PATCH 080/128] heal: New feature heal info summary to list the
status of brick and count of entries to be healed
Command output:
Brick 192.168.2.8:/brick/1
Status: Connected
Total Number of entries: 363
Number of entries in heal pending: 362
Number of entries in split-brain: 0
Number of entries possibly healing: 1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cliOutput>
<healInfo>
<bricks>
<brick hostUuid="9105dd4b-eca8-4fdb-85b2-b81cdf77eda3">
<name>192.168.2.8:/brick/1</name>
<status>Connected</status>
<totalNumberOfEntries>363</numberOfEntries>
<numberOfEntriesInHealPending>362</numberOfEntriesInHealPending>
<numberOfEntriesInSplitBrain>0</numberOfEntriesInSplitBrain>
<numberOfEntriesPossiblyHealing>1</numberOfEntriesPossiblyHealing>
</brick>
</bricks>
</healInfo>
<opRet>0</opRet>
<opErrno>0</opErrno>
<opErrstr/>
</cliOutput>
> Change-Id: I40cb6f77a14131c9e41b292f4901b41a228863d7
> BUG: 1261463
> Signed-off-by: Mohamed Ashiq Liyazudeen <mliyazud@redhat.com>
> Reviewed-on: https://review.gluster.org/12154
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> Tested-by: Karthik U S <ksubrahm@redhat.com>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Ravishankar N <ravishankar@redhat.com>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: I40cb6f77a14131c9e41b292f4901b41a228863d7
BUG: 1286820
Signed-off-by: karthik-us <ksubrahm@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123640
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Ravishankar Narayanankutty <ravishankar@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
cli/src/cli-cmd-parser.c | 5 +
cli/src/cli-cmd-volume.c | 9 +-
cli/src/cli-rpc-ops.c | 3 +-
heal/src/glfs-heal.c | 218 ++++++++++++++++++++----
rpc/rpc-lib/src/protocol-common.h | 1 +
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 1 +
6 files changed, 205 insertions(+), 32 deletions(-)
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index c95b262..764f420 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -3952,6 +3952,11 @@ cli_cmd_volume_heal_options_parse (const char **words, int wordcount,
GF_SHD_OP_SPLIT_BRAIN_FILES);
goto done;
}
+ if (!strcmp (words[4], "summary")) {
+ ret = dict_set_int32 (dict, "heal-op",
+ GF_SHD_OP_HEAL_SUMMARY);
+ goto done;
+ }
}
if (!strcmp (words[3], "statistics")) {
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index a1e5c51..7110145 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -2803,7 +2803,8 @@ cli_print_brick_status (cli_volume_status_t *status)
(op == GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK) || \
(op == GF_SHD_OP_INDEX_SUMMARY) || \
(op == GF_SHD_OP_SPLIT_BRAIN_FILES) || \
- (op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE))
+ (op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE) || \
+ (op == GF_SHD_OP_HEAL_SUMMARY))
int
cli_launch_glfs_heal (int heal_op, dict_t *options)
@@ -2856,6 +2857,12 @@ cli_launch_glfs_heal (int heal_op, dict_t *options)
case GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE:
runner_add_args (&runner, "granular-entry-heal-op", NULL);
break;
+ case GF_SHD_OP_HEAL_SUMMARY:
+ runner_add_args (&runner, "info-summary", NULL);
+ if (global_state->mode & GLUSTER_MODE_XML) {
+ runner_add_args (&runner, "xml", NULL);
+ }
+ break;
default:
ret = -1;
}
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 67e29a0..b91400b 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -9112,11 +9112,12 @@ gf_cli_heal_volume_cbk (struct rpc_req *req, struct iovec *iov,
case GF_SHD_OP_STATISTICS_HEAL_COUNT_PER_REPLICA:
heal_op_str = "count of entries to be healed per replica";
break;
- /* The below 3 cases are never hit; they're coded only to make
+ /* The below 4 cases are never hit; they're coded only to make
* compiler warnings go away.*/
case GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE:
case GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME:
case GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK:
+ case GF_SHD_OP_HEAL_SUMMARY:
break;
case GF_SHD_OP_INVALID:
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
index 27115f3..27a9624 100644
--- a/heal/src/glfs-heal.c
+++ b/heal/src/glfs-heal.c
@@ -40,18 +40,25 @@ xmlDocPtr glfsh_doc = NULL;
ret = 0; \
} while (0) \
-typedef int (*print_status) (dict_t *, char *, uuid_t, uint64_t *,
+typedef struct num_entries {
+ uint64_t num_entries;
+ uint64_t pending_entries;
+ uint64_t spb_entries;
+ uint64_t possibly_healing_entries;
+} num_entries_t;
+
+typedef int (*print_status) (dict_t *, char *, uuid_t, num_entries_t *,
gf_boolean_t flag);
int glfsh_heal_splitbrain_file (glfs_t *fs, xlator_t *top_subvol,
loc_t *rootloc, char *file, dict_t *xattr_req);
-
typedef struct glfs_info {
int (*init)(void);
int (*print_brick_from_xl)(xlator_t *xl, loc_t *rootloc);
int (*print_heal_op_status)(int ret, uint64_t num_entries,
char *fmt_str);
+ int (*print_heal_op_summary)(int ret, num_entries_t *num_entries);
void (*print_heal_status)(char *path, uuid_t gfid, char *status);
void (*print_spb_status)(char *path, uuid_t gfid, char *status);
int (*end) (int op_ret, char *op_errstr);
@@ -64,7 +71,7 @@ int32_t is_xml;
#define USAGE_STR "Usage: %s <VOLNAME> [bigger-file <FILE> | "\
"latest-mtime <FILE> | "\
"source-brick <HOSTNAME:BRICKNAME> [<FILE>] | "\
- "split-brain-info]\n"
+ "split-brain-info | info-summary]\n"
typedef enum {
GLFSH_MODE_CONTINUE_ON_ERROR = 1,
@@ -259,6 +266,54 @@ out:
return ret;
}
+int
+glfsh_print_xml_heal_op_summary (int ret, num_entries_t *num_entries)
+{
+ if (ret < 0 && num_entries == 0) {
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"status",
+ "%s", strerror (-ret));
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"totalNumberOfEntries", "-");
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"numberOfEntriesInHealPending", "-");
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"numberOfEntriesInSplitBrain", "-");
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"numberOfEntriesPossiblyHealing",
+ "-");
+ goto out;
+ } else if (ret == 0) {
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"status",
+ "%s", "Connected");
+ }
+
+ if (ret < 0) {
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"status", "Failed to process entries"
+ " completely. "
+ "(%s)totalNumberOfEntries%"PRIu64"",
+ strerror (-ret), num_entries->num_entries);
+ } else {
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"totalNumberOfEntries",
+ "%"PRIu64"", num_entries->num_entries);
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"numberOfEntriesInHealPending",
+ "%"PRIu64"", num_entries->pending_entries);
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"numberOfEntriesInSplitBrain",
+ "%"PRIu64"", num_entries->spb_entries);
+ xmlTextWriterWriteFormatElement (glfsh_writer,
+ (xmlChar *)"numberOfEntriesPossiblyHealing",
+ "%"PRIu64"",
+ num_entries->possibly_healing_entries);
+ }
+out:
+ return xmlTextWriterEndElement (glfsh_writer);
+}
+
void
glfsh_print_xml_file_status (char *path, uuid_t gfid, char *status)
{
@@ -338,6 +393,39 @@ glfsh_no_print_hr_heal_op_status (int ret, uint64_t num_entries, char *fmt_str)
}
int
+glfsh_print_hr_heal_op_summary (int ret, num_entries_t *num_entries)
+{
+ if (ret < 0 && num_entries->num_entries == 0) {
+ printf ("Status: %s\n", strerror (-ret));
+ printf ("Total Number of entries: -\n");
+ printf ("Number of entries in heal pending: -\n");
+ printf ("Number of entries in split-brain: -\n");
+ printf ("Number of entries possibly healing: -\n");
+ goto out;
+ } else if (ret == 0) {
+ printf ("Status: Connected\n");
+ }
+
+ if (ret < 0) {
+ printf ("Status: Failed to process entries completely. "
+ "(%s)\nTotal Number of entries: %"PRIu64"\n",
+ strerror (-ret), num_entries->num_entries);
+ } else {
+ printf ("Total Number of entries: %"PRIu64"\n",
+ num_entries->num_entries);
+ printf ("Number of entries in heal pending: %"PRIu64"\n",
+ num_entries->pending_entries);
+ printf ("Number of entries in split-brain: %"PRIu64"\n",
+ num_entries->spb_entries);
+ printf ("Number of entries possibly healing: %"PRIu64"\n",
+ num_entries->possibly_healing_entries);
+ }
+out:
+ printf ("\n");
+ return 0;
+}
+
+int
glfsh_print_hr_heal_op_status (int ret, uint64_t num_entries, char *fmt_str)
{
if (ret < 0 && num_entries == 0) {
@@ -364,6 +452,13 @@ out:
}
int
+glfsh_print_info_summary (int ret, num_entries_t *num_entries)
+{
+ return glfsh_output->print_heal_op_summary (ret, num_entries);
+
+}
+
+int
glfsh_print_heal_op_status (int ret, uint64_t num_entries,
gf_xl_afr_op_t heal_op)
{
@@ -430,7 +525,8 @@ _get_ancestor (xlator_t *xl, gf_xl_afr_op_t heal_op)
NULL};
char **ancestors = NULL;
- if (heal_op == GF_SHD_OP_INDEX_SUMMARY)
+ if (heal_op == GF_SHD_OP_INDEX_SUMMARY ||
+ heal_op == GF_SHD_OP_HEAL_SUMMARY)
ancestors = heal_xls;
else
ancestors = replica_xl;
@@ -465,8 +561,35 @@ glfsh_index_purge (xlator_t *subvol, inode_t *inode, char *name)
}
int
+glfsh_print_summary_status (dict_t *dict, char *path, uuid_t gfid,
+ num_entries_t *num_entries, gf_boolean_t flag)
+{
+ int ret = 0;
+ char *value = NULL;
+
+ ret = dict_get_str (dict, "heal-info", &value);
+ if (ret)
+ goto out;
+
+ if ((!strcmp (value, "heal")) || (!strcmp (value, "heal-pending"))) {
+ (num_entries->pending_entries)++;
+ } else if ((!strcmp (value, "split-brain")) ||
+ (!strcmp (value, "split-brain-pending"))) {
+ (num_entries->spb_entries)++;
+ } else if ((!strcmp (value, "possibly-healing-pending")) ||
+ (!strcmp (value, "possibly-healing"))) {
+ (num_entries->possibly_healing_entries)++;
+ } else {
+ goto out;
+ }
+ (num_entries->num_entries)++;
+out:
+ return ret;
+}
+
+int
glfsh_print_spb_status (dict_t *dict, char *path, uuid_t gfid,
- uint64_t *num_entries, gf_boolean_t flag)
+ num_entries_t *num_entries, gf_boolean_t flag)
{
int ret = 0;
gf_boolean_t pending = _gf_false;
@@ -492,7 +615,7 @@ glfsh_print_spb_status (dict_t *dict, char *path, uuid_t gfid,
*/
if (split_b) {
if (!flag || (flag && !pending)) {
- (*num_entries)++;
+ (num_entries->num_entries)++;
glfsh_output->print_spb_status (path ? path :
uuid_utoa_r (gfid, gfid_str),
gfid, NULL);
@@ -503,7 +626,8 @@ glfsh_print_spb_status (dict_t *dict, char *path, uuid_t gfid,
int
glfsh_print_heal_status (dict_t *dict, char *path, uuid_t gfid,
- uint64_t *num_entries, gf_boolean_t ignore_dirty)
+ num_entries_t *num_entries,
+ gf_boolean_t ignore_dirty)
{
int ret = 0;
gf_boolean_t pending = _gf_false;
@@ -562,7 +686,7 @@ out:
if (ret == -1)
status = NULL;
- (*num_entries)++;
+ (num_entries->num_entries)++;
glfsh_output->print_heal_status (path ? path :
uuid_utoa_r (gfid, gfid_str),
gfid,
@@ -574,7 +698,7 @@ out:
int
glfsh_heal_status_boolean (dict_t *dict, char *path, uuid_t gfid,
- uint64_t *num_entries, gf_boolean_t ignore_dirty)
+ num_entries_t *num_entries, gf_boolean_t ignore_dirty)
{
int ret = 0;
char *value = NULL;
@@ -589,7 +713,7 @@ glfsh_heal_status_boolean (dict_t *dict, char *path, uuid_t gfid,
static int
glfsh_heal_entries (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
gf_dirent_t *entries, uint64_t *offset,
- uint64_t *num_entries, dict_t *xattr_req) {
+ num_entries_t *num_entries, dict_t *xattr_req) {
gf_dirent_t *entry = NULL;
gf_dirent_t *tmp = NULL;
@@ -607,7 +731,7 @@ glfsh_heal_entries (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
xattr_req);
if (ret)
continue;
- (*num_entries)++;
+ (num_entries->num_entries)++;
}
return ret;
@@ -615,7 +739,7 @@ glfsh_heal_entries (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
static int
glfsh_process_entries (xlator_t *xl, fd_t *fd, gf_dirent_t *entries,
- uint64_t *offset, uint64_t *num_entries,
+ uint64_t *offset, num_entries_t *num_entries,
print_status glfsh_print_status,
gf_boolean_t ignore_dirty, glfsh_fail_mode_t mode)
{
@@ -687,7 +811,7 @@ out:
static int
glfsh_crawl_directory (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
xlator_t *readdir_xl, fd_t *fd, loc_t *loc,
- dict_t *xattr_req, uint64_t *num_entries,
+ dict_t *xattr_req, num_entries_t *num_entries,
gf_boolean_t ignore)
{
int ret = 0;
@@ -732,6 +856,14 @@ glfsh_crawl_directory (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
ignore, mode);
if (ret < 0)
goto out;
+ } else if (heal_op == GF_SHD_OP_HEAL_SUMMARY) {
+ ret = glfsh_process_entries (readdir_xl, fd,
+ &entries, &offset,
+ num_entries,
+ glfsh_print_summary_status,
+ ignore, mode);
+ if (ret < 0)
+ goto out;
} else if (heal_op == GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK) {
ret = glfsh_heal_entries (fs, top_subvol, rootloc,
&entries, &offset,
@@ -786,7 +918,7 @@ int
glfsh_print_pending_heals_type (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
xlator_t *xl, gf_xl_afr_op_t heal_op,
dict_t *xattr_req, char *vgfid,
- uint64_t *num_entries)
+ num_entries_t *num_entries)
{
int ret = 0;
loc_t dirloc = {0};
@@ -827,7 +959,8 @@ glfsh_print_pending_heals (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
is_parent_replicate)
{
int ret = 0;
- uint64_t count = 0, total = 0;
+ num_entries_t num_entries = {0, };
+ num_entries_t total = {0, };
dict_t *xattr_req = NULL;
@@ -851,13 +984,20 @@ glfsh_print_pending_heals (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
ret = glfsh_print_pending_heals_type (fs, top_subvol, rootloc, xl,
heal_op, xattr_req,
- GF_XATTROP_INDEX_GFID, &count);
+ GF_XATTROP_INDEX_GFID,
+ &num_entries);
if (ret < 0 && heal_op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE)
goto out;
- total += count;
- count = 0;
+ total.num_entries += num_entries.num_entries;
+ total.pending_entries += num_entries.pending_entries;
+ total.spb_entries += num_entries.spb_entries;
+ total.possibly_healing_entries += num_entries.possibly_healing_entries;
+ num_entries.num_entries = 0;
+ num_entries.pending_entries = 0;
+ num_entries.spb_entries = 0;
+ num_entries.possibly_healing_entries = 0;
if (ret == -ENOTCONN)
goto out;
@@ -866,13 +1006,20 @@ glfsh_print_pending_heals (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
rootloc, xl,
heal_op, xattr_req,
GF_XATTROP_DIRTY_GFID,
- &count);
- total += count;
+ &num_entries);
+ total.num_entries += num_entries.num_entries;
+ total.pending_entries += num_entries.pending_entries;
+ total.spb_entries += num_entries.spb_entries;
+ total.possibly_healing_entries += num_entries.possibly_healing_entries;
}
out:
if (xattr_req)
dict_unref (xattr_req);
- glfsh_print_heal_op_status (ret, total, heal_op);
+ if (heal_op == GF_SHD_OP_HEAL_SUMMARY) {
+ glfsh_print_info_summary (ret, &total);
+ } else {
+ glfsh_print_heal_op_status (ret, total.num_entries, heal_op);
+ }
return ret;
}
@@ -1193,7 +1340,7 @@ int
glfsh_heal_from_brick_type (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
char *hostname, char *brickpath, xlator_t *client,
dict_t *xattr_req, char *vgfid,
- uint64_t *num_entries)
+ num_entries_t *num_entries)
{
fd_t *fd = NULL;
loc_t dirloc = {0};
@@ -1229,9 +1376,10 @@ glfsh_heal_from_brick (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
char *hostname, char *brickpath, char *file)
{
int ret = -1;
- uint64_t count = 0, total = 0;
dict_t *xattr_req = NULL;
xlator_t *client = NULL;
+ num_entries_t num_entries = {0, };
+ num_entries_t total = {0, };
xattr_req = dict_new();
if (!xattr_req)
@@ -1258,9 +1406,9 @@ glfsh_heal_from_brick (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
hostname, brickpath,
client, xattr_req,
GF_XATTROP_INDEX_GFID,
- &count);
- total += count;
- count = 0;
+ &num_entries);
+ total.num_entries += num_entries.num_entries;
+ num_entries.num_entries = 0;
if (ret == -ENOTCONN)
goto out;
@@ -1268,8 +1416,8 @@ glfsh_heal_from_brick (glfs_t *fs, xlator_t *top_subvol, loc_t *rootloc,
hostname, brickpath,
client, xattr_req,
GF_XATTROP_DIRTY_GFID,
- &count);
- total += count;
+ &num_entries);
+ total.num_entries += num_entries.num_entries;
if (ret < 0)
goto out;
}
@@ -1277,7 +1425,7 @@ out:
if (xattr_req)
dict_unref (xattr_req);
if (!file)
- glfsh_print_heal_op_status (ret, total,
+ glfsh_print_heal_op_status (ret, total.num_entries,
GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK);
return ret;
@@ -1326,6 +1474,7 @@ glfsh_info_t glfsh_human_readable = {
.init = glfsh_init,
.print_brick_from_xl = glfsh_print_brick_from_xl,
.print_heal_op_status = glfsh_print_hr_heal_op_status,
+ .print_heal_op_summary = glfsh_print_hr_heal_op_summary,
.print_heal_status = glfsh_print_hr_heal_status,
.print_spb_status = glfsh_print_hr_spb_status,
.end = glfsh_end
@@ -1345,6 +1494,7 @@ glfsh_info_t glfsh_xml_output = {
.init = glfsh_xml_init,
.print_brick_from_xl = glfsh_print_xml_brick_from_xl,
.print_heal_op_status = glfsh_print_xml_heal_op_status,
+ .print_heal_op_summary = glfsh_print_xml_heal_op_summary,
.print_heal_status = glfsh_print_xml_file_status,
.print_spb_status = glfsh_print_xml_file_status,
.end = glfsh_xml_end
@@ -1385,6 +1535,8 @@ main (int argc, char **argv)
is_xml = 1;
} else if (!strcmp (argv[2], "granular-entry-heal-op")) {
heal_op = GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE;
+ } else if (!strcmp (argv[2], "info-summary")) {
+ heal_op = GF_SHD_OP_HEAL_SUMMARY;
} else {
printf (USAGE_STR, argv[0]);
ret = -1;
@@ -1396,6 +1548,10 @@ main (int argc, char **argv)
&& (!strcmp (argv[3], "xml"))) {
heal_op = GF_SHD_OP_SPLIT_BRAIN_FILES;
is_xml = 1;
+ } else if ((!strcmp (argv[2], "info-summary"))
+ && (!strcmp (argv[3], "xml"))) {
+ heal_op = GF_SHD_OP_HEAL_SUMMARY;
+ is_xml = 1;
} else if (!strcmp (argv[2], "bigger-file")) {
heal_op = GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE;
file = argv[3];
@@ -1517,7 +1673,8 @@ main (int argc, char **argv)
if (ret < 0) {
ret = -EINVAL;
gf_asprintf (&op_errstr, "Volume %s is not of type %s", volname,
- (heal_op == GF_SHD_OP_INDEX_SUMMARY) ?
+ (heal_op == GF_SHD_OP_INDEX_SUMMARY ||
+ heal_op == GF_SHD_OP_HEAL_SUMMARY) ?
"replicate/disperse":"replicate");
goto out;
}
@@ -1528,6 +1685,7 @@ main (int argc, char **argv)
case GF_SHD_OP_INDEX_SUMMARY:
case GF_SHD_OP_SPLIT_BRAIN_FILES:
case GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE:
+ case GF_SHD_OP_HEAL_SUMMARY:
ret = glfsh_gather_heal_info (fs, top_subvol, &rootloc,
heal_op);
break;
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index 510817c..80e1f6b 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -265,6 +265,7 @@ typedef enum {
GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME,
GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE,
GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE,
+ GF_SHD_OP_HEAL_SUMMARY,
} gf_xl_afr_op_t ;
struct gf_gsync_detailed_status_ {
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 725d194..222d5f4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1867,6 +1867,7 @@ glusterd_handle_heal_cmd (xlator_t *this, glusterd_volinfo_t *volinfo,
case GF_SHD_OP_HEAL_DISABLE:/* This op should be handled in volume-set*/
case GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE: /* This op should be handled in volume-set */
case GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE: /* This op should be handled in volume-set */
+ case GF_SHD_OP_HEAL_SUMMARY:/*glfsheal cmd*/
case GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE:/*glfsheal cmd*/
case GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME:/*glfsheal cmd*/
case GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK:/*glfsheal cmd*/
--
1.8.3.1

View File

@ -1,59 +0,0 @@
From 98bd66d16730964b2c6d14d5430e23dd16138193 Mon Sep 17 00:00:00 2001
From: N Balachandran <nbalacha@redhat.com>
Date: Wed, 22 Nov 2017 08:47:47 +0530
Subject: [PATCH 081/128] cluster/dht: Don't set ACLs on linkto file
The trusted.SGI_ACL_FILE appears to set posix
ACLs on the linkto file that is a target of
file migration. This can mess up file permissions
and cause linkto identification to fail.
Now we remove all ACL xattrs from the results of
the listxattr call on the source before setting them
on the target.
> BUG: 1515042
> https://review.gluster.org/#/c/18807/
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
Change-Id: I56802dbaed783a16e3fb90f59f4ce849f8a4a9b4
BUG: 1515051
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123870
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/cluster/dht/src/dht-rebalance.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 941e982..ae367d7 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -163,6 +163,14 @@ dht_send_rebalance_event (xlator_t *this, int cmd, gf_defrag_status_t status)
}
+static void
+dht_strip_out_acls (dict_t *dict)
+{
+ if (dict) {
+ dict_del (dict, "trusted.SGI_ACL_FILE");
+ dict_del (dict, "POSIX_ACL_ACCESS_XATTR");
+ }
+}
@@ -1624,6 +1632,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
loc->path, from->name);
}
+ /* Copying posix acls to the linkto file messes up the permissions*/
+ dht_strip_out_acls (xattr);
+
/* create the destination, with required modes/xattr */
ret = __dht_rebalance_create_dst_file (this, to, from, loc, &stbuf,
&dst_fd, xattr, fop_errno);
--
1.8.3.1

View File

@ -1,41 +0,0 @@
From 931b40987fa4e2d4f7ddf561fd413663129e9072 Mon Sep 17 00:00:00 2001
From: karthik-us <ksubrahm@redhat.com>
Date: Mon, 27 Nov 2017 11:54:25 +0530
Subject: [PATCH 082/128] cluster/afr: Print heal info summary output in stream
fashion
Problem:
The heal info summary was printing the output at the end after
crawling for pending heal entries completes on all the bricks.
Fix:
Printing the output immediately after the crawl on individual brick
completes, so that it won't give the impression of CLI being hung.
Upstream patch: https://review.gluster.org/#/c/18832/
Change-Id: Ieaf5718736a7ee6837bac02bd30a95836e605dab
BUG: 1419438
Signed-off-by: karthik-us <ksubrahm@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124283
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
heal/src/glfs-heal.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
index 27a9624..22c9395 100644
--- a/heal/src/glfs-heal.c
+++ b/heal/src/glfs-heal.c
@@ -422,6 +422,7 @@ glfsh_print_hr_heal_op_summary (int ret, num_entries_t *num_entries)
}
out:
printf ("\n");
+ fflush (stdout);
return 0;
}
--
1.8.3.1

View File

@ -1,55 +0,0 @@
From 9c31bcd6c4234b6a9e4e04410caf98d2cd3d4946 Mon Sep 17 00:00:00 2001
From: karthik-us <ksubrahm@redhat.com>
Date: Fri, 17 Nov 2017 18:23:23 +0530
Subject: [PATCH 083/128] cluster/afr: Print heal info split-brain output in
stream fashion
Problem:
When we trigger the heal info split-brain command the o/p is not
streamed as it is received, but dumped at the end for all the bricks
together. This gives a perception that the command is hung.
Fix:
When we get a split brain entry while crawling throught the pending
heal entries, flush that immediately so that it prints the output
in a stream fashion and doesn't look like the cli is hung.
Upstream patch: https://review.gluster.org/#/c/18570/
> Change-Id: I7547e86b83202d66616749b8b31d4d0dff0abf07
> BUG: 1506104
> Signed-off-by: karthik-us <ksubrahm@redhat.com>
Change-Id: I7547e86b83202d66616749b8b31d4d0dff0abf07
BUG: 1419438
Signed-off-by: karthik-us <ksubrahm@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123563
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
heal/src/glfs-heal.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
index 22c9395..532b6f9 100644
--- a/heal/src/glfs-heal.c
+++ b/heal/src/glfs-heal.c
@@ -120,6 +120,7 @@ void
glfsh_print_hr_spb_status (char *path, uuid_t gfid, char *status)
{
printf ("%s\n", path);
+ fflush (stdout);
return;
}
@@ -133,6 +134,7 @@ void
glfsh_print_hr_heal_status (char *path, uuid_t gfid, char *status)
{
printf ("%s%s\n", path, status);
+ fflush (stdout);
}
#if (HAVE_LIB_XML)
--
1.8.3.1

View File

@ -1,237 +0,0 @@
From 5579f616c2c21a2a2cd2ef70b58149df85550db7 Mon Sep 17 00:00:00 2001
From: karthik-us <ksubrahm@redhat.com>
Date: Mon, 27 Nov 2017 12:51:16 +0530
Subject: [PATCH 084/128] cluster/afr: Fix for arbiter becoming source
Problem:
When eager-lock is on, and two writes happen in parallel on a FD
we were observing the following behaviour:
- First write fails on one data brick
- Since the post-op is not yet happened, the inode refresh will get
both the data bricks as readable and set it in the inode context
- In flight split brain check see both the data bricks as readable
and allows the second write
- Second write fails on the other data brick
- Now the post-op happens and marks both the data bricks as bad and
arbiter will become source for healing
Fix:
Adding one more variable called write_suvol in inode context and it
will have the in memory representation of the writable subvols. Inode
refresh will not update this value and its lifetime is pre-op through
unlock in the afr transaction. Initially the pre-op will set this
value same as read_subvol in inode context and then in the in flight
split brain check we will use this value instead of read_subvol.
After all the checks we will update the value of this and set the
read_subvol same as this to avoid having incorrect value in that.
Upstream patch: https://review.gluster.org/#/c/18049/
> Change-Id: I2ef6904524ab91af861d59690974bbc529ab1af3
> BUG: 1482064
> Signed-off-by: karthik-us <ksubrahm@redhat.com>
Change-Id: I91cd21e378a7ae3757c2209fcb91a613d73e09ee
BUG: 1401969
Signed-off-by: karthik-us <ksubrahm@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124292
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/cluster/afr/src/afr-common.c | 76 ++++++++++++++++++++++++++++++-
xlators/cluster/afr/src/afr-lk-common.c | 18 ++++++--
xlators/cluster/afr/src/afr-transaction.c | 4 ++
xlators/cluster/afr/src/afr.h | 10 ++++
4 files changed, 102 insertions(+), 6 deletions(-)
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 9c96056..a8ba5a0 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -149,6 +149,7 @@ __afr_inode_ctx_get (xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx)
}
tmp_ctx->spb_choice = -1;
tmp_ctx->read_subvol = 0;
+ tmp_ctx->write_subvol = 0;
} else {
tmp_ctx = (afr_inode_ctx_t *) ctx_int;
}
@@ -216,7 +217,7 @@ __afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local,
if (ret < 0)
return ret;
- val = ctx->read_subvol;
+ val = ctx->write_subvol;
metadatamap_old = metadatamap = (val & 0x000000000000ffff);
datamap_old = datamap = (val & 0x00000000ffff0000) >> 16;
@@ -276,6 +277,7 @@ __afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local,
(((uint64_t) datamap) << 16) |
(((uint64_t) event) << 32);
+ ctx->write_subvol = val;
ctx->read_subvol = val;
return ret;
@@ -6421,3 +6423,75 @@ afr_serialize_xattrs_with_delimiter (call_frame_t *frame, xlator_t *this,
out:
return ret;
}
+
+int
+afr_write_subvol_set (call_frame_t *frame, xlator_t *this)
+{
+ afr_local_t *local = NULL;
+ afr_inode_ctx_t *ctx = NULL;
+ uint64_t val = 0;
+ uint64_t val1 = 0;
+ int ret = -1;
+
+ local = frame->local;
+ LOCK(&local->inode->lock);
+ {
+ ret = __afr_inode_ctx_get (this, local->inode, &ctx);
+ if (ret < 0) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ AFR_MSG_DICT_GET_FAILED,
+ "ERROR GETTING INODE CTX");
+ UNLOCK(&local->inode->lock);
+ return ret;
+ }
+
+ val = ctx->write_subvol;
+ /*
+ * We need to set the value of write_subvol to read_subvol in 2
+ * cases:
+ * 1. Initially when the value is 0. i.e., it's the first lock
+ * request.
+ * 2. If it's a metadata transaction. If metadata transactions
+ * comes in between data transactions and we have a brick
+ * disconnect, the next metadata transaction won't get the
+ * latest value of readables, since we do resetting of
+ * write_subvol in unlock code path only if it's a data
+ * transaction. To handle those scenarios we need to set the
+ * value of write_subvol to read_subvol in case of metadata
+ * transactions.
+ */
+ if (val == 0 ||
+ local->transaction.type == AFR_METADATA_TRANSACTION) {
+ val1 = ctx->read_subvol;
+ ctx->write_subvol = val1;
+ }
+ }
+ UNLOCK (&local->inode->lock);
+
+ return 0;
+}
+
+int
+afr_write_subvol_reset (call_frame_t *frame, xlator_t *this)
+{
+ afr_local_t *local = NULL;
+ afr_inode_ctx_t *ctx = NULL;
+ int ret = -1;
+
+ local = frame->local;
+ LOCK(&local->inode->lock);
+ {
+ ret = __afr_inode_ctx_get (this, local->inode, &ctx);
+ if (ret < 0) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ AFR_MSG_DICT_GET_FAILED,
+ "ERROR GETTING INODE CTX");
+ UNLOCK(&local->inode->lock);
+ return ret;
+ }
+ ctx->write_subvol = 0;
+ }
+ UNLOCK(&local->inode->lock);
+
+ return 0;
+}
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
index 1f2a117..c17f60f 100644
--- a/xlators/cluster/afr/src/afr-lk-common.c
+++ b/xlators/cluster/afr/src/afr-lk-common.c
@@ -613,12 +613,16 @@ static int32_t
afr_unlock_common_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata)
{
- afr_local_t *local = NULL;
- afr_internal_lock_t *int_lock = NULL;
- int call_count = 0;
+ afr_local_t *local = NULL;
+ afr_internal_lock_t *int_lock = NULL;
+ afr_fd_ctx_t *fd_ctx = NULL;
+ afr_private_t *priv = NULL;
+ int call_count = 0;
+ int ret = 0;
local = frame->local;
int_lock = &local->internal_lock;
+ priv = this->private;
LOCK (&frame->lock);
{
@@ -629,11 +633,15 @@ afr_unlock_common_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (call_count == 0) {
gf_msg_trace (this->name, 0,
"All internal locks unlocked");
-
+ if (local->fd) {
+ fd_ctx = afr_fd_ctx_get (local->fd, this);
+ if (0 == AFR_COUNT (fd_ctx->lock_acquired, priv->child_count))
+ ret = afr_write_subvol_reset (frame, this);
+ }
int_lock->lock_cbk (frame, this);
}
- return 0;
+ return ret;
}
void
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 35621d9..91c4f78 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -1791,6 +1791,10 @@ afr_changelog_pre_op (call_frame_t *frame, xlator_t *this)
if (pre_nop)
goto next;
+ ret = afr_write_subvol_set (frame, this);
+ if (ret)
+ goto err;
+
if (!local->pre_op_compat) {
dict_copy (xdata_req, local->xdata_req);
goto next;
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index c4ceb66..672d053 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -837,6 +837,7 @@ typedef struct _afr_local {
typedef struct _afr_inode_ctx {
uint64_t read_subvol;
+ uint64_t write_subvol;
int spb_choice;
gf_timer_t *timer;
gf_boolean_t need_refresh;
@@ -1262,4 +1263,13 @@ int
afr_serialize_xattrs_with_delimiter (call_frame_t *frame, xlator_t *this,
char *buf, const char *default_str,
int32_t *serz_len, char delimiter);
+
+int
+__afr_inode_ctx_get (xlator_t *this, inode_t *inode, afr_inode_ctx_t **ctx);
+
+int
+afr_write_subvol_set (call_frame_t *frame, xlator_t *this);
+
+int
+afr_write_subvol_reset (call_frame_t *frame, xlator_t *this);
#endif /* __AFR_H__ */
--
1.8.3.1

View File

@ -1,625 +0,0 @@
From cbdc0b38c18583852fc9b2ca79ea5fdfa92c6ed5 Mon Sep 17 00:00:00 2001
From: Sunny Kumar <sunkumar@redhat.com>
Date: Mon, 27 Nov 2017 14:24:55 +0530
Subject: [PATCH 085/128] snapshot: Issue with other processes accessing the
mounted brick
Added code for unmount of activated snapshot brick during snapshot
deactivation process which make sense as mount point for deactivated
bricks should not exist.
Removed code for mounting newly created snapshot, as newly created
snapshots should not mount until it is activated.
Added code for mount point creation and snapshot mount during snapshot
activation.
Added validation during glusterd init for mounting only those snapshot
whose status is either STARTED or RESTORED.
During snapshot restore, mount point for stopped snap should exist as
it is required to set extended attribute.
During handshake, after getting updates from friend mount point for
activated snapshot should exist and should not for deactivated
snapshot.
While getting snap status we should show relevent information for
deactivated snapshots, after this pathch 'gluster snap status' command
will show output like-
Snap Name : snap1
Snap UUID : snap-uuid
Brick Path : server1:/run/gluster/snaps/snap-vol-name/brick
Volume Group : N/A (Deactivated Snapshot)
Brick Running : No
Brick PID : N/A
Data Percentage : N/A
LV Size : N/A
Fixes: #276
>BUG: 1482023
>Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
upstream patch : https://review.gluster.org/18047
Change-Id: I65783488e35fac43632615ce1b8ff7b8e84834dc
BUG: 1464150
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124305
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
.../bug-1322772-real-path-fix-for-snapshot.t | 1 +
...e-with-other-processes-accessing-mounted-path.t | 114 ++++++++++++++++
.../mgmt/glusterd/src/glusterd-snapshot-utils.c | 85 ++++++++++++
.../mgmt/glusterd/src/glusterd-snapshot-utils.h | 3 +
xlators/mgmt/glusterd/src/glusterd-snapshot.c | 145 ++++++++++++++++-----
xlators/mgmt/glusterd/src/glusterd-store.c | 25 ++--
xlators/mgmt/glusterd/src/glusterd-store.h | 4 +
7 files changed, 333 insertions(+), 44 deletions(-)
create mode 100644 tests/bugs/snapshot/bug-1482023-snpashot-issue-with-other-processes-accessing-mounted-path.t
diff --git a/tests/bugs/snapshot/bug-1322772-real-path-fix-for-snapshot.t b/tests/bugs/snapshot/bug-1322772-real-path-fix-for-snapshot.t
index bf625ec..488bd46 100644
--- a/tests/bugs/snapshot/bug-1322772-real-path-fix-for-snapshot.t
+++ b/tests/bugs/snapshot/bug-1322772-real-path-fix-for-snapshot.t
@@ -26,6 +26,7 @@ EXPECT 'Started' volinfo_field $V0 'Status'
TEST $CLI volume start $V1
EXPECT 'Started' volinfo_field $V1 'Status'
+TEST $CLI snapshot config activate-on-create enable
TEST $CLI snapshot create ${V0}_snap $V0 no-timestamp
TEST $CLI snapshot create ${V1}_snap $V1 no-timestamp
diff --git a/tests/bugs/snapshot/bug-1482023-snpashot-issue-with-other-processes-accessing-mounted-path.t b/tests/bugs/snapshot/bug-1482023-snpashot-issue-with-other-processes-accessing-mounted-path.t
new file mode 100644
index 0000000..c5a0088
--- /dev/null
+++ b/tests/bugs/snapshot/bug-1482023-snpashot-issue-with-other-processes-accessing-mounted-path.t
@@ -0,0 +1,114 @@
+#!/bin/bash
+
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../snapshot.rc
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../cluster.rc
+
+function create_snapshots() {
+ $CLI_1 snapshot create ${V0}_snap ${V0} no-timestamp &
+ PID_1=$!
+
+ $CLI_1 snapshot create ${V1}_snap ${V1} no-timestamp &
+ PID_2=$!
+
+ wait $PID_1 $PID_2
+}
+
+function activate_snapshots() {
+ $CLI_1 snapshot activate ${V0}_snap &
+ PID_1=$!
+
+ $CLI_1 snapshot activate ${V1}_snap &
+ PID_2=$!
+
+ wait $PID_1 $PID_2
+}
+
+function deactivate_snapshots() {
+ $CLI_1 snapshot deactivate ${V0}_snap &
+ PID_1=$!
+
+ $CLI_1 snapshot deactivate ${V1}_snap &
+ PID_2=$!
+
+ wait $PID_1 $PID_2
+}
+cleanup;
+
+TEST verify_lvm_version;
+# Create cluster with 3 nodes
+TEST launch_cluster 3;
+TEST setup_lvm 3
+
+TEST $CLI_1 peer probe $H2;
+TEST $CLI_1 peer probe $H3;
+EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count;
+
+# Create volumes
+TEST $CLI_1 volume create $V0 $H1:$L1
+TEST $CLI_2 volume create $V1 $H2:$L2 $H3:$L3
+
+# Start volumes
+TEST $CLI_1 volume start $V0
+TEST $CLI_2 volume start $V1
+
+TEST $CLI_1 snapshot config activate-on-create enable
+
+# Snapshot Operations
+create_snapshots
+
+EXPECT 'Started' snapshot_status ${V0}_snap;
+EXPECT 'Started' snapshot_status ${V1}_snap;
+
+deactivate_snapshots
+
+EXPECT 'Stopped' snapshot_status ${V0}_snap;
+EXPECT 'Stopped' snapshot_status ${V1}_snap;
+
+activate_snapshots
+
+EXPECT 'Started' snapshot_status ${V0}_snap;
+EXPECT 'Started' snapshot_status ${V1}_snap;
+
+# This Function will get snap id form snap info command and will
+# check for mount point in system against snap id.
+function mounted_snaps
+{
+ snap_id=`$CLI_1 snap info $1_snap | grep "Snap Volume Name" |
+ awk -F ":" '{print $2}'`
+ echo `mount | grep $snap_id | wc -l`
+}
+
+EXPECT "1" mounted_snaps ${V0}
+EXPECT "2" mounted_snaps ${V1}
+
+deactivate_snapshots
+
+EXPECT "0" mounted_snaps ${V0}
+EXPECT "0" mounted_snaps ${V1}
+
+# This part of test is designed to validate that updates are properly being
+# handled during handshake.
+
+activate_snapshots
+kill_glusterd 2
+deactivate_snapshots
+TEST start_glusterd 2
+
+# Updates form friend should reflect as snap was deactivated while glusterd
+# process was inactive and mount point should also not exist.
+
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" mounted_snaps ${V0}
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "0" mounted_snaps ${V1}
+
+kill_glusterd 2
+activate_snapshots
+TEST start_glusterd 2
+
+# Updates form friend should reflect as snap was activated while glusterd
+# process was inactive and mount point should exist.
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" mounted_snaps ${V0}
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" mounted_snaps ${V1}
+
+cleanup;
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index 2a0d321..3f03d2b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -1678,7 +1678,21 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count,
"for snap %s", peer_snap_name);
goto out;
}
+ /* During handshake, after getting updates from friend mount
+ * point for activated snapshot should exist and should not
+ * for deactivated snapshot.
+ */
if (glusterd_is_volume_started (snap_vol)) {
+ ret = glusterd_recreate_vol_brick_mounts (this,
+ snap_vol);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRK_MNT_RECREATE_FAIL,
+ "Failed to recreate brick mounts"
+ " for %s", snap->snapname);
+ goto out;
+ }
+
(void) glusterd_start_bricks (snap_vol);
ret = glusterd_store_volinfo
(snap_vol,
@@ -1692,6 +1706,13 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count,
}
} else {
(void) glusterd_stop_bricks(snap_vol);
+ ret = glusterd_snap_unmount(this, snap_vol);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GLUSTERD_UMOUNT_FAIL,
+ "Failed to unmounts for %s",
+ snap->snapname);
+ }
}
ret = glusterd_import_quota_conf (peer_data, i,
@@ -3347,6 +3368,70 @@ out:
return ret;
}
+/* This function will do unmount for snaps.
+ */
+int32_t
+glusterd_snap_unmount (xlator_t *this, glusterd_volinfo_t *volinfo)
+{
+ char *brick_mount_path = NULL;
+ glusterd_brickinfo_t *brickinfo = NULL;
+ int32_t ret = -1;
+ int retry_count = 0;
+
+ GF_ASSERT (this);
+ GF_ASSERT (volinfo);
+
+ cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
+ /* If the brick is not of this node, we continue */
+ if (gf_uuid_compare (brickinfo->uuid, MY_UUID)) {
+ continue;
+ }
+ /* If snapshot is pending, we continue */
+ if (brickinfo->snap_status == -1) {
+ continue;
+ }
+
+ /* Fetch the brick mount path from the brickinfo->path */
+ ret = glusterd_get_brick_root (brickinfo->path,
+ &brick_mount_path);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ GD_MSG_BRICK_PATH_UNMOUNTED,
+ "Failed to find brick_mount_path for %s",
+ brickinfo->path);
+ /* There is chance that brick path is already
+ * unmounted. */
+ ret = 0;
+ goto out;
+ }
+ /* unmount cannot be done when the brick process is still in
+ * the process of shutdown, so give three re-tries
+ */
+ retry_count = 0;
+ while (retry_count <= 2) {
+ retry_count++;
+ /* umount2 system call doesn't cleanup mtab entry
+ * after un-mount, using external umount command.
+ */
+ ret = glusterd_umount(brick_mount_path);
+ if (!ret)
+ break;
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GLUSTERD_UMOUNT_FAIL, "umount failed "
+ "for path %s (brick: %s): %s. Retry(%d)",
+ brick_mount_path, brickinfo->path,
+ strerror (errno), retry_count);
+ sleep (3);
+ }
+ }
+
+out:
+ if (brick_mount_path)
+ GF_FREE(brick_mount_path);
+
+ return ret;
+}
+
int32_t
glusterd_umount (const char *path)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h
index e050166..814bf4a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.h
@@ -76,6 +76,9 @@ int32_t
glusterd_umount (const char *path);
int32_t
+glusterd_snap_unmount (xlator_t *this, glusterd_volinfo_t *volinfo);
+
+int32_t
glusterd_add_snapshots_to_export_dict (dict_t *peer_data);
int32_t
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index c38d2ff..275abe3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -872,6 +872,17 @@ glusterd_snapshot_restore (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
goto out;
}
}
+ /* During snapshot restore, mount point for stopped snap
+ * should exist as it is required to set extended attribute.
+ */
+ ret = glusterd_recreate_vol_brick_mounts (this, snap_volinfo);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRK_MNT_RECREATE_FAIL,
+ "Failed to recreate brick mounts for %s",
+ snap->snapname);
+ goto out;
+ }
ret = gd_restore_snap_volume (dict, rsp_dict, parent_volinfo,
snap_volinfo, volcount);
@@ -5195,13 +5206,17 @@ glusterd_take_brick_snapshot (dict_t *dict, glusterd_volinfo_t *snap_vol,
char *origin_brick_path = NULL;
char key[PATH_MAX] = "";
int32_t ret = -1;
+ gf_boolean_t snap_activate = _gf_false;
xlator_t *this = NULL;
+ glusterd_conf_t *priv = NULL;
this = THIS;
+ priv = this->private;
GF_ASSERT (this);
GF_ASSERT (dict);
GF_ASSERT (snap_vol);
GF_ASSERT (brickinfo);
+ GF_ASSERT (priv);
if (strlen(brickinfo->device_path) == 0) {
gf_msg (this->name, GF_LOG_ERROR, EINVAL,
@@ -5245,16 +5260,23 @@ glusterd_take_brick_snapshot (dict_t *dict, glusterd_volinfo_t *snap_vol,
*/
}
- /* create the complete brick here */
- ret = glusterd_snap_brick_create (snap_vol, brickinfo,
- brick_count, clone);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_BRICK_CREATION_FAIL, "not able to"
- " create the brick for the snap %s"
- ", volume %s", snap_vol->snapshot->snapname,
- snap_vol->volname);
- goto out;
+ /* create the complete brick here in case of clone and
+ * activate-on-create configuration.
+ */
+ snap_activate = dict_get_str_boolean (priv->opts,
+ GLUSTERD_STORE_KEY_SNAP_ACTIVATE,
+ _gf_false);
+ if (clone || snap_activate) {
+ ret = glusterd_snap_brick_create (snap_vol, brickinfo,
+ brick_count, clone);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_CREATION_FAIL, "not able to "
+ "create the brick for the snap %s, volume %s",
+ snap_vol->snapshot->snapname,
+ snap_vol->volname);
+ goto out;
+ }
}
out:
@@ -6126,8 +6148,10 @@ glusterd_snapshot_activate_commit (dict_t *dict, char **op_errstr,
char *snapname = NULL;
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *snap_volinfo = NULL;
+ glusterd_brickinfo_t *brickinfo = NULL;
xlator_t *this = NULL;
- int flags = 0;
+ int flags = 0;
+ int brick_count = -1;
this = THIS;
GF_ASSERT (this);
@@ -6178,6 +6202,24 @@ glusterd_snapshot_activate_commit (dict_t *dict, char **op_errstr,
goto out;
}
+ /* create the complete brick here */
+ cds_list_for_each_entry (brickinfo, &snap_volinfo->bricks,
+ brick_list) {
+ brick_count++;
+ if (gf_uuid_compare (brickinfo->uuid, MY_UUID))
+ continue;
+ ret = glusterd_snap_brick_create (snap_volinfo, brickinfo,
+ brick_count, _gf_false);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRICK_CREATION_FAIL, "not able to "
+ "create the brick for the snap %s, volume %s",
+ snap_volinfo->snapshot->snapname,
+ snap_volinfo->volname);
+ goto out;
+ }
+ }
+
ret = glusterd_start_volume (snap_volinfo, flags, _gf_true);
if (ret) {
@@ -6263,6 +6305,13 @@ glusterd_snapshot_deactivate_commit (dict_t *dict, char **op_errstr,
goto out;
}
+ ret = glusterd_snap_unmount(this, snap_volinfo);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GLUSTERD_UMOUNT_FAIL,
+ "Failed to unmounts for %s", snap->snapname);
+ }
+
ret = dict_set_dynstr_with_alloc (rsp_dict, "snapuuid",
uuid_utoa (snap->snap_id));
if (ret) {
@@ -6907,6 +6956,7 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
int64_t i = 0;
int64_t volcount = 0;
int32_t snap_activate = 0;
+ int32_t flags = 0;
char *snapname = NULL;
char *volname = NULL;
char *tmp_name = NULL;
@@ -6915,7 +6965,6 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *origin_vol = NULL;
glusterd_volinfo_t *snap_vol = NULL;
- glusterd_brickinfo_t *brickinfo = NULL;
glusterd_conf_t *priv = NULL;
this = THIS;
@@ -7054,30 +7103,21 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
goto out;
}
- cds_list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
- cds_list_for_each_entry (brickinfo, &snap_vol->bricks,
- brick_list) {
- ret = glusterd_brick_start (snap_vol, brickinfo,
- _gf_false);
- if (ret) {
- gf_msg (this->name, GF_LOG_WARNING, 0,
- GD_MSG_BRICK_DISCONNECTED, "starting "
- "the brick %s:%s for the snap %s "
- "(volume: %s) failed",
- brickinfo->hostname, brickinfo->path,
- snap_vol->snapshot->snapname,
- snap_vol->volname);
- goto out;
- }
- }
+ /* Activate created bricks in case of activate-on-create config. */
+ ret = dict_get_int32 (dict, "flags", &flags);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_GET_FAILED, "Unable to get flags");
+ goto out;
+ }
- snap_vol->status = GLUSTERD_STATUS_STARTED;
- ret = glusterd_store_volinfo (snap_vol,
- GLUSTERD_VOLINFO_VER_AC_INCREMENT);
+ cds_list_for_each_entry (snap_vol, &snap->volumes, vol_list) {
+ ret = glusterd_start_volume (snap_vol, flags, _gf_true);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_VOLINFO_SET_FAIL, "Failed to store "
- "snap volinfo %s", snap_vol->volname);
+ GD_MSG_SNAP_ACTIVATE_FAIL,
+ "Failed to activate snap volume %s of the "
+ "snap %s", snap_vol->volname, snap->snapname);
goto out;
}
}
@@ -7619,6 +7659,30 @@ glusterd_get_single_brick_status (char **op_errstr, dict_t *rsp_dict,
if (ret < 0) {
goto out;
}
+ /* While getting snap status we should show relevent information
+ * for deactivated snaps.
+ */
+ if (snap_volinfo->status == GLUSTERD_STATUS_STOPPED) {
+ /* Setting vgname as "Deactivated Snapshot" */
+ value = gf_strdup ("N/A (Deactivated Snapshot)");
+ if (!value) {
+ ret = -1;
+ goto out;
+ }
+
+ snprintf (key, sizeof (key), "%s.brick%d.vgname",
+ keyprefix, index);
+ ret = dict_set_dynstr (rsp_dict, key, value);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
+ "Could not save vgname ");
+ goto out;
+ }
+
+ ret = 0;
+ goto out;
+ }
ret = glusterd_get_brick_lvm_details (rsp_dict, brickinfo,
snap_volinfo->volname,
@@ -9200,6 +9264,19 @@ glusterd_snapshot_restore_postop (dict_t *dict, int32_t op_ret,
snap->snapname);
goto out;
}
+
+ /* After restore fails, we have to remove mount point for
+ * deactivated snaps which was created at start of restore op.
+ */
+ if (volinfo->status == GLUSTERD_STATUS_STOPPED) {
+ ret = glusterd_snap_unmount(this, volinfo);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_GLUSTERD_UMOUNT_FAIL,
+ "Failed to unmounts for %s",
+ snap->snapname);
+ }
+ }
}
ret = 0;
@@ -9965,7 +10042,7 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
glusterd_conf_t *conf = NULL;
glusterd_volinfo_t *temp_volinfo = NULL;
glusterd_volinfo_t *voliter = NULL;
- gf_boolean_t conf_present = _gf_false;
+ gf_boolean_t conf_present = _gf_false;
this = THIS;
GF_ASSERT (this);
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 42bb8ce..e35fcde 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -3519,7 +3519,7 @@ out:
return ret;
}
-static int32_t
+int32_t
glusterd_recreate_vol_brick_mounts (xlator_t *this,
glusterd_volinfo_t *volinfo)
{
@@ -4501,17 +4501,22 @@ glusterd_recreate_all_snap_brick_mounts (xlator_t *this)
}
}
- /* Recreate bricks of snapshot volumes */
+ /* Recreate bricks of snapshot volumes
+ * We are not creating brick mounts for stopped snaps.
+ */
cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
cds_list_for_each_entry (volinfo, &snap->volumes, vol_list) {
- ret = glusterd_recreate_vol_brick_mounts (this,
- volinfo);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_BRK_MNT_RECREATE_FAIL,
- "Failed to recreate brick mounts "
- "for %s", snap->snapname);
- goto out;
+ if (volinfo->status != GLUSTERD_STATUS_STOPPED) {
+ ret = glusterd_recreate_vol_brick_mounts
+ (this, volinfo);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_BRK_MNT_RECREATE_FAIL,
+ "Failed to recreate brick "
+ "mounts for %s",
+ snap->snapname);
+ goto out;
+ }
}
}
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h
index bf504e0..383a475 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.h
+++ b/xlators/mgmt/glusterd/src/glusterd-store.h
@@ -203,4 +203,8 @@ glusterd_quota_conf_write_header (int fd);
int32_t
glusterd_quota_conf_write_gfid (int fd, void *buf, char type);
+int32_t
+glusterd_recreate_vol_brick_mounts (xlator_t *this,
+ glusterd_volinfo_t *volinfo);
+
#endif
--
1.8.3.1

View File

@ -1,59 +0,0 @@
From 164e0384d6ae0ac9be713b4167d2b7151a027dc4 Mon Sep 17 00:00:00 2001
From: Sunny Kumar <sunkumar@redhat.com>
Date: Tue, 28 Nov 2017 18:48:31 +0530
Subject: [PATCH 086/128] snapshot: lvm cleanup during snapshot remove
Problem : During snapshot remove lvm cleanup was skipped for deactivated
snapshots by assuming that its mount point is not present.
Fix : Do no skip lvm cleanup by checking active mount point.
Upstream Patch : https://review.gluster.org/18654
>BUG: 1509254
>Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
BUG: 1467903
Change-Id: I856d2d647c75db8b37b7f430277daef6eb7580a8
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124534
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-snapshot.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 275abe3..5bdf27f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -2984,13 +2984,19 @@ glusterd_lvm_snapshot_remove (dict_t *rsp_dict, glusterd_volinfo_t *snap_vol)
continue;
}
- ret = sys_lstat (brick_mount_path, &stbuf);
- if (ret) {
- gf_msg_debug (this->name, 0,
- "Brick %s:%s already deleted.",
- brickinfo->hostname, brickinfo->path);
- ret = 0;
- continue;
+ /* As deactivated snapshot have no active mount point we
+ * check only for activated snapshot.
+ */
+ if (snap_vol->status == GLUSTERD_STATUS_STARTED) {
+ ret = sys_lstat (brick_mount_path, &stbuf);
+ if (ret) {
+ gf_msg_debug (this->name, 0,
+ "Brick %s:%s already deleted.",
+ brickinfo->hostname,
+ brickinfo->path);
+ ret = 0;
+ continue;
+ }
}
if (brickinfo->snap_status == -1) {
--
1.8.3.1

View File

@ -1,134 +0,0 @@
From df02eac6436c86e75aed23f8ba61a061d8db9f35 Mon Sep 17 00:00:00 2001
From: Kotresh HR <khiremat@redhat.com>
Date: Tue, 17 Oct 2017 11:28:43 -0400
Subject: [PATCH 087/128] glusterd: Validate changelog on geo-rep volume
If geo-rep is configured on volume, don't allow
to disable changelog.
Backport of:
> Upstream Patch: https://review.gluster.org/18540
> Change-Id: I7d1ba8b2939c8fe6ee6c59fb923d9aa1bdab553c
> BUG: 1503227
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
Change-Id: I7d1ba8b2939c8fe6ee6c59fb923d9aa1bdab553c
BUG: 1498391
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124533
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-messages.h | 9 ++++-
xlators/mgmt/glusterd/src/glusterd-volgen.c | 53 +++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index fb2079f..225d59b 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 613
+#define GLFS_NUM_MESSAGES 614
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
@@ -4961,6 +4961,12 @@
*/
#define GD_MSG_PORTS_EXHAUSTED (GLUSTERD_COMP_BASE + 612)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
#define GD_MSG_GANESHA_NOT_RUNNING (GLUSTERD_COMP_BASE + 613)
/*!
* @messageid
@@ -4968,6 +4974,7 @@
* @recommendedaction
*
*/
+#define GD_MSG_CHANGELOG_GET_FAIL (GLUSTERD_COMP_BASE + 614)
/*------------*/
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 97049ac..8ff76d6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1209,6 +1209,56 @@ loglevel_option_handler (volgen_graph_t *graph,
}
static int
+server_check_changelog_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
+ glusterd_volinfo_t *volinfo)
+{
+ gf_boolean_t enabled = _gf_false;
+ int ret = 0;
+
+ GF_ASSERT (volinfo);
+ GF_ASSERT (vme);
+
+ if (strcmp (vme->option, "changelog") != 0)
+ return 0;
+
+ ret = gf_string2boolean (vme->value, &enabled);
+ if (ret || enabled)
+ goto out;
+
+ ret = glusterd_volinfo_get_boolean (volinfo, VKEY_CHANGELOG);
+ if (ret < 0) {
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_CHANGELOG_GET_FAIL,
+ "failed to get the changelog status");
+ ret = -1;
+ goto out;
+ }
+
+ if (ret) {
+ enabled = _gf_false;
+ glusterd_check_geo_rep_configured (volinfo, &enabled);
+
+ if (enabled) {
+ gf_msg ("glusterd", GF_LOG_WARNING, 0,
+ GD_MSG_XLATOR_SET_OPT_FAIL,
+ GEOREP" sessions active"
+ "for the volume %s, cannot disable changelog ",
+ volinfo->volname);
+ set_graph_errstr (graph,
+ VKEY_CHANGELOG" cannot be disabled "
+ "while "GEOREP" sessions exist");
+ ret = -1;
+ goto out;
+ }
+ }
+
+ ret = 0;
+ out:
+ gf_msg_debug ("glusterd", 0, "Returning %d", ret);
+ return ret;
+}
+
+static int
server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
glusterd_volinfo_t *volinfo)
{
@@ -1424,6 +1474,9 @@ server_spec_option_handler (volgen_graph_t *graph,
ret = server_check_marker_off (graph, vme, volinfo);
if (!ret)
+ ret = server_check_changelog_off (graph, vme, volinfo);
+
+ if (!ret)
ret = loglevel_option_handler (graph, vme, "brick");
if (!ret)
--
1.8.3.1

View File

@ -1,731 +0,0 @@
From 8b596eacd72527b55ccff6a26a44014b6cf76b48 Mon Sep 17 00:00:00 2001
From: Sunil Kumar Acharya <sheggodu@redhat.com>
Date: Wed, 14 Jun 2017 16:28:40 +0530
Subject: [PATCH 088/128] cluster/ec: Implement DISCARD FOP for EC
Updates #254
This code change implements DISCARD FOP support for
EC.
>BUG: 1461018
>Change-Id: I09a9cb2aa9d91ec27add4f422dc9074af5b8b2db
>Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
Upstream Patch: https://review.gluster.org/#/c/17777/
BUG: 1499865
Change-Id: I09a9cb2aa9d91ec27add4f422dc9074af5b8b2db
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/123694
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
tests/basic/ec/ec-discard.t | 197 +++++++++++++++++
tests/include.rc | 7 +
xlators/cluster/ec/src/ec-common.h | 3 +-
xlators/cluster/ec/src/ec-fops.h | 4 +
xlators/cluster/ec/src/ec-helpers.h | 5 +-
xlators/cluster/ec/src/ec-inode-write.c | 365 ++++++++++++++++++++++++++++----
xlators/cluster/ec/src/ec.c | 3 +-
7 files changed, 536 insertions(+), 48 deletions(-)
create mode 100644 tests/basic/ec/ec-discard.t
diff --git a/tests/basic/ec/ec-discard.t b/tests/basic/ec/ec-discard.t
new file mode 100644
index 0000000..4a44cec
--- /dev/null
+++ b/tests/basic/ec/ec-discard.t
@@ -0,0 +1,197 @@
+#!/bin/bash
+#
+# Test discard functionality
+#
+# Test that basic discard (hole punch) functionality works via the fallocate
+# command line tool. Hole punch deallocates a region of a file, creating a hole
+# and a zero-filled data region. We verify that hole punch works, frees blocks
+# and that subsequent reads do not read stale data (caches are invalidated).
+#
+# NOTE: fuse fallocate is known to be broken with regard to cache invalidation
+# up to 3.9.0 kernels. Therefore, FOPEN_KEEP_CACHE is not used in this
+# test (opens will invalidate the fuse cache).
+###
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../fallocate.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup
+
+#cleate and start volume
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5}
+TEST $CLI volume set $V0 disperse.optimistic-change-log on
+TEST $CLI volume start $V0
+
+#Mount the volume
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0
+
+#Check for fallocate and hole punch support
+require_fallocate -l 1m $M0/file
+require_fallocate -p -l 512k $M0/file && rm -f $M0/file
+
+#Write some data, punch a hole and verify the file content changes
+TEST dd if=/dev/urandom of=$M0/file bs=1024k count=1
+TEST cp $M0/file $M0/file.copy.pre
+TEST fallocate -p -o 512k -l 128k $M0/file
+TEST ! cmp $M0/file.copy.pre $M0/file
+TEST rm -f $M0/file $M0/file.copy.pre
+
+#Allocate some blocks, punch a hole and verify block allocation
+TEST fallocate -l 1m $M0/file
+blksz=`stat -c %B $M0/file`
+nblks=`stat -c %b $M0/file`
+TEST [ $(($blksz * $nblks)) -ge 1048576 ]
+TEST fallocate -p -o 512k -l 128k $M0/file
+nblks=`stat -c %b $M0/file`
+TEST [ $(($blksz * $nblks)) -lt $((933889)) ]
+TEST unlink $M0/file
+
+###Punch hole test cases without fallocate
+##With write
+#Touching starting boundary
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
+TEST cp $B0/test_file $M0/test_file
+TEST fallocate -p -o 0 -l 500 $B0/test_file
+TEST fallocate -p -o 0 -l 500 $M0/test_file
+TEST md5_sum=`get_md5_sum $B0/test_file`
+EXPECT $md5_sum get_md5_sum $M0/test_file
+TEST rm -f $B0/test_file $M0/test_file
+
+#Touching boundary
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
+TEST cp $B0/test_file $M0/test_file
+TEST fallocate -p -o 500 -l 1548 $B0/test_file
+TEST fallocate -p -o 500 -l 1548 $M0/test_file
+TEST md5_sum=`get_md5_sum $B0/test_file`
+EXPECT $md5_sum get_md5_sum $M0/test_file
+TEST rm -f $B0/test_file $M0/test_file
+
+#Not touching boundary
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
+TEST cp $B0/test_file $M0/test_file
+TEST fallocate -p -o 500 -l 1000 $B0/test_file
+TEST fallocate -p -o 500 -l 1000 $M0/test_file
+TEST md5_sum=`get_md5_sum $B0/test_file`
+EXPECT $md5_sum get_md5_sum $M0/test_file
+TEST rm -f $B0/test_file $M0/test_file
+
+#Over boundary
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
+TEST cp $B0/test_file $M0/test_file
+TEST fallocate -p -o 1500 -l 1000 $B0/test_file
+TEST fallocate -p -o 1500 -l 1000 $M0/test_file
+TEST md5_sum=`get_md5_sum $B0/test_file`
+EXPECT $md5_sum get_md5_sum $M0/test_file
+TEST rm -f $B0/test_file $M0/test_file
+
+###Punch hole test cases with fallocate
+##Without write
+
+#Zero size
+TEST dd if=/dev/urandom of=$M0/test_file bs=1024 count=8
+TEST ! fallocate -p -o 1500 -l 0 $M0/test_file
+
+#Negative size
+TEST ! fallocate -p -o 1500 -l -100 $M0/test_file
+TEST rm -f $M0/test_file
+
+#Touching boundary
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
+TEST cp $B0/test_file $M0/test_file
+TEST fallocate -p -o 2048 -l 2048 $B0/test_file
+TEST fallocate -p -o 2048 -l 2048 $M0/test_file
+TEST md5_sum=`get_md5_sum $B0/test_file`
+EXPECT $md5_sum get_md5_sum $M0/test_file
+TEST rm -f $B0/test_file $M0/test_file
+
+#Touching boundary,multiple stripe
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
+TEST cp $B0/test_file $M0/test_file
+TEST fallocate -p -o 2048 -l 4096 $B0/test_file
+TEST fallocate -p -o 2048 -l 4096 $M0/test_file
+TEST md5_sum=`get_md5_sum $B0/test_file`
+EXPECT $md5_sum get_md5_sum $M0/test_file
+TEST rm -f $B0/test_file $M0/test_file
+
+##With write
+
+#Size ends in boundary
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
+TEST cp $B0/test_file $M0/test_file
+TEST fallocate -p -o 600 -l 3496 $B0/test_file
+TEST fallocate -p -o 600 -l 3496 $M0/test_file
+TEST md5_sum=`get_md5_sum $B0/test_file`
+EXPECT $md5_sum get_md5_sum $M0/test_file
+TEST rm -f $B0/test_file $M0/test_file
+
+#Offset at boundary
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
+TEST cp $B0/test_file $M0/test_file
+TEST fallocate -p -o 2048 -l 3072 $B0/test_file
+TEST fallocate -p -o 2048 -l 3072 $M0/test_file
+TEST md5_sum=`get_md5_sum $B0/test_file`
+EXPECT $md5_sum get_md5_sum $M0/test_file
+TEST rm -f $B0/test_file $M0/test_file
+
+#Offset and Size not at boundary
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
+TEST cp $B0/test_file $M0/test_file
+TEST fallocate -p -o 1000 -l 3072 $B0/test_file
+TEST fallocate -p -o 1000 -l 3072 $M0/test_file
+TEST md5_sum=`get_md5_sum $B0/test_file`
+EXPECT $md5_sum get_md5_sum $M0/test_file
+#TEST rm -f $B0/test_file $M0/test_file
+
+#Data Corruption Tests
+#Kill brick1 and brick2
+TEST kill_brick $V0 $H0 $B0/${V0}0
+TEST kill_brick $V0 $H0 $B0/${V0}1
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "4" ec_child_up_count $V0 0
+
+#Unmount and mount
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0;
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "4" ec_child_up_count $V0 0
+
+#verify md5 sum
+EXPECT $md5_sum get_md5_sum $M0/test_file
+
+#Bring up the bricks
+TEST $CLI volume start $V0 force
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0
+
+#Kill brick3 and brick4
+TEST kill_brick $V0 $H0 $B0/${V0}2
+TEST kill_brick $V0 $H0 $B0/${V0}3
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "4" ec_child_up_count $V0 0
+
+#Unmount and mount
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0;
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "4" ec_child_up_count $V0 0
+
+#verify md5 sum
+EXPECT $md5_sum get_md5_sum $M0/test_file
+
+#Bring up the bricks
+TEST $CLI volume start $V0 force
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0
+
+#Kill brick5 and brick6
+TEST kill_brick $V0 $H0 $B0/${V0}4
+TEST kill_brick $V0 $H0 $B0/${V0}5
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "4" ec_child_up_count $V0 0
+
+#Unmount and mount
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0;
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "4" ec_child_up_count $V0 0
+
+#verify md5 sum
+EXPECT $md5_sum get_md5_sum $M0/test_file
+
+cleanup
diff --git a/tests/include.rc b/tests/include.rc
index 7470ea1..45392e0 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -1229,3 +1229,10 @@ function STAT_INO()
echo 0
fi
}
+
+function get_md5_sum()
+{
+ local file=$1;
+ md5_sum=$(md5sum $file | awk '{print $1}');
+ echo $md5_sum
+}
diff --git a/xlators/cluster/ec/src/ec-common.h b/xlators/cluster/ec/src/ec-common.h
index 1a947cc..0f7a252 100644
--- a/xlators/cluster/ec/src/ec-common.h
+++ b/xlators/cluster/ec/src/ec-common.h
@@ -85,6 +85,8 @@ void ec_update_good(ec_fop_data_t *fop, uintptr_t good);
void ec_fop_set_error(ec_fop_data_t *fop, int32_t error);
+void __ec_fop_set_error(ec_fop_data_t *fop, int32_t error);
+
ec_cbk_data_t *
ec_fop_prepare_answer(ec_fop_data_t *fop, gf_boolean_t ro);
@@ -133,5 +135,4 @@ ec_heal_inspect (call_frame_t *frame, ec_t *ec,
gf_boolean_t *need_heal);
int32_t
ec_get_heal_info (xlator_t *this, loc_t *loc, dict_t **dict);
-
#endif /* __EC_COMMON_H__ */
diff --git a/xlators/cluster/ec/src/ec-fops.h b/xlators/cluster/ec/src/ec-fops.h
index fab22d8..4a926cf 100644
--- a/xlators/cluster/ec/src/ec-fops.h
+++ b/xlators/cluster/ec/src/ec-fops.h
@@ -172,6 +172,10 @@ void ec_fallocate(call_frame_t *frame, xlator_t *this, uintptr_t target,
int32_t minimum, fop_fallocate_cbk_t func, void *data, fd_t *fd,
int32_t mode, off_t offset, size_t len, dict_t *xdata);
+void ec_discard(call_frame_t *frame, xlator_t *this, uintptr_t target,
+ int32_t minimum, fop_discard_cbk_t func, void *data, fd_t *fd,
+ off_t offset, size_t len, dict_t *xdata);
+
void ec_truncate(call_frame_t * frame, xlator_t * this, uintptr_t target,
int32_t minimum, fop_truncate_cbk_t func, void *data,
loc_t * loc, off_t offset, dict_t * xdata);
diff --git a/xlators/cluster/ec/src/ec-helpers.h b/xlators/cluster/ec/src/ec-helpers.h
index cfd7daa..a8f153a 100644
--- a/xlators/cluster/ec/src/ec-helpers.h
+++ b/xlators/cluster/ec/src/ec-helpers.h
@@ -178,8 +178,5 @@ ec_is_data_fop (glusterfs_fop_t fop);
int32_t
ec_launch_replace_heal (ec_t *ec);
-/*
-gf_boolean_t
-ec_is_metadata_fop (glusterfs_fop_t fop);
-*/
+
#endif /* __EC_HELPERS_H__ */
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c
index e6a67cf..ae51202 100644
--- a/xlators/cluster/ec/src/ec-inode-write.c
+++ b/xlators/cluster/ec/src/ec-inode-write.c
@@ -19,6 +19,97 @@
#include "ec-method.h"
#include "ec-fops.h"
+int32_t
+ec_update_writev_cbk (call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret, int32_t op_errno,
+ struct iatt *prebuf, struct iatt *postbuf,
+ dict_t *xdata)
+{
+ ec_fop_data_t *fop = cookie;
+ ec_cbk_data_t *cbk = NULL;
+ ec_fop_data_t *parent = fop->parent;
+ int i = 0;
+
+ ec_trace("UPDATE_WRITEV_CBK", cookie, "ret=%d, errno=%d, parent-fop=%s",
+ op_ret, op_errno, ec_fop_name (parent->id));
+
+ if (op_ret < 0) {
+ ec_fop_set_error (parent, op_errno);
+ goto out;
+ }
+ cbk = ec_cbk_data_allocate (parent->frame, this, parent,
+ parent->id, 0, op_ret, op_errno);
+ if (!cbk) {
+ ec_fop_set_error (parent, ENOMEM);
+ goto out;
+ }
+
+ if (xdata)
+ cbk->xdata = dict_ref (xdata);
+
+ if (prebuf)
+ cbk->iatt[i++] = *prebuf;
+
+ if (postbuf)
+ cbk->iatt[i++] = *postbuf;
+
+ LOCK (&parent->lock);
+ {
+ parent->good &= fop->good;
+
+ if (gf_bits_count (parent->good) < parent->minimum) {
+ __ec_fop_set_error (parent, EIO);
+ } else if (fop->error == 0 && parent->answer == NULL) {
+ parent->answer = cbk;
+ }
+ }
+ UNLOCK (&parent->lock);
+out:
+ return 0;
+}
+
+int32_t ec_update_write(ec_fop_data_t *fop, uintptr_t mask, off_t offset,
+ size_t size)
+{
+ struct iobref *iobref = NULL;
+ struct iobuf *iobuf = NULL;
+ struct iovec vector;
+ int32_t err = -ENOMEM;
+
+ iobref = iobref_new();
+ if (iobref == NULL) {
+ goto out;
+ }
+ iobuf = iobuf_get(fop->xl->ctx->iobuf_pool);
+ if (iobuf == NULL) {
+ goto out;
+ }
+ err = iobref_add(iobref, iobuf);
+ if (err != 0) {
+ goto out;
+ }
+
+ vector.iov_base = iobuf->ptr;
+ vector.iov_len = size;
+ memset(vector.iov_base, 0, vector.iov_len);
+
+ ec_writev(fop->frame, fop->xl, mask, fop->minimum,
+ ec_update_writev_cbk, NULL, fop->fd, &vector, 1,
+ offset, 0, iobref, NULL);
+
+ err = 0;
+
+out:
+ if (iobuf != NULL) {
+ iobuf_unref(iobuf);
+ }
+ if (iobref != NULL) {
+ iobref_unref(iobref);
+ }
+
+ return err;
+}
+
int
ec_inode_write_cbk (call_frame_t *frame, xlator_t *this, void *cookie,
int op_ret, int op_errno, struct iatt *prestat,
@@ -1034,62 +1125,252 @@ out:
}
}
-int32_t
-ec_truncate_writev_cbk (call_frame_t *frame, void *cookie,
- xlator_t *this, int32_t op_ret, int32_t op_errno,
- struct iatt *prebuf, struct iatt *postbuf,
- dict_t *xdata)
+/*********************************************************************
+ *
+ * File Operation : Discard
+ *
+ *********************************************************************/
+void ec_update_discard_write(ec_fop_data_t *fop, uintptr_t mask)
{
- ec_fop_data_t *fop = cookie;
+ ec_t *ec = fop->xl->private;
+ off_t off_head = 0;
+ off_t off_tail = 0;
+ size_t size_head = 0;
+ size_t size_tail = 0;
+ int error = 0;
+
+ off_head = fop->offset * ec->fragments - fop->int32;
+ if (fop->size == 0) {
+ error = ec_update_write (fop, mask, off_head, fop->user_size);
+ } else {
+ size_head = fop->int32;
+ size_tail = (fop->user_size - fop->int32) % ec->stripe_size;
+ off_tail = off_head + fop->user_size - size_tail;
+ if (size_head) {
+ error = ec_update_write (fop, mask, off_head, size_head);
+ goto out;
+ }
+ if (size_tail) {
+ error = ec_update_write (fop, mask, off_tail, size_tail);
+ }
+ }
+out:
+ if (error)
+ ec_fop_set_error (fop, -error);
+}
- fop->parent->good &= fop->good;
- ec_trace("TRUNCATE_WRITEV_CBK", cookie, "ret=%d, errno=%d",
- op_ret, op_errno);
- return 0;
+void ec_discard_adjust_offset_size(ec_fop_data_t *fop)
+{
+ ec_t *ec = fop->xl->private;
+
+ fop->user_size = fop->size;
+ /* If discard length covers atleast a fragment on brick, we will
+ * perform discard operation(when fop->size is non-zero) else we just
+ * write zeros.
+ */
+ fop->int32 = ec_adjust_offset_up(ec, &fop->offset, _gf_true);
+ if (fop->size < fop->int32) {
+ fop->size = 0;
+ } else {
+ fop->size -= fop->int32;
+ ec_adjust_size_down(ec, &fop->size, _gf_true);
+ }
}
-int32_t ec_truncate_write(ec_fop_data_t * fop, uintptr_t mask)
+int32_t ec_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
+ struct iatt *postbuf, dict_t *xdata)
{
- ec_t * ec = fop->xl->private;
- struct iobref * iobref = NULL;
- struct iobuf * iobuf = NULL;
- struct iovec vector;
- int32_t err = -ENOMEM;
+ return ec_inode_write_cbk (frame, this, cookie, op_ret, op_errno,
+ prebuf, postbuf, xdata);
+}
- iobref = iobref_new();
- if (iobref == NULL) {
- goto out;
- }
- iobuf = iobuf_get(fop->xl->ctx->iobuf_pool);
- if (iobuf == NULL) {
- goto out;
+void ec_wind_discard(ec_t *ec, ec_fop_data_t *fop, int32_t idx)
+{
+ ec_trace("WIND", fop, "idx=%d", idx);
+
+ STACK_WIND_COOKIE(fop->frame, ec_discard_cbk, (void *)(uintptr_t)idx,
+ ec->xl_list[idx], ec->xl_list[idx]->fops->discard,
+ fop->fd, fop->offset, fop->size, fop->xdata);
+}
+
+int32_t ec_manager_discard(ec_fop_data_t *fop, int32_t state)
+{
+ ec_cbk_data_t *cbk = NULL;
+ off_t fl_start = 0;
+ size_t fl_size = 0;
+
+
+ switch (state) {
+ case EC_STATE_INIT:
+ if ((fop->size <= 0) || (fop->offset < 0)) {
+ ec_fop_set_error(fop, EINVAL);
+ return EC_STATE_REPORT;
+ }
+ /* Because of the head/tail writes, "discard" happens on the remaining
+ * regions, but we need to compute region including head/tail writes
+ * so compute them separately*/
+ fl_start = fop->offset;
+ fl_size = fop->size;
+ fl_size += ec_adjust_offset_down (fop->xl->private, &fl_start,
+ _gf_true);
+ ec_adjust_size_up (fop->xl->private, &fl_size, _gf_true);
+
+ ec_discard_adjust_offset_size(fop);
+
+ /* Fall through */
+
+ case EC_STATE_LOCK:
+ ec_lock_prepare_fd(fop, fop->fd,
+ EC_UPDATE_DATA | EC_UPDATE_META |
+ EC_QUERY_INFO, fl_start, fl_size);
+ ec_lock(fop);
+
+ return EC_STATE_DISPATCH;
+
+ case EC_STATE_DISPATCH:
+
+ /* Dispatch discard fop only if we have whole fragment
+ * to deallocate */
+ if (fop->size) {
+ ec_dispatch_all(fop);
+ return EC_STATE_DELAYED_START;
+ } else {
+ /*Assume discard to have succeeded on mask*/
+ fop->good = fop->mask;
+ }
+
+ /* Fall through */
+
+ case EC_STATE_DELAYED_START:
+
+ if (fop->size) {
+ if (fop->answer && fop->answer->op_ret == 0)
+ ec_update_discard_write (fop, fop->answer->mask);
+ } else {
+ ec_update_discard_write (fop, fop->mask);
+ }
+
+ return EC_STATE_PREPARE_ANSWER;
+
+ case EC_STATE_PREPARE_ANSWER:
+ cbk = ec_fop_prepare_answer(fop, _gf_false);
+ if (cbk != NULL) {
+ ec_iatt_rebuild(fop->xl->private, cbk->iatt, 2,
+ cbk->count);
+
+ /* This shouldn't fail because we have the inode locked. */
+ GF_ASSERT(ec_get_inode_size(fop, fop->locks[0].lock->loc.inode,
+ &cbk->iatt[0].ia_size));
+
+ cbk->iatt[1].ia_size = cbk->iatt[0].ia_size;
+ }
+ return EC_STATE_REPORT;
+
+ case EC_STATE_REPORT:
+ cbk = fop->answer;
+
+ GF_ASSERT(cbk != NULL);
+
+ if (fop->cbks.discard != NULL) {
+ fop->cbks.discard(fop->req_frame, fop, fop->xl, cbk->op_ret,
+ cbk->op_errno, &cbk->iatt[0], &cbk->iatt[1],
+ cbk->xdata);
+ }
+
+ return EC_STATE_LOCK_REUSE;
+
+ case -EC_STATE_INIT:
+ case -EC_STATE_LOCK:
+ case -EC_STATE_DISPATCH:
+ case -EC_STATE_DELAYED_START:
+ case -EC_STATE_PREPARE_ANSWER:
+ case -EC_STATE_REPORT:
+ GF_ASSERT(fop->error != 0);
+
+ if (fop->cbks.discard != NULL) {
+ fop->cbks.discard(fop->req_frame, fop, fop->xl, -1,
+ fop->error, NULL, NULL, NULL);
+ }
+
+ return EC_STATE_LOCK_REUSE;
+
+ case -EC_STATE_LOCK_REUSE:
+ case EC_STATE_LOCK_REUSE:
+ ec_lock_reuse(fop);
+
+ return EC_STATE_UNLOCK;
+
+ case -EC_STATE_UNLOCK:
+ case EC_STATE_UNLOCK:
+ ec_unlock(fop);
+
+ return EC_STATE_END;
+
+ default:
+ gf_msg (fop->xl->name, GF_LOG_ERROR, EINVAL,
+ EC_MSG_UNHANDLED_STATE,
+ "Unhandled state %d for %s",
+ state, ec_fop_name(fop->id));
+
+ return EC_STATE_END;
}
- err = iobref_add(iobref, iobuf);
- if (err != 0) {
+}
+
+void ec_discard(call_frame_t *frame, xlator_t *this, uintptr_t target,
+ int32_t minimum, fop_discard_cbk_t func, void *data, fd_t *fd,
+ off_t offset, size_t len, dict_t *xdata)
+{
+ ec_cbk_t callback = { .discard = func };
+ ec_fop_data_t *fop = NULL;
+ int32_t error = ENOMEM;
+
+ gf_msg_trace ("ec", 0, "EC(DISCARD) %p", frame);
+
+ VALIDATE_OR_GOTO(this, out);
+ GF_VALIDATE_OR_GOTO(this->name, frame, out);
+ GF_VALIDATE_OR_GOTO(this->name, this->private, out);
+
+ fop = ec_fop_data_allocate(frame, this, GF_FOP_DISCARD, 0, target,
+ minimum, ec_wind_discard, ec_manager_discard,
+ callback, data);
+ if (fop == NULL) {
goto out;
}
- vector.iov_base = iobuf->ptr;
- vector.iov_len = fop->offset * ec->fragments - fop->user_size;
- memset(vector.iov_base, 0, vector.iov_len);
+ fop->use_fd = 1;
+ fop->offset = offset;
+ fop->size = len;
- iobuf_unref (iobuf);
- iobuf = NULL;
+ if (fd != NULL) {
+ fop->fd = fd_ref(fd);
+ }
- ec_writev(fop->frame, fop->xl, mask, fop->minimum, ec_truncate_writev_cbk,
- NULL, fop->fd, &vector, 1, fop->user_size, 0, iobref, NULL);
+ if (xdata != NULL) {
+ fop->xdata = dict_ref(xdata);
+ }
- err = 0;
+ error = 0;
out:
- if (iobuf != NULL) {
- iobuf_unref(iobuf);
- }
- if (iobref != NULL) {
- iobref_unref(iobref);
+ if (fop != NULL) {
+ ec_manager(fop, error);
+ } else {
+ func(frame, NULL, this, -1, error, NULL, NULL, NULL);
}
+}
- return err;
+/*********************************************************************
+ *
+ * File Operation : truncate
+ *
+ *********************************************************************/
+
+int32_t ec_update_truncate_write (ec_fop_data_t *fop, uintptr_t mask)
+{
+ ec_t *ec = fop->xl->private;
+ size_t size = fop->offset * ec->fragments - fop->user_size;
+ return ec_update_write (fop, mask, fop->user_size, size);
}
int32_t ec_truncate_open_cbk(call_frame_t * frame, void * cookie,
@@ -1102,9 +1383,9 @@ int32_t ec_truncate_open_cbk(call_frame_t * frame, void * cookie,
fop->parent->good &= fop->good;
if (op_ret >= 0) {
fd_bind (fd);
- err = ec_truncate_write(fop->parent, fop->answer->mask);
+ err = ec_update_truncate_write (fop->parent, fop->answer->mask);
if (err != 0) {
- fop->error = -err;
+ ec_fop_set_error (fop->parent, -err);
}
}
@@ -1125,7 +1406,7 @@ int32_t ec_truncate_clean(ec_fop_data_t * fop)
return 0;
} else {
- return ec_truncate_write(fop, fop->answer->mask);
+ return ec_update_truncate_write (fop, fop->answer->mask);
}
}
diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c
index 856d60c..09c5fa8 100644
--- a/xlators/cluster/ec/src/ec.c
+++ b/xlators/cluster/ec/src/ec.c
@@ -729,7 +729,8 @@ int32_t ec_gf_create(call_frame_t * frame, xlator_t * this, loc_t * loc,
int32_t ec_gf_discard(call_frame_t * frame, xlator_t * this, fd_t * fd,
off_t offset, size_t len, dict_t * xdata)
{
- default_discard_failure_cbk(frame, ENOTSUP);
+ ec_discard(frame, this, -1, EC_MINIMUM_MIN, default_discard_cbk,
+ NULL, fd, offset, len, xdata);
return 0;
}
--
1.8.3.1

View File

@ -1,43 +0,0 @@
From 9034056db634852d74423b8324c78ed058d028ba Mon Sep 17 00:00:00 2001
From: Kotresh HR <khiremat@redhat.com>
Date: Tue, 10 Oct 2017 10:27:01 -0400
Subject: [PATCH 089/128] geo-rep: Filter out volume-mark xattr
The volume-mark xattr, maintained at brick root
of slave volume is specific to geo-replication
and should be filtered out for all other clients.
It should also be filtered out from list getxattr
from all mounts including geo-rep mount as it
might cause rsync to read and set.
Backport of:
> Change-Id: If9eb5a3af18051083c853e70d93b2819e8eea222
> BUG: 1500433
> Patch: https://review.gluster.org/18479
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
BUG: 1476876
Change-Id: If9eb5a3af18051083c853e70d93b2819e8eea222
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124531
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/storage/posix/src/posix-helpers.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 18999f0..f97c90b 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -111,6 +111,7 @@ posix_handle_georep_xattrs (call_frame_t *frame, const char *name,
static const char *georep_xattr[] = { "*.glusterfs.*.stime",
"*.glusterfs.*.xtime",
"*.glusterfs.*.entry_stime",
+ "*.glusterfs.volume-mark.*",
NULL
};
if (frame && frame->root) {
--
1.8.3.1

View File

@ -1,75 +0,0 @@
From 16aae2303e2cd70405a3ab5a41c719256dd2db7a Mon Sep 17 00:00:00 2001
From: Sanoj Unnikrishnan <sunnikri@redhat.com>
Date: Tue, 24 Oct 2017 16:10:23 +0530
Subject: [PATCH 090/128] Quota: Adding man page for quota
> Change-Id: I95365c443705f56561cc10138318eb96db3b941e
> BUG: 1505660
> https://review.gluster.org/#/c/18561/
Change-Id: I95365c443705f56561cc10138318eb96db3b941e
BUG: 1501345
Signed-off-by: Sanoj Unnikrishnan <sunnikri@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124658
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
doc/gluster.8 | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/doc/gluster.8 b/doc/gluster.8
index 316a3d2..4c20307 100644
--- a/doc/gluster.8
+++ b/doc/gluster.8
@@ -123,6 +123,48 @@ Check status of data movement from the hot to cold tier.
.TP
\fB\ volume tier <VOLNAME> detach stop\fR
Stop detaching the hot tier from the volume.
+
+.SS "Quota Commands"
+.TP
+\fB\ volume quota <VOLNAME> enable \fR
+Enable quota on the specified volume. This will cause all the directories in the filesystem hierarchy to be accounted and updated thereafter on each operation in the the filesystem. To kick start this accounting, a crawl is done over the hierarchy with an auxiliary client.
+.TP
+\fB\ volume quota <VOLNAME> disable \fR
+Disable quota on the volume. This will disable enforcement and accounting in the filesystem. Any configured limits will be lost.
+.TP
+\fB\ volume quota <VOLNAME> limit-usage <PATH> <SIZE> [<PERCENT>] \fR
+Set a usage limit on the given path. Any previously set limit is overridden to the new value. The soft limit can optionally be specified (as a percentage of hard limit). If soft limit percentage is not provided the default soft limit value for the volume is used to decide the soft limit.
+.TP
+\fB\ volume quota <VOLNAME> limit-objects <PATH> <SIZE> [<PERCENT>] \fR
+Set an inode limit on the given path. Any previously set limit is overridden to the new value. The soft limit can optionally be specified (as a percentage of hard limit). If soft limit percentage is not provided the default soft limit value for the volume is used to decide the soft limit.
+.TP
+NOTE: valid units of SIZE are : B, KB, MB, GB, TB, PB. If no unit is specified, the unit defaults to bytes.
+.TP
+\fB\ volume quota <VOLNAME> remove <PATH> \fR
+Remove any usage limit configured on the specified directory. Note that if any limit is configured on the ancestors of this directory (previous directories along the path), they will still be honored and enforced.
+.TP
+\fB\ volume quota <VOLNAME> remove-objects <PATH> \fR
+Remove any inode limit configured on the specified directory. Note that if any limit is configured on the ancestors of this directory (previous directories along the path), they will still be honored and enforced.
+.TP
+\fB\ volume quota <VOLNAME> list <PATH> \fR
+Lists the usage and limits configured on directory(s). If a path is given only the limit that has been configured on the directory(if any) is displayed along with the directory's usage. If no path is given, usage and limits are displayed for all directories that has limits configured.
+.TP
+\fB\ volume quota <VOLNAME> list-objects <PATH> \fR
+Lists the inode usage and inode limits configured on directory(s). If a path is given only the limit that has been configured on the directory(if any) is displayed along with the directory's inode usage. If no path is given, usage and limits are displayed for all directories that has limits configured.
+.TP
+\fB\ volume quota <VOLNAME> default-soft-limit <PERCENT> \fR
+Set the percentage value for default soft limit for the volume.
+.TP
+\fB\ volume quota <VOLNAME> soft-timeout <TIME> \fR
+Set the soft timeout for the volume. The interval in which limits are retested before the soft limit is breached.
+.TP
+\fB\ volume quota <VOLNAME> hard-timeout <TIME> \fR
+Set the hard timeout for the volume. The interval in which limits are retested after the soft limit is breached.
+.TP
+\fB\ volume quota <VOLNAME> alert-time <TIME> \fR
+Set the frequency in which warning messages need to be logged (in the brick logs) once soft limit is breached.
+.TP
+NOTE: valid units of time and their symbols are : hours(h/hr), minutes(m/min), seconds(s/sec), weeks(w/wk), Days(d/days).
.SS "Geo-replication Commands"
.TP
\fI\ Note\fR: password-less ssh, from the master node (where these commands are executed) to the slave node <SLAVE_HOST>, is a prerequisite for the geo-replication commands.
--
1.8.3.1

View File

@ -1,353 +0,0 @@
From ea20e0a38c9f150d9e96076e04f4b77109e41663 Mon Sep 17 00:00:00 2001
From: Mohit Agrawal <moagrawa@redhat.com>
Date: Wed, 27 Sep 2017 11:37:28 +0530
Subject: [PATCH 091/128] extras: scripts to control CPU/MEMORY for any gluster
daemon during runtime
Problem: Sometime gluster daemons like glustershd can consume a lot of cpu and/
or memory if there is a large amount of data/ entries to be healed.
Solution: Until we have some form of throttling/ QoS mechanisms built into
gluster, we can use control groups for regulating cpu and memory of any gluster
daemon using control-cpu-load.sh and control-mem.sh scripts respectively.
Test: To test the control-cpu-load.sh script follow below procedure:
1) Setup distribute replica environment
2) Selfheal daemon off
3) Down one node from replica nodes
4) Create millions of files from mount point
5) Start down node
6) Check cpu usage for shd process in top command
7) Run script after provide shd pid with CPU quota value
8) Check again cpu usage for shd process in top command
Note: control-mem.sh script can cap the memory usage of the process to the set
limit, beyond which the process gets blocked. It resumes either when the memory
usage comes down or if the limit is increased.
> BUG: 1496335
> Change-Id: Id73c36b73ca600fa9f7905d84053d1e8633c996f
> Reviewed on https://review.gluster.org/#/c/18404
> (cherry picked from commit 2c066c4c365e77421d1009851144efae0b028628
BUG: 1484446
Change-Id: Id73c36b73ca600fa9f7905d84053d1e8633c996f
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124875
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
extras/Makefile.am | 6 ++-
extras/control-cpu-load.sh | 116 ++++++++++++++++++++++++++++++++++++++++
extras/control-mem.sh | 128 +++++++++++++++++++++++++++++++++++++++++++++
glusterfs.spec.in | 5 ++
4 files changed, 254 insertions(+), 1 deletion(-)
create mode 100755 extras/control-cpu-load.sh
create mode 100755 extras/control-mem.sh
diff --git a/extras/Makefile.am b/extras/Makefile.am
index 2812a4c..d9572ac 100644
--- a/extras/Makefile.am
+++ b/extras/Makefile.am
@@ -19,6 +19,10 @@ vol_DATA = glusterd.vol
scriptsdir = $(datadir)/glusterfs/scripts
scripts_SCRIPTS = post-upgrade-script-for-quota.sh \
pre-upgrade-script-for-quota.sh stop-all-gluster-processes.sh
+if USE_SYSTEMD
+scripts_SCRIPTS += control-cpu-load.sh
+scripts_SCRIPTS += control-mem.sh
+endif
EXTRA_DIST = $(conf_DATA) specgen.scm glusterfs-mode.el glusterfs.vim \
migrate-unify-to-distribute.sh backend-xattr-sanitize.sh backend-cleanup.sh \
@@ -26,7 +30,7 @@ EXTRA_DIST = $(conf_DATA) specgen.scm glusterfs-mode.el glusterfs.vim \
post-upgrade-script-for-quota.sh pre-upgrade-script-for-quota.sh \
command-completion/gluster.bash command-completion/Makefile \
command-completion/README stop-all-gluster-processes.sh clang-checker.sh \
- mount-shared-storage.sh
+ mount-shared-storage.sh control-cpu-load.sh control-mem.sh
install-data-local:
if [ -n "$(tmpfilesdir)" ]; then \
diff --git a/extras/control-cpu-load.sh b/extras/control-cpu-load.sh
new file mode 100755
index 0000000..b739c82
--- /dev/null
+++ b/extras/control-cpu-load.sh
@@ -0,0 +1,116 @@
+#!/bin/bash
+
+USAGE="This script provides a utility to control CPU utilization for any
+gluster daemon.In this, we use cgroup framework to configure CPU quota
+for a process(like selfheal daemon). Before running this script, make
+sure that daemon is running.Every time daemon restarts, it is required
+to rerun this command to set CPU quota on new daemon process id.
+User can enter any value between 10 to 100 for CPU quota.
+Recommended value of quota period is 25. 25 means, kernel will allocate
+25 ms period to this group of tasks in every 100 ms period. This 25ms
+could be considered as the maximum percentage of CPU quota daemon can take.
+This value will be reflected on CPU usage of "top" command.If provided pid
+is the only process and no other process is in competition to get CPU, more
+ than 25% could be allocated to daemon to speed up the process."
+
+if [ $# -ge 1 ]; then
+ case $1 in
+ -h|--help) echo " " "$USAGE" | sed -r -e 's/^[ ]+//g'
+ exit 0;
+ ;;
+ *) echo "Please Provide correct input for script."
+ echo "For help correct options are -h or --help."
+ exit 1;
+ ;;
+ esac
+fi
+
+DIR_EXIST=0
+LOC="/sys/fs/cgroup/cpu,cpuacct/system.slice/glusterd.service"
+echo "Enter gluster daemon pid for which you want to control CPU."
+read daemon_pid
+
+if expr ${daemon_pid} + 0 > /dev/null 2>&1 ;then
+ CHECK_PID=$(pgrep -f gluster | grep ${daemon_pid})
+ if [ -z "${CHECK_PID}" ]; then
+ echo "No daemon is running or pid ${daemon_pid} does not match."
+ echo "with running gluster processes."
+ exit 1
+ fi
+else
+ echo "Entered daemon_pid is not numeric so Rerun the script."
+ exit 1
+fi
+
+
+if [ -f ${LOC}/tasks ];then
+ CHECK_CGROUP=$(grep ${daemon_pid} ${LOC}/tasks)
+ if [ ${CHECK_CGROUP} ]; then
+ echo "pid ${daemon_pid} is attached with glusterd.service cgroup."
+ fi
+fi
+
+cgroup_name=cgroup_gluster_${daemon_pid}
+if [ -f ${LOC}/${cgroup_name}/tasks ]; then
+ CHECK_CGROUP=$(grep ${daemon_pid} ${LOC}/${cgroup_name}/tasks)
+ if [ ${CHECK_CGROUP} ]; then
+ val=`cat ${LOC}/${cgroup_name}/cpu.cfs_quota_us`
+ qval=$((val / 1000))
+ echo "pid ${daemon_pid} is already attached ${cgroup_name} with quota value ${qval}."
+ echo "Press n if you don't want to reassign ${daemon_pid} with new quota value."
+ DIR_EXIST=1
+ else
+ echo "pid ${daemon_pid} is not attached with ${cgroup_name}."
+ fi
+fi
+
+read -p "If you want to continue the script to attach ${daemon_pid} with new ${cgroup_name} cgroup Press (y/n)?" choice
+case "$choice" in
+ y|Y ) echo "yes";;
+ n|N ) echo "no";exit;;
+ * ) echo "invalid";exit;;
+esac
+
+systemctl set-property glusterd.service CPUShares=1024
+
+if [ ${DIR_EXIST} -eq 0 ];then
+ echo "Creating child cgroup directory '${cgroup_name} cgroup' for glusterd.service."
+ mkdir -p ${LOC}/${cgroup_name}
+ if [ ! -f ${LOC}/${cgroup_name}/tasks ];then
+ echo "Not able to create ${cgroup_name} directory so exit."
+ exit 1
+ fi
+fi
+
+echo "Enter quota value in range [10,100]: "
+
+read quota_value
+if expr ${quota_value} + 0 > /dev/null 2>&1 ;then
+ if [ ${quota_value} -lt 10 ] || [ ${quota_value} -gt 100 ]; then
+ echo "Entered quota value is not correct,it should be in the range ."
+ echo "10-100. Ideal value is 25."
+ echo "Rerun the sript with correct value."
+ exit 1
+ else
+ echo "Entered quota value is $quota_value"
+ fi
+else
+ echo "Entered quota value is not numeric so Rerun the script."
+ exit 1
+fi
+
+quota_value=$((quota_value * 1000))
+echo "Setting $quota_value to cpu.cfs_quota_us for gluster_cgroup."
+echo ${quota_value} > ${LOC}/${cgroup_name}/cpu.cfs_quota_us
+
+if ps -T -p ${daemon_pid} | grep gluster > /dev/null; then
+ for thid in `ps -T -p ${daemon_pid} | grep gluster | awk -F " " '{print $2}'`;
+ do
+ echo ${thid} > ${LOC}/${cgroup_name}/tasks ;
+ done
+ if cat /proc/${daemon_pid}/cgroup | grep -w ${cgroup_name} > /dev/null; then
+ echo "Tasks are attached successfully specific to ${daemon_pid} to ${cgroup_name}."
+ else
+ echo "Tasks are not attached successfully."
+ fi
+fi
diff --git a/extras/control-mem.sh b/extras/control-mem.sh
new file mode 100755
index 0000000..38aa2a0
--- /dev/null
+++ b/extras/control-mem.sh
@@ -0,0 +1,128 @@
+#!/bin/bash
+
+USAGE="This commands provides a utility to control MEMORY utilization for any
+gluster daemon.In this, we use cgroup framework to configure MEMORY limit for
+a process. Before running this script, make sure that daemon is running.Every
+time daemon restarts, it is required to rerun this command to set memory limit
+(in bytes) on new daemon process id.User can enter any value between 100
+(in Mega bytes) to 8000000000000 for Memory limit in Mega bytes.
+Memory limit value is depends on how much maximum memory user wants to restrict
+for specific daemon process.If a process will try to consume memore more than
+configured value then cgroup will hang/sleep this task and to resume the task
+rerun the script with new increase memory limit value ."
+
+if [ $# -ge 1 ]; then
+ case $1 in
+ -h|--help) echo " " "$USAGE" | sed -r -e 's/^[ ]+//g'
+ exit 0;
+ ;;
+ *) echo "Please Provide correct input for script."
+ echo "For help correct options are -h of --help."
+ exit 1;
+ ;;
+ esac
+fi
+
+DIR_EXIST=0
+LOC="/sys/fs/cgroup/memory/system.slice/glusterd.service"
+echo "Enter Any gluster daemon pid for that you want to control MEMORY."
+read daemon_pid
+
+if expr ${daemon_pid} + 0 > /dev/null 2>&1 ;then
+ CHECK_PID=$(pgrep -f gluster | grep ${daemon_pid})
+ if [ -z "${CHECK_PID}" ]; then
+ echo "No daemon is running or pid ${daemon_pid} does not match."
+ echo "with running gluster processes."
+ exit 1
+ fi
+else
+ echo "Entered daemon_pid is not numeric so Rerun the script."
+ exit 1
+fi
+
+
+if [ -f ${LOC}/tasks ]; then
+ CHECK_CGROUP=$(grep ${daemon_pid} ${LOC}/tasks)
+ if [ ${CHECK_CGROUP} ] ;then
+ echo "pid ${daemon_pid} is attached with default glusterd.service cgroup."
+ fi
+fi
+
+cgroup_name=cgroup_gluster_${daemon_pid}
+if [ -f ${LOC}/${cgroup_name}/tasks ];then
+ CHECK_CGROUP=$(grep ${daemon_pid} ${LOC}/${cgroup_name}/tasks)
+ if [ ${CHECK_CGROUP} ]; then
+ val=`cat ${LOC}/${cgroup_name}/memory.limit_in_bytes`
+ mval=$((val / 1024 / 1024))
+ echo "pid ${daemon_pid} is already attached ${cgroup_name} with mem value ${mval}."
+ echo "Press n if you don't want to reassign ${daemon_pid} with new mem value."
+ DIR_EXIST=1
+ else
+ echo "pid ${daemon_pid} is not attached with ${cgroup_name}."
+ fi
+fi
+
+read -p "If you want to continue the script to attach daeomon with new cgroup. Press (y/n)?" choice
+case "$choice" in
+ y|Y ) echo "yes";;
+ n|N ) echo "no";exit;;
+ * ) echo "invalid";exit;;
+esac
+
+systemctl set-property glusterd.service CPUShares=1024
+
+if [ ${DIR_EXIST} -eq 0 ];then
+ echo "Creating child cgroup directory '${cgroup_name} cgroup' for glusterd.service."
+ mkdir -p ${LOC}/${cgroup_name}
+ if [ ! -f ${LOC}/${cgroup_name}/tasks ];then
+ echo "Not able to create ${LOC}/${cgroup_name} directory so exit."
+ exit 1
+ fi
+fi
+
+echo "Enter Memory value in Mega bytes [100,8000000000000]: "
+
+read mem_value
+if expr ${mem_value} + 0 > /dev/null 2>&1 ;then
+ if [ ${mem_value} -lt 100 ] || [ ${mem_value} -gt 8000000000000 ]; then
+ echo "Entered memory value is not correct,it should be in the range ."
+ echo "100-8000000000000, Rerun the script with correct value ."
+ exit 1
+ else
+ echo "Entered memory limit value is ${mem_value}."
+ fi
+else
+ echo "Entered memory value is not numeric so Rerun the script."
+ exit 1
+fi
+
+mem_value=$(($mem_value * 1024 * 1024))
+if [ ${DIR_EXIST} -eq 0 ];then
+ echo "Setting ${mem_value} to memory.limit_in_bytes for ${LOC}/${cgroup_name}."
+ echo ${mem_value} > ${LOC}/${cgroup_name}/memory.limit_in_bytes
+ #Set memory value to memory.memsw.limit_in_bytes
+ echo ${mem_value} > ${LOC}/${cgroup_name}/memory.memsw.limit_in_bytes
+ # disable oom_control so that kernel will not send kill signal to the
+ # task once limit has reached
+ echo 1 > ${LOC}/${cgroup_name}/memory.oom_control
+else
+ #Increase mem_value to memory.memsw.limit_in_bytes
+ echo ${mem_value} > ${LOC}/${cgroup_name}/memory.memsw.limit_in_bytes
+ echo "Increase ${mem_value} to memory.limit_in_bytes for ${LOC}/${cgroup_name}."
+ echo ${mem_value} > ${LOC}/${cgroup_name}/memory.limit_in_bytes
+ # disable oom_control so that kernel will not send kill signal to the
+ # task once limit has reached
+ echo 1 > ${LOC}/${cgroup_name}/memory.oom_control
+fi
+
+if ps -T -p ${daemon_pid} | grep gluster > /dev/null; then
+ for thid in `ps -T -p ${daemon_pid} | grep gluster | awk -F " " '{print $2}'`;
+ do
+ echo ${thid} > ${LOC}/${cgroup_name}/tasks ;
+ done
+ if cat /proc/${daemon_pid}/cgroup | grep -iw ${cgroup_name} > /dev/null; then
+ echo "Tasks are attached successfully specific to ${daemon_pid} to ${cgroup_name}."
+ else
+ echo "Tasks are not attached successfully."
+ fi
+fi
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index da8a3e5..56a62a9 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1553,6 +1553,8 @@ exit 0
%{_datadir}/glusterfs/scripts/stop-all-gluster-processes.sh
%if ( 0%{?_with_systemd:1} )
%{_libexecdir}/glusterfs/mount-shared-storage.sh
+ %{_datadir}/glusterfs/scripts/control-cpu-load.sh
+ %{_datadir}/glusterfs/scripts/control-mem.sh
%endif
# Incrementalapi
@@ -2178,6 +2180,9 @@ fi
%endif
%changelog
+* Fri Dec 01 2017 Mohit Agrawal <moagrawa@redhat.com>
+- Added control-cpu-load.sh and control-mem.sh scripts to glusterfs-server section(#1484446)
+
* Mon Nov 13 2017 Jiffin Tony Thottan <jthottan@redhat.com>
- Adding ganesha bits back in gluster repository #1499784
--
1.8.3.1

View File

@ -1,533 +0,0 @@
From 3b1c45188c7260ae3dda4bcedd7cb81566f1f2ea Mon Sep 17 00:00:00 2001
From: Mohit Agrawal <moagrawa@redhat.com>
Date: Sat, 15 Jul 2017 17:55:14 +0530
Subject: [PATCH 092/128] posix: Needs to reserve disk space to prevent the
brick from getting full
Problem: Currently there is no option available at posix xlator to save the
disk from getting full
Solution: Introduce a new option storage.reserve at posix xlator to
configure disk threshold.posix xlator spawn a thread to update the
disk space status in posix private structure and same flag is checked
by every posix fop before start operation.If flag value is 1 then
it sets op_errno to ENOSPC and goto out from the fop.
> BUG: 1471366
> Change-Id: I98287cd409860f4c754fc69a332e0521bfb1b67e
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
> Reviewed-on: https://review.gluster.org/17780
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Amar Tumballi <amarts@redhat.com>
> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
BUG: 1464350
Change-Id: I98287cd409860f4c754fc69a332e0521bfb1b67e
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124629
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 4 +
xlators/storage/posix/src/posix-aio.c | 1 +
xlators/storage/posix/src/posix-helpers.c | 115 ++++++++++++++++++++++++
xlators/storage/posix/src/posix-messages.h | 11 ++-
xlators/storage/posix/src/posix.c | 80 +++++++++++++++--
xlators/storage/posix/src/posix.h | 19 ++++
6 files changed, 222 insertions(+), 8 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index b15a5af..a57eb9e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -2805,6 +2805,10 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.voltype = "storage/posix",
.op_version = GD_OP_VERSION_3_12_0,
},
+ { .key = "storage.reserve",
+ .voltype = "storage/posix",
+ .op_version = GD_OP_VERSION_3_13_0,
+ },
{ .key = "storage.bd-aio",
.voltype = "storage/bd",
.op_version = GD_OP_VERSION_RHS_3_0
diff --git a/xlators/storage/posix/src/posix-aio.c b/xlators/storage/posix/src/posix-aio.c
index b5ac1b9..2adafeb 100644
--- a/xlators/storage/posix/src/posix-aio.c
+++ b/xlators/storage/posix/src/posix-aio.c
@@ -330,6 +330,7 @@ posix_aio_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
VALIDATE_OR_GOTO (fd, err);
priv = this->private;
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_errno, op_errno, err);
ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
if (ret < 0) {
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index f97c90b..826441f 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -1977,6 +1977,121 @@ unlock:
UNLOCK (&priv->lock);
}
+void
+posix_disk_space_check (xlator_t *this)
+{
+ struct posix_private *priv = NULL;
+ char *subvol_path = NULL;
+ int op_ret = 0;
+ int percent = 0;
+ struct statvfs buf = {0};
+ uint64_t totsz = 0;
+ uint64_t freesz = 0;
+
+ GF_VALIDATE_OR_GOTO (this->name, this, out);
+ priv = this->private;
+ GF_VALIDATE_OR_GOTO ("posix-helpers", priv, out);
+
+ subvol_path = priv->base_path;
+ percent = priv->disk_threshhold;
+
+ op_ret = sys_statvfs (subvol_path, &buf);
+
+ if (op_ret == -1) {
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_STATVFS_FAILED,
+ "statvfs failed on %s", subvol_path);
+ goto out;
+ }
+ totsz = (buf.f_blocks * buf.f_bsize);
+ freesz = (buf.f_bfree * buf.f_bsize);
+
+ if (freesz <= ((totsz * percent) / 100)) {
+ priv->disk_space_full = 1;
+ } else {
+ priv->disk_space_full = 0;
+ }
+out:
+ return;
+}
+
+
+static void *
+posix_disk_space_check_thread_proc (void *data)
+{
+ xlator_t *this = NULL;
+ struct posix_private *priv = NULL;
+ uint32_t interval = 0;
+ int ret = -1;
+
+ this = data;
+ priv = this->private;
+
+ interval = 5;
+ gf_msg_debug (this->name, 0, "disk-space thread started, "
+ "interval = %d seconds", interval);
+ while (1) {
+ /* aborting sleep() is a request to exit this thread, sleep()
+ * will normally not return when cancelled */
+ ret = sleep (interval);
+ if (ret > 0)
+ break;
+ /* prevent thread errors while doing the health-check(s) */
+ pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL);
+
+ /* Do the disk-check.*/
+ posix_disk_space_check (this);
+ if (!priv->disk_space_check_active)
+ goto out;
+ pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
+ }
+
+out:
+ gf_msg_debug (this->name, 0, "disk space check thread exiting");
+ LOCK (&priv->lock);
+ {
+ priv->disk_space_check_active = _gf_false;
+ }
+ UNLOCK (&priv->lock);
+
+
+ return NULL;
+}
+
+void
+posix_spawn_disk_space_check_thread (xlator_t *xl)
+{
+ struct posix_private *priv = NULL;
+ int ret = -1;
+
+ priv = xl->private;
+
+ LOCK (&priv->lock);
+ {
+ /* cancel the running thread */
+ if (priv->disk_space_check_active == _gf_true) {
+ pthread_cancel (priv->disk_space_check);
+ priv->disk_space_check_active = _gf_false;
+ }
+
+ ret = gf_thread_create (&priv->disk_space_check, NULL,
+ posix_disk_space_check_thread_proc,
+ xl, "posix_reserve");
+ if (ret < 0) {
+ priv->disk_space_check_active = _gf_false;
+ gf_msg (xl->name, GF_LOG_ERROR, errno,
+ P_MSG_DISK_SPACE_CHECK_FAILED,
+ "unable to setup disk space check thread");
+ goto unlock;
+ }
+
+ /* run the thread detached, resources will be freed on exit */
+ pthread_detach (priv->disk_space_check);
+ priv->disk_space_check_active = _gf_true;
+ }
+unlock:
+ UNLOCK (&priv->lock);
+}
+
int
posix_fsyncer_pick (xlator_t *this, struct list_head *head)
{
diff --git a/xlators/storage/posix/src/posix-messages.h b/xlators/storage/posix/src/posix-messages.h
index ee06d6f..20cf1f0 100644
--- a/xlators/storage/posix/src/posix-messages.h
+++ b/xlators/storage/posix/src/posix-messages.h
@@ -45,7 +45,7 @@
*/
#define POSIX_COMP_BASE GLFS_MSGID_COMP_POSIX
-#define GLFS_NUM_MESSAGES 110
+#define GLFS_NUM_MESSAGES 111
#define GLFS_MSGID_END (POSIX_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
#define glfs_msg_start_x POSIX_COMP_BASE, "Invalid: Start of messages"
@@ -955,6 +955,15 @@
*/
+#define P_MSG_DISK_SPACE_CHECK_FAILED (POSIX_COMP_BASE + 112)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index d858878..1cb0fef 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -766,6 +766,7 @@ posix_do_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd,
struct posix_fd *pfd = NULL;
gf_boolean_t locked = _gf_false;
posix_inode_ctx_t *ctx = NULL;
+ struct posix_private *priv = NULL;
DECLARE_OLD_FS_ID_VAR;
@@ -775,6 +776,9 @@ posix_do_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd,
VALIDATE_OR_GOTO (this, out);
VALIDATE_OR_GOTO (fd, out);
+ priv = this->private;
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, ret, ret, out);
+
ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
if (ret < 0) {
gf_msg_debug (this->name, 0, "pfd is NULL from fd=%p", fd);
@@ -1073,20 +1077,27 @@ posix_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
int32_t ret = 0;
struct iatt statpre = {0,};
struct iatt statpost = {0,};
+ struct posix_private *priv = NULL;
+ int op_ret = -1;
+ int op_errno = -1;
+
+ VALIDATE_OR_GOTO (frame, out);
+ VALIDATE_OR_GOTO (this, out);
+
+ priv = this->private;
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
ret = posix_do_zerofill (frame, this, fd, offset, len,
&statpre, &statpost, xdata);
- if (ret < 0) {
- goto err;
- }
+ if (ret < 0)
+ goto out;
STACK_UNWIND_STRICT(zerofill, frame, 0, 0, &statpre, &statpost, NULL);
return 0;
-err:
- STACK_UNWIND_STRICT(zerofill, frame, -1, -ret, NULL, NULL, NULL);
+out:
+ STACK_UNWIND_STRICT(zerofill, frame, op_ret, op_errno, NULL, NULL, NULL);
return 0;
-
}
static int32_t
@@ -1354,6 +1365,7 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (priv, out);
GFID_NULL_CHECK_AND_GOTO (frame, this, loc, xdata, op_ret, op_errno,
out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, NULL);
@@ -1574,6 +1586,7 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (priv, out);
GFID_NULL_CHECK_AND_GOTO (frame, this, loc, xdata, op_ret, op_errno,
out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, NULL);
if (!real_path || !par_path) {
@@ -2400,6 +2413,7 @@ posix_symlink (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (priv, out);
GFID_NULL_CHECK_AND_GOTO (frame, this, loc, xdata, op_ret, op_errno,
out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, &stbuf);
@@ -2558,6 +2572,7 @@ posix_rename (call_frame_t *frame, xlator_t *this,
priv = this->private;
VALIDATE_OR_GOTO (priv, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
MAKE_ENTRY_HANDLE (real_oldpath, par_oldpath, this, oldloc, NULL);
@@ -2840,6 +2855,7 @@ posix_link (call_frame_t *frame, xlator_t *this,
priv = this->private;
VALIDATE_OR_GOTO (priv, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
MAKE_INODE_HANDLE (real_oldpath, this, oldloc, &stbuf);
@@ -3049,6 +3065,7 @@ posix_create (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (priv, out);
GFID_NULL_CHECK_AND_GOTO (frame, this, loc, xdata, op_ret, op_errno,
out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, &stbuf);
@@ -3236,6 +3253,9 @@ posix_open (call_frame_t *frame, xlator_t *this,
priv = this->private;
VALIDATE_OR_GOTO (priv, out);
+ if (flags & O_CREAT)
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+
MAKE_INODE_HANDLE (real_path, this, loc, &stbuf);
if (!real_path) {
op_ret = -1;
@@ -3559,6 +3579,7 @@ posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
priv = this->private;
VALIDATE_OR_GOTO (priv, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
if (ret < 0) {
@@ -3698,6 +3719,7 @@ posix_statfs (call_frame_t *frame, xlator_t *this,
struct statvfs buf = {0, };
struct posix_private * priv = NULL;
int shared_by = 1;
+ int percent = 0;
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
@@ -3722,6 +3744,9 @@ posix_statfs (call_frame_t *frame, xlator_t *this,
goto out;
}
+ percent = priv->disk_threshhold;
+ buf.f_bfree = (buf.f_bfree - ((buf.f_blocks * percent) / 100));
+
shared_by = priv->shared_brick_count;
if (shared_by > 1) {
buf.f_blocks /= shared_by;
@@ -3879,6 +3904,7 @@ posix_fsync (call_frame_t *frame, xlator_t *this,
#endif
priv = this->private;
+
if (priv->batch_fsync_mode && xdata && dict_get (xdata, "batch-fsync")) {
posix_batch_fsync (frame, this, fd, datasync, xdata);
return 0;
@@ -3983,6 +4009,7 @@ posix_setxattr (call_frame_t *frame, xlator_t *this,
ssize_t acl_size = 0;
dict_t *xattr = NULL;
posix_xattr_filler_t filler = {0,};
+ struct posix_private *priv = NULL;
DECLARE_OLD_FS_ID_VAR;
SET_FS_ID (frame->root->uid, frame->root->gid);
@@ -3992,6 +4019,9 @@ posix_setxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (loc, out);
VALIDATE_OR_GOTO (dict, out);
+ priv = this->private;
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+
MAKE_INODE_HANDLE (real_path, this, loc, NULL);
if (!real_path) {
op_ret = -1;
@@ -5346,6 +5376,7 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this,
struct iatt stbuf = {0,};
dict_t *xattr = NULL;
posix_xattr_filler_t filler = {0,};
+ struct posix_private *priv = NULL;
DECLARE_OLD_FS_ID_VAR;
SET_FS_ID (frame->root->uid, frame->root->gid);
@@ -5355,6 +5386,9 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (fd, out);
VALIDATE_OR_GOTO (dict, out);
+ priv = this->private;
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+
ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
if (ret < 0) {
gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
@@ -6018,11 +6052,17 @@ do_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
dict_t *xattr_rsp = NULL;
dict_t *xdata_rsp = NULL;
struct iatt stbuf = {0};
+ struct posix_private *priv = NULL;
+
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (xattr, out);
VALIDATE_OR_GOTO (this, out);
+ priv = this->private;
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+
+
if (fd) {
op_ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
if (op_ret < 0) {
@@ -6120,7 +6160,6 @@ posix_fxattrop (call_frame_t *frame, xlator_t *this,
return 0;
}
-
int
posix_access (call_frame_t *frame, xlator_t *this,
loc_t *loc, int32_t mask, dict_t *xdata)
@@ -6944,6 +6983,11 @@ notify (xlator_t *this,
pthread_cancel (priv->health_check);
priv->health_check = 0;
}
+ if (priv->disk_space_check) {
+ priv->disk_space_check_active = _gf_false;
+ pthread_cancel (priv->disk_space_check);
+ priv->disk_space_check = 0;
+ }
if (priv->janitor) {
(void) gf_thread_cleanup_xint (priv->janitor);
priv->janitor = 0;
@@ -7140,6 +7184,11 @@ reconfigure (xlator_t *this, dict_t *options)
" fallback to <hostname>:<export>");
}
+ GF_OPTION_RECONF ("reserve", priv->disk_threshhold,
+ options, uint32, out);
+ if (priv->disk_threshhold)
+ posix_spawn_disk_space_check_thread (this);
+
GF_OPTION_RECONF ("health-check-interval", priv->health_check_interval,
options, uint32, out);
posix_spawn_health_check_thread (this);
@@ -7738,6 +7787,13 @@ init (xlator_t *this)
" fallback to <hostname>:<export>");
}
+ _private->disk_space_check_active = _gf_false;
+ _private->disk_space_full = 0;
+ GF_OPTION_INIT ("reserve",
+ _private->disk_threshhold, uint32, out);
+ if (_private->disk_threshhold)
+ posix_spawn_disk_space_check_thread (this);
+
_private->health_check_active = _gf_false;
GF_OPTION_INIT ("health-check-interval",
_private->health_check_interval, uint32, out);
@@ -7940,6 +7996,16 @@ struct volume_options options[] = {
.description = "Interval in seconds for a filesystem health check, "
"set to 0 to disable"
},
+ {
+ .key = {"reserve"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = 0,
+ .default_value = "1",
+ .validate = GF_OPT_VALIDATE_MIN,
+ .description = "Value in percentage in integer form required "
+ "to set reserve disk, "
+ "set to 0 to disable"
+ },
{ .key = {"batch-fsync-mode"},
.type = GF_OPTION_TYPE_STR,
.default_value = "reverse-fsync",
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index c2dcfda..21c7d36 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -63,6 +63,18 @@
#define GF_UNLINK_TRUE 0x0000000000000001
#define GF_UNLINK_FALSE 0x0000000000000000
+#define DISK_SPACE_CHECK_AND_GOTO(frame, priv, op_ret, op_errno, out) do { \
+ if (frame->root->pid >= 0 && priv->disk_space_full) { \
+ op_ret = -1; \
+ op_errno = ENOSPC; \
+ gf_msg_debug ("posix", ENOSPC, \
+ "disk space utilization reached limits" \
+ " for path %s ", priv->base_path); \
+ goto out; \
+ } \
+ } while (0)
+
+
/**
* posix_fd - internal structure common to file and directory fd's
*/
@@ -197,6 +209,11 @@ struct posix_private {
pthread_t health_check;
gf_boolean_t health_check_active;
+ uint32_t disk_threshhold;
+ uint32_t disk_space_full;
+ pthread_t disk_space_check;
+ gf_boolean_t disk_space_check_active;
+
#ifdef GF_DARWIN_HOST_OS
enum {
XATTR_NONE = 0,
@@ -304,6 +321,8 @@ __posix_fd_set_odirect (fd_t *fd, struct posix_fd *pfd, int opflags,
off_t offset, size_t size);
void posix_spawn_health_check_thread (xlator_t *this);
+void posix_spawn_disk_space_check_thread (xlator_t *this);
+
void *posix_fsyncer (void *);
int
posix_get_ancestry (xlator_t *this, inode_t *leaf_inode,
--
1.8.3.1

View File

@ -1,324 +0,0 @@
From 9ced91d6064b0cdea9090fe6ebddbf36a492b585 Mon Sep 17 00:00:00 2001
From: Mohit Agrawal <moagrawa@redhat.com>
Date: Sat, 15 Jul 2017 17:55:14 +0530
Subject: [PATCH 093/128] posix: Ignore disk space reserve check for internal
FOPS
Problem: Currently disk space reserve check is applicable for internal FOP
also it needs to be ignore for internal FOP.
Solution: Update the DISK_SPACE_CHECK_AND_GOTO macro at posix component.
Macro will call only while key "GLUSTERFS_INTERNAL_FOP_KEY"
exists in xdata.
> BUG: 1506083
> Change-Id: I2b0840bbf4fa14bc247855b024ca136773d68d16
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
> Reviwed on https://review.gluster.org/#/c/18567
> (cherry picked from commit a320f2021ee4dcab85483dbe10d85e797bd6b3b4)
BUG: 1464350
Change-Id: I2b0840bbf4fa14bc247855b024ca136773d68d16
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124878
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/storage/posix/src/posix-aio.c | 2 +-
xlators/storage/posix/src/posix-helpers.c | 12 +++----
xlators/storage/posix/src/posix-messages.h | 2 +-
xlators/storage/posix/src/posix.c | 52 ++++++++++++++++--------------
xlators/storage/posix/src/posix.h | 7 ++--
5 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/xlators/storage/posix/src/posix-aio.c b/xlators/storage/posix/src/posix-aio.c
index 2adafeb..47460bc 100644
--- a/xlators/storage/posix/src/posix-aio.c
+++ b/xlators/storage/posix/src/posix-aio.c
@@ -330,7 +330,7 @@ posix_aio_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
VALIDATE_OR_GOTO (fd, err);
priv = this->private;
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_errno, op_errno, err);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_errno, op_errno, err);
ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
if (ret < 0) {
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 826441f..77affc4 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -1990,10 +1990,10 @@ posix_disk_space_check (xlator_t *this)
GF_VALIDATE_OR_GOTO (this->name, this, out);
priv = this->private;
- GF_VALIDATE_OR_GOTO ("posix-helpers", priv, out);
+ GF_VALIDATE_OR_GOTO (this->name, priv, out);
subvol_path = priv->base_path;
- percent = priv->disk_threshhold;
+ percent = priv->disk_reserve;
op_ret = sys_statvfs (subvol_path, &buf);
@@ -2073,9 +2073,9 @@ posix_spawn_disk_space_check_thread (xlator_t *xl)
priv->disk_space_check_active = _gf_false;
}
- ret = gf_thread_create (&priv->disk_space_check, NULL,
- posix_disk_space_check_thread_proc,
- xl, "posix_reserve");
+ ret = gf_thread_create_detached (&priv->disk_space_check,
+ posix_disk_space_check_thread_proc,
+ xl, "posix_reserve");
if (ret < 0) {
priv->disk_space_check_active = _gf_false;
gf_msg (xl->name, GF_LOG_ERROR, errno,
@@ -2084,8 +2084,6 @@ posix_spawn_disk_space_check_thread (xlator_t *xl)
goto unlock;
}
- /* run the thread detached, resources will be freed on exit */
- pthread_detach (priv->disk_space_check);
priv->disk_space_check_active = _gf_true;
}
unlock:
diff --git a/xlators/storage/posix/src/posix-messages.h b/xlators/storage/posix/src/posix-messages.h
index 20cf1f0..fbae4d8 100644
--- a/xlators/storage/posix/src/posix-messages.h
+++ b/xlators/storage/posix/src/posix-messages.h
@@ -45,7 +45,7 @@
*/
#define POSIX_COMP_BASE GLFS_MSGID_COMP_POSIX
-#define GLFS_NUM_MESSAGES 111
+#define GLFS_NUM_MESSAGES 112
#define GLFS_MSGID_END (POSIX_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
#define glfs_msg_start_x POSIX_COMP_BASE, "Invalid: Start of messages"
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 1cb0fef..d0433ec 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -777,7 +777,7 @@ posix_do_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd,
VALIDATE_OR_GOTO (fd, out);
priv = this->private;
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, ret, ret, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, ret, ret, out);
ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
if (ret < 0) {
@@ -824,6 +824,8 @@ out:
locked = _gf_false;
}
SET_TO_OLD_FS_ID ();
+ if (ret == ENOSPC)
+ ret = -ENOSPC;
return ret;
}
@@ -1079,18 +1081,21 @@ posix_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
struct iatt statpost = {0,};
struct posix_private *priv = NULL;
int op_ret = -1;
- int op_errno = -1;
+ int op_errno = -EINVAL;
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
priv = this->private;
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
ret = posix_do_zerofill (frame, this, fd, offset, len,
&statpre, &statpost, xdata);
- if (ret < 0)
+ if (ret < 0) {
+ op_ret = -1;
+ op_errno = -ret;
goto out;
+ }
STACK_UNWIND_STRICT(zerofill, frame, 0, 0, &statpre, &statpost, NULL);
return 0;
@@ -1365,13 +1370,12 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (priv, out);
GFID_NULL_CHECK_AND_GOTO (frame, this, loc, xdata, op_ret, op_errno,
out);
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
-
MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, NULL);
gid = frame->root->gid;
SET_FS_ID (frame->root->uid, gid);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
if (!real_path || !par_path) {
op_ret = -1;
@@ -1586,7 +1590,7 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (priv, out);
GFID_NULL_CHECK_AND_GOTO (frame, this, loc, xdata, op_ret, op_errno,
out);
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, NULL);
if (!real_path || !par_path) {
@@ -2413,7 +2417,7 @@ posix_symlink (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (priv, out);
GFID_NULL_CHECK_AND_GOTO (frame, this, loc, xdata, op_ret, op_errno,
out);
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, &stbuf);
@@ -2572,7 +2576,7 @@ posix_rename (call_frame_t *frame, xlator_t *this,
priv = this->private;
VALIDATE_OR_GOTO (priv, out);
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
MAKE_ENTRY_HANDLE (real_oldpath, par_oldpath, this, oldloc, NULL);
@@ -2855,7 +2859,7 @@ posix_link (call_frame_t *frame, xlator_t *this,
priv = this->private;
VALIDATE_OR_GOTO (priv, out);
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
MAKE_INODE_HANDLE (real_oldpath, this, oldloc, &stbuf);
@@ -3065,7 +3069,7 @@ posix_create (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (priv, out);
GFID_NULL_CHECK_AND_GOTO (frame, this, loc, xdata, op_ret, op_errno,
out);
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
MAKE_ENTRY_HANDLE (real_path, par_path, this, loc, &stbuf);
@@ -3254,7 +3258,7 @@ posix_open (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (priv, out);
if (flags & O_CREAT)
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
MAKE_INODE_HANDLE (real_path, this, loc, &stbuf);
if (!real_path) {
@@ -3579,7 +3583,7 @@ posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
priv = this->private;
VALIDATE_OR_GOTO (priv, out);
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
if (ret < 0) {
@@ -3744,7 +3748,7 @@ posix_statfs (call_frame_t *frame, xlator_t *this,
goto out;
}
- percent = priv->disk_threshhold;
+ percent = priv->disk_reserve;
buf.f_bfree = (buf.f_bfree - ((buf.f_blocks * percent) / 100));
shared_by = priv->shared_brick_count;
@@ -4020,7 +4024,7 @@ posix_setxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (dict, out);
priv = this->private;
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
MAKE_INODE_HANDLE (real_path, this, loc, NULL);
if (!real_path) {
@@ -5387,7 +5391,7 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (dict, out);
priv = this->private;
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
if (ret < 0) {
@@ -6060,8 +6064,7 @@ do_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
VALIDATE_OR_GOTO (this, out);
priv = this->private;
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, op_ret, op_errno, out);
-
+ DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
if (fd) {
op_ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
@@ -7184,9 +7187,9 @@ reconfigure (xlator_t *this, dict_t *options)
" fallback to <hostname>:<export>");
}
- GF_OPTION_RECONF ("reserve", priv->disk_threshhold,
+ GF_OPTION_RECONF ("reserve", priv->disk_reserve,
options, uint32, out);
- if (priv->disk_threshhold)
+ if (priv->disk_reserve)
posix_spawn_disk_space_check_thread (this);
GF_OPTION_RECONF ("health-check-interval", priv->health_check_interval,
@@ -7790,8 +7793,8 @@ init (xlator_t *this)
_private->disk_space_check_active = _gf_false;
_private->disk_space_full = 0;
GF_OPTION_INIT ("reserve",
- _private->disk_threshhold, uint32, out);
- if (_private->disk_threshhold)
+ _private->disk_reserve, uint32, out);
+ if (_private->disk_reserve)
posix_spawn_disk_space_check_thread (this);
_private->health_check_active = _gf_false;
@@ -8002,9 +8005,8 @@ struct volume_options options[] = {
.min = 0,
.default_value = "1",
.validate = GF_OPT_VALIDATE_MIN,
- .description = "Value in percentage in integer form required "
- "to set reserve disk, "
- "set to 0 to disable"
+ .description = "Percentage of disk space to be reserved."
+ " Set to 0 to disable"
},
{ .key = {"batch-fsync-mode"},
.type = GF_OPTION_TYPE_STR,
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index 21c7d36..777adac 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -63,8 +63,9 @@
#define GF_UNLINK_TRUE 0x0000000000000001
#define GF_UNLINK_FALSE 0x0000000000000000
-#define DISK_SPACE_CHECK_AND_GOTO(frame, priv, op_ret, op_errno, out) do { \
- if (frame->root->pid >= 0 && priv->disk_space_full) { \
+#define DISK_SPACE_CHECK_AND_GOTO(frame, priv, xdata, op_ret, op_errno, out) do { \
+ if (frame->root->pid >= 0 && priv->disk_space_full && \
+ !dict_get (xdata, GLUSTERFS_INTERNAL_FOP_KEY)) { \
op_ret = -1; \
op_errno = ENOSPC; \
gf_msg_debug ("posix", ENOSPC, \
@@ -209,7 +210,7 @@ struct posix_private {
pthread_t health_check;
gf_boolean_t health_check_active;
- uint32_t disk_threshhold;
+ uint32_t disk_reserve;
uint32_t disk_space_full;
pthread_t disk_space_check;
gf_boolean_t disk_space_check_active;
--
1.8.3.1

View File

@ -1,675 +0,0 @@
From 46a4c05ce998a72a006f79ddac4e1ad2384e66bb Mon Sep 17 00:00:00 2001
From: Pranith Kumar K <pkarampu@redhat.com>
Date: Mon, 4 Sep 2017 16:57:25 +0530
Subject: [PATCH 094/128] cluster/afr: Fail open on split-brain
Problem:
Append on a file with split-brain succeeds. Open is intercepted by open-behind,
when write comes on the file, open-behind does open+write. Open succeeds
because afr doesn't fail it. Then write succeeds because write-behind
intercepts it. Flush is also intercepted by write-behind, so the application
never gets to know that the write failed.
Fix:
Fail open on split-brain, so that when open-behind does open+write open fails
which leads to write failure. Application will know about this failure.
> Change-Id: I4bff1c747c97bb2925d6987f4ced5f1ce75dbc15
> BUG: 1294051
> Upstream-patch: https://review.gluster.org/13075
> Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Change-Id: I4bff1c747c97bb2925d6987f4ced5f1ce75dbc15
BUG: 1277924
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124882
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Ravishankar Narayanankutty <ravishankar@redhat.com>
---
tests/basic/afr/split-brain-open.t | 38 ++++++++++
tests/bugs/nfs/bug-974972.t | 1 +
xlators/cluster/afr/src/afr-common.c | 77 ++++++++++++++++++--
xlators/cluster/afr/src/afr-inode-write.c | 2 +-
xlators/cluster/afr/src/afr-open.c | 93 +++++++++++++++++-------
xlators/cluster/afr/src/afr-self-heal-common.c | 11 ++-
xlators/cluster/afr/src/afr-self-heal-data.c | 58 ++++++++++++++-
xlators/cluster/afr/src/afr-self-heal-metadata.c | 4 +-
xlators/cluster/afr/src/afr-self-heal-name.c | 2 +-
xlators/cluster/afr/src/afr-self-heal.h | 2 +-
xlators/cluster/afr/src/afr-self-heald.c | 6 +-
xlators/cluster/afr/src/afr-transaction.c | 43 +----------
xlators/cluster/afr/src/afr.h | 6 +-
13 files changed, 248 insertions(+), 95 deletions(-)
create mode 100644 tests/basic/afr/split-brain-open.t
diff --git a/tests/basic/afr/split-brain-open.t b/tests/basic/afr/split-brain-open.t
new file mode 100644
index 0000000..9b2f285
--- /dev/null
+++ b/tests/basic/afr/split-brain-open.t
@@ -0,0 +1,38 @@
+#!/bin/bash
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
+TEST $CLI volume start $V0
+
+#Disable self-heal-daemon
+TEST $CLI volume heal $V0 disable
+
+TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 --entry-timeout=0 $M0;
+
+TEST touch $M0/data-split-brain.txt
+
+#Create data split-brain
+TEST kill_brick $V0 $H0 $B0/${V0}0
+
+`echo "brick1_alive" > $M0/data-split-brain.txt`
+TEST [ $? == 0 ];
+
+TEST $CLI volume start $V0 force
+TEST kill_brick $V0 $H0 $B0/${V0}1
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
+
+`echo "brick0_alive" > $M0/data-split-brain.txt`
+TEST [ $? == 0 ];
+
+TEST $CLI volume start $V0 force
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 1
+
+echo "all-alive" >> $M0/data-split-brain.txt
+TEST [ $? != 0 ];
+
+cleanup;
diff --git a/tests/bugs/nfs/bug-974972.t b/tests/bugs/nfs/bug-974972.t
index d05e7df..7047825 100755
--- a/tests/bugs/nfs/bug-974972.t
+++ b/tests/bugs/nfs/bug-974972.t
@@ -11,6 +11,7 @@ TEST glusterd
TEST pidof glusterd
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
TEST $CLI volume set $V0 self-heal-daemon off
+TEST $CLI volume set $V0 cluster.eager-lock off
TEST $CLI volume set $V0 nfs.disable false
TEST $CLI volume start $V0
EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available;
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index a8ba5a0..692f198 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -254,8 +254,9 @@ __afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local,
local->transaction.in_flight_sb = _gf_true;
metadatamap |= (1 << index);
}
- if (metadatamap_old != metadatamap)
+ if (metadatamap_old != metadatamap) {
event = 0;
+ }
break;
case AFR_DATA_TRANSACTION:
@@ -283,19 +284,71 @@ __afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local,
return ret;
}
-int
-afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local, inode_t *inode)
+gf_boolean_t
+afr_is_symmetric_error (call_frame_t *frame, xlator_t *this)
{
- int ret = -1;
+ afr_local_t *local = NULL;
afr_private_t *priv = NULL;
+ int op_errno = 0;
+ int i_errno = 0;
+ gf_boolean_t matching_errors = _gf_true;
+ int i = 0;
+
+ priv = this->private;
+ local = frame->local;
+
+ for (i = 0; i < priv->child_count; i++) {
+ if (!local->replies[i].valid)
+ continue;
+ if (local->replies[i].op_ret != -1) {
+ /* Operation succeeded on at least one subvol,
+ so it is not a failed-everywhere situation.
+ */
+ matching_errors = _gf_false;
+ break;
+ }
+ i_errno = local->replies[i].op_errno;
+
+ if (i_errno == ENOTCONN) {
+ /* ENOTCONN is not a symmetric error. We do not
+ know if the operation was performed on the
+ backend or not.
+ */
+ matching_errors = _gf_false;
+ break;
+ }
+
+ if (!op_errno) {
+ op_errno = i_errno;
+ } else if (op_errno != i_errno) {
+ /* Mismatching op_errno's */
+ matching_errors = _gf_false;
+ break;
+ }
+ }
+
+ return matching_errors;
+}
+
+int
+afr_set_in_flight_sb_status (xlator_t *this, call_frame_t *frame,
+ inode_t *inode)
+{
+ int ret = -1;
+ afr_private_t *priv = NULL;
+ afr_local_t *local = NULL;
priv = this->private;
+ local = frame->local;
/* If this transaction saw no failures, then exit. */
if (AFR_COUNT (local->transaction.failed_subvols,
priv->child_count) == 0)
return 0;
+ if (afr_is_symmetric_error (frame, this))
+ return 0;
+
LOCK (&inode->lock);
{
ret = __afr_set_in_flight_sb_status (this, local, inode);
@@ -548,8 +601,9 @@ afr_inode_get_readable (call_frame_t *frame, inode_t *inode, xlator_t *this,
}
} else {
/* For files, abort in case of data/metadata split-brain. */
- if (!data_count || !metadata_count)
+ if (!data_count || !metadata_count) {
return -EIO;
+ }
}
if (type == AFR_METADATA_TRANSACTION && readable)
@@ -1958,6 +2012,11 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this)
GF_FREE (local->cont.opendir.checksum);
}
+ { /* open */
+ if (local->cont.open.fd)
+ fd_unref (local->cont.open.fd);
+ }
+
{ /* readdirp */
if (local->cont.readdir.dict)
dict_unref (local->cont.readdir.dict);
@@ -2535,9 +2594,11 @@ afr_lookup_metadata_heal_check (call_frame_t *frame, xlator_t *this)
if (!afr_can_start_metadata_self_heal (frame, this))
goto out;
- heal = afr_frame_create (this);
- if (!heal)
+ heal = afr_frame_create (this, &ret);
+ if (!heal) {
+ ret = -ret;
goto out;
+ }
ret = synctask_new (this->ctx->env, afr_lookup_sh_metadata_wrap,
afr_refresh_selfheal_done, heal, frame);
@@ -2630,7 +2691,7 @@ afr_lookup_entry_heal (call_frame_t *frame, xlator_t *this)
}
if (need_heal) {
- heal = afr_frame_create (this);
+ heal = afr_frame_create (this, NULL);
if (!heal)
goto metadata_heal;
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
index 6651e92..97397f9 100644
--- a/xlators/cluster/afr/src/afr-inode-write.c
+++ b/xlators/cluster/afr/src/afr-inode-write.c
@@ -131,7 +131,7 @@ __afr_inode_write_finalize (call_frame_t *frame, xlator_t *this)
}
}
- afr_set_in_flight_sb_status (this, local, local->inode);
+ afr_set_in_flight_sb_status (this, frame, local->inode);
}
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
index 7a62835..6c625cc 100644
--- a/xlators/cluster/afr/src/afr-open.c
+++ b/xlators/cluster/afr/src/afr-open.c
@@ -66,16 +66,15 @@ afr_open_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
-
int
afr_open_cbk (call_frame_t *frame, void *cookie,
xlator_t *this, int32_t op_ret, int32_t op_errno,
fd_t *fd, dict_t *xdata)
{
- afr_local_t * local = NULL;
- int call_count = -1;
- int child_index = (long) cookie;
- afr_fd_ctx_t *fd_ctx = NULL;
+ afr_local_t *local = NULL;
+ int call_count = -1;
+ int child_index = (long) cookie;
+ afr_fd_ctx_t *fd_ctx = NULL;
local = frame->local;
fd_ctx = local->fd_ctx;
@@ -103,24 +102,62 @@ afr_open_cbk (call_frame_t *frame, void *cookie,
fd, 0, NULL);
} else {
AFR_STACK_UNWIND (open, frame, local->op_ret,
- local->op_errno, local->fd,
- local->xdata_rsp);
+ local->op_errno, local->cont.open.fd,
+ local->xdata_rsp);
}
}
return 0;
}
+
+int
+afr_open_continue (call_frame_t *frame, xlator_t *this, int err)
+{
+ afr_local_t *local = NULL;
+ afr_private_t *priv = NULL;
+ int call_count = 0;
+ int i = 0;
+
+ local = frame->local;
+ priv = this->private;
+
+ if (err) {
+ AFR_STACK_UNWIND (open, frame, -1, -err, NULL, NULL);
+ } else {
+ local->call_count = AFR_COUNT (local->child_up,
+ priv->child_count);
+ call_count = local->call_count;
+
+ for (i = 0; i < priv->child_count; i++) {
+ if (local->child_up[i]) {
+ STACK_WIND_COOKIE (frame, afr_open_cbk,
+ (void *)(long)i,
+ priv->children[i],
+ priv->children[i]->fops->open,
+ &local->loc,
+ (local->cont.open.flags & ~O_TRUNC),
+ local->cont.open.fd,
+ local->xdata_req);
+ if (!--call_count)
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
int
afr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
fd_t *fd, dict_t *xdata)
{
- afr_private_t * priv = NULL;
- afr_local_t * local = NULL;
- int i = 0;
- int32_t call_count = 0;
- int32_t op_errno = 0;
- afr_fd_ctx_t *fd_ctx = NULL;
+ afr_private_t *priv = NULL;
+ afr_local_t *local = NULL;
+ int spb_choice = 0;
+ int event_generation = 0;
+ int ret = 0;
+ int32_t op_errno = 0;
+ afr_fd_ctx_t *fd_ctx = NULL;
//We can't let truncation to happen outside transaction.
@@ -140,23 +177,27 @@ afr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
if (!afr_is_consistent_io_possible (local, priv, &op_errno))
goto out;
- local->fd = fd_ref (fd);
+ local->inode = inode_ref (loc->inode);
+ loc_copy (&local->loc, loc);
local->fd_ctx = fd_ctx;
fd_ctx->flags = flags;
-
- call_count = local->call_count;
+ if (xdata)
+ local->xdata_req = dict_ref (xdata);
local->cont.open.flags = flags;
-
- for (i = 0; i < priv->child_count; i++) {
- if (local->child_up[i]) {
- STACK_WIND_COOKIE (frame, afr_open_cbk, (void *) (long) i,
- priv->children[i],
- priv->children[i]->fops->open,
- loc, (flags & ~O_TRUNC), fd, xdata);
- if (!--call_count)
- break;
- }
+ local->cont.open.fd = fd_ref (fd);
+
+ ret = afr_inode_get_readable (frame, local->inode, this,
+ NULL, &event_generation,
+ AFR_DATA_TRANSACTION);
+ if ((ret < 0) &&
+ (afr_inode_split_brain_choice_get (local->inode,
+ this, &spb_choice) == 0) &&
+ spb_choice < 0) {
+ afr_inode_refresh (frame, this, local->inode,
+ local->inode->gfid, afr_open_continue);
+ } else {
+ afr_open_continue (frame, this, 0);
}
return 0;
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index 20e81dd..26d3860 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -66,9 +66,9 @@ afr_lookup_and_heal_gfid (xlator_t *this, inode_t *parent, const char *name,
goto out;
}
- frame = afr_frame_create (this);
+ frame = afr_frame_create (this, &ret);
if (!frame) {
- ret = -ENOMEM;
+ ret = -ret;
goto out;
}
@@ -2349,18 +2349,17 @@ afr_inode_find (xlator_t *this, uuid_t gfid)
call_frame_t *
-afr_frame_create (xlator_t *this)
+afr_frame_create (xlator_t *this, int32_t *op_errno)
{
call_frame_t *frame = NULL;
afr_local_t *local = NULL;
- int op_errno = 0;
pid_t pid = GF_CLIENT_PID_SELF_HEALD;
frame = create_frame (this, this->ctx->pool);
if (!frame)
return NULL;
- local = AFR_FRAME_INIT (frame, op_errno);
+ local = AFR_FRAME_INIT (frame, (*op_errno));
if (!local) {
STACK_DESTROY (frame->root);
return NULL;
@@ -2490,7 +2489,7 @@ afr_selfheal (xlator_t *this, uuid_t gfid)
call_frame_t *frame = NULL;
afr_local_t *local = NULL;
- frame = afr_frame_create (this);
+ frame = afr_frame_create (this, NULL);
if (!frame)
return ret;
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index 2c254e8..8cf43f2 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -776,13 +776,37 @@ out:
return ret;
}
+int
+afr_selfheal_data_open_cbk (call_frame_t *frame, void *cookie,
+ xlator_t *this, int32_t op_ret, int32_t op_errno,
+ fd_t *fd, dict_t *xdata)
+{
+ afr_local_t *local = NULL;
+ int i = (long) cookie;
+
+ local = frame->local;
+
+ local->replies[i].valid = 1;
+ local->replies[i].op_ret = op_ret;
+ local->replies[i].op_errno = op_errno;
+
+ syncbarrier_wake (&local->barrier);
+
+ return 0;
+}
int
afr_selfheal_data_open (xlator_t *this, inode_t *inode, fd_t **fd)
{
- int ret = 0;
- fd_t *fd_tmp = NULL;
- loc_t loc = {0,};
+ int ret = 0;
+ fd_t *fd_tmp = NULL;
+ loc_t loc = {0,};
+ call_frame_t *frame = NULL;
+ afr_local_t *local = NULL;
+ afr_private_t *priv = NULL;
+ int i = 0;
+
+ priv = this->private;
fd_tmp = fd_create (inode, 0);
if (!fd_tmp)
@@ -791,7 +815,31 @@ afr_selfheal_data_open (xlator_t *this, inode_t *inode, fd_t **fd)
loc.inode = inode_ref (inode);
gf_uuid_copy (loc.gfid, inode->gfid);
- ret = syncop_open (this, &loc, O_RDWR|O_LARGEFILE, fd_tmp, NULL, NULL);
+ frame = afr_frame_create (this, &ret);
+ if (!frame) {
+ ret = -ret;
+ fd_unref (fd_tmp);
+ goto out;
+ }
+ local = frame->local;
+
+ AFR_ONLIST (local->child_up, frame, afr_selfheal_data_open_cbk, open,
+ &loc, O_RDWR|O_LARGEFILE, fd_tmp, NULL);
+
+ ret = -ENOTCONN;
+ for (i = 0; i < priv->child_count; i++) {
+ if (!local->replies[i].valid)
+ continue;
+
+ if (local->replies[i].op_ret < 0) {
+ ret = -local->replies[i].op_errno;
+ continue;
+ }
+
+ ret = 0;
+ break;
+ }
+
if (ret < 0) {
fd_unref (fd_tmp);
goto out;
@@ -802,6 +850,8 @@ afr_selfheal_data_open (xlator_t *this, inode_t *inode, fd_t **fd)
*fd = fd_tmp;
out:
loc_wipe (&loc);
+ if (frame)
+ AFR_STACK_DESTROY (frame);
return ret;
}
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c
index f23cf8e..199f896 100644
--- a/xlators/cluster/afr/src/afr-self-heal-metadata.c
+++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c
@@ -486,9 +486,9 @@ afr_selfheal_metadata_by_stbuf (xlator_t *this, struct iatt *stbuf)
goto out;
}
- frame = afr_frame_create (this);
+ frame = afr_frame_create (this, &ret);
if (!frame) {
- ret = -ENOMEM;
+ ret = -ret;
goto out;
}
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index 352d151..556d14b 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -670,7 +670,7 @@ afr_selfheal_name (xlator_t *this, uuid_t pargfid, const char *bname,
if (!parent)
goto out;
- frame = afr_frame_create (this);
+ frame = afr_frame_create (this, NULL);
if (!frame)
goto out;
diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h
index a1da433..188a334 100644
--- a/xlators/cluster/afr/src/afr-self-heal.h
+++ b/xlators/cluster/afr/src/afr-self-heal.h
@@ -209,7 +209,7 @@ afr_selfheal_post_op (call_frame_t *frame, xlator_t *this, inode_t *inode,
int subvol, dict_t *xattr, dict_t *xdata);
call_frame_t *
-afr_frame_create (xlator_t *this);
+afr_frame_create (xlator_t *this, int32_t *op_errno);
inode_t *
afr_inode_find (xlator_t *this, uuid_t gfid);
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 74c9bb6..19cde88 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -260,7 +260,7 @@ afr_shd_zero_xattrop (xlator_t *this, uuid_t gfid)
int raw[AFR_NUM_CHANGE_LOGS] = {0};
priv = this->private;
- frame = afr_frame_create (this);
+ frame = afr_frame_create (this, NULL);
if (!frame)
goto out;
inode = afr_inode_find (this, gfid);
@@ -457,9 +457,9 @@ afr_shd_index_sweep (struct subvol_healer *healer, char *vgfid)
priv = healer->this->private;
subvol = priv->children[healer->subvol];
- frame = afr_frame_create (healer->this);
+ frame = afr_frame_create (healer->this, &ret);
if (!frame) {
- ret = -ENOMEM;
+ ret = -ret;
goto out;
}
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 91c4f78..a04636f 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -626,51 +626,10 @@ afr_txn_nothing_failed (call_frame_t *frame, xlator_t *this)
return _gf_true;
}
-
void
afr_handle_symmetric_errors (call_frame_t *frame, xlator_t *this)
{
- afr_local_t *local = NULL;
- afr_private_t *priv = NULL;
- int op_errno = 0;
- int i_errno = 0;
- gf_boolean_t matching_errors = _gf_true;
- int i = 0;
-
- priv = this->private;
- local = frame->local;
-
- for (i = 0; i < priv->child_count; i++) {
- if (!local->replies[i].valid)
- continue;
- if (local->replies[i].op_ret != -1) {
- /* Operation succeeded on at least on subvol,
- so it is not a failed-everywhere situation.
- */
- matching_errors = _gf_false;
- break;
- }
- i_errno = local->replies[i].op_errno;
-
- if (i_errno == ENOTCONN) {
- /* ENOTCONN is not a symmetric error. We do not
- know if the operation was performed on the
- backend or not.
- */
- matching_errors = _gf_false;
- break;
- }
-
- if (!op_errno) {
- op_errno = i_errno;
- } else if (op_errno != i_errno) {
- /* Mismatching op_errno's */
- matching_errors = _gf_false;
- break;
- }
- }
-
- if (matching_errors)
+ if (afr_is_symmetric_error (frame, this))
__mark_all_success (frame, this);
}
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 672d053..0a06eb6 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -519,6 +519,7 @@ typedef struct _afr_local {
struct {
int32_t flags;
+ fd_t *fd;
} open;
struct {
@@ -1214,7 +1215,7 @@ int
afr_get_msg_id (char *op_type);
int
-afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local,
+afr_set_in_flight_sb_status (xlator_t *this, call_frame_t *frame,
inode_t *inode);
int32_t
@@ -1272,4 +1273,7 @@ afr_write_subvol_set (call_frame_t *frame, xlator_t *this);
int
afr_write_subvol_reset (call_frame_t *frame, xlator_t *this);
+
+gf_boolean_t
+afr_is_symmetric_error (call_frame_t *frame, xlator_t *this);
#endif /* __AFR_H__ */
--
1.8.3.1

View File

@ -1,309 +0,0 @@
From 5c8fd80edb0133cad6ae10c2a6dc23b660b9fa38 Mon Sep 17 00:00:00 2001
From: Anoop C S <anoopcs@redhat.com>
Date: Wed, 11 Oct 2017 13:29:13 +0530
Subject: [PATCH 095/128] extras/hooks: Fix errors reported via shellcheck
utility
> Change-Id: I217c6b2a39955f1709bb3452b00d33c2dcb60faa
> BUG: 1500649
> Upstream: https://review.gluster.org/#/c/18485/
Change-Id: I217c6b2a39955f1709bb3452b00d33c2dcb60faa
BUG: 1444820
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124640
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
.../add-brick/post/disabled-quota-root-xattr-heal.sh | 2 +-
.../add-brick/pre/S28Quota-enable-root-xattr-heal.sh | 8 ++++----
extras/hook-scripts/create/post/S10selinux-label-brick.sh | 4 ++--
extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh | 7 ++-----
extras/hook-scripts/set/post/S30samba-set.sh | 12 ++++++------
.../set/post/S32gluster_enable_shared_storage.sh | 4 ++--
extras/hook-scripts/start/post/S29CTDBsetup.sh | 4 ++--
extras/hook-scripts/start/post/S30samba-start.sh | 10 +++++-----
extras/hook-scripts/stop/pre/S29CTDB-teardown.sh | 4 ++--
extras/hook-scripts/stop/pre/S30samba-stop.sh | 8 ++++----
10 files changed, 30 insertions(+), 33 deletions(-)
diff --git a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh
index bde7249..ce81816 100755
--- a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh
+++ b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh
@@ -71,7 +71,7 @@ get_and_set_xattr ()
##------------------------------------------
## Parse the arguments
##------------------------------------------
-ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@)
+ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
eval set -- "$ARGS"
while true;
diff --git a/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh b/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh
index 348f34e..38af73f 100755
--- a/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh
+++ b/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh
@@ -29,7 +29,7 @@ VERSION=
ENABLED_NAME="S28Quota-root-xattr-heal.sh"
DISABLED_NAME="disabled-quota-root-xattr-heal.sh"
-enable ()
+activate ()
{
ln -sf $DISABLED_STATE $1;
}
@@ -37,7 +37,7 @@ enable ()
##------------------------------------------
## Parse the arguments
##------------------------------------------
-ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@)
+ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
eval set -- "$ARGS"
while true;
@@ -92,9 +92,9 @@ FLAG=`cat $GLUSTERD_WORKDIR/vols/$VOL_NAME/info | grep "^status=" \
| awk -F'=' '{print $NF}'`;
if [ "$FLAG" != "1" ]
then
- enable $ENABLED_STATE_START;
+ activate $ENABLED_STATE_START;
exit $?
fi
-enable $ENABLED_STATE_ADD_BRICK;
+activate $ENABLED_STATE_ADD_BRICK;
exit $?
diff --git a/extras/hook-scripts/create/post/S10selinux-label-brick.sh b/extras/hook-scripts/create/post/S10selinux-label-brick.sh
index f38555c..94c624d 100755
--- a/extras/hook-scripts/create/post/S10selinux-label-brick.sh
+++ b/extras/hook-scripts/create/post/S10selinux-label-brick.sh
@@ -14,7 +14,7 @@ OPTSPEC="volname:"
VOL=
parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@)
+ ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
eval set -- "$ARGS"
while true; do
@@ -53,7 +53,7 @@ set_brick_labels()
SELINUX_STATE=$(which getenforce && getenforce)
[ "${SELINUX_STATE}" = 'Disabled' ] && exit 0
-parse_args $@
+parse_args "$@"
[ -z "$VOL" ] && exit 1
set_brick_labels $VOL
diff --git a/extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh b/extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh
index 2c83331..7851e70 100755
--- a/extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh
+++ b/extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh
@@ -13,12 +13,9 @@
PROGNAME="Sselinux"
OPTSPEC="volname:"
VOL=
-CONFIGFILE=
-LOGFILEBASE=
-PIDDIR=
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@)
+ ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
eval set -- "$ARGS"
while true; do
@@ -53,7 +50,7 @@ function delete_brick_fcontext()
SELINUX_STATE=$(which getenforce && getenforce)
[ "${SELINUX_STATE}" = 'Disabled' ] && exit 0
-parse_args $@
+parse_args "$@"
[ -z "$VOL" ] && exit 1
delete_brick_fcontext $VOL
diff --git a/extras/hook-scripts/set/post/S30samba-set.sh b/extras/hook-scripts/set/post/S30samba-set.sh
index 97d067f..c21cfb5 100755
--- a/extras/hook-scripts/set/post/S30samba-set.sh
+++ b/extras/hook-scripts/set/post/S30samba-set.sh
@@ -28,7 +28,7 @@ USERSMB_SET=""
USERCIFS_SET=""
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC --name $PROGNAME -o "o:" -- $@)
+ ARGS=$(getopt -l $OPTSPEC --name $PROGNAME -o "o:" -- "$@")
eval set -- "$ARGS"
while true; do
@@ -123,23 +123,23 @@ function get_smb () {
usersmbvalue=$(grep user.smb $GLUSTERD_WORKDIR/vols/"$volname"/info |\
cut -d"=" -f2)
- if [[ $usercifsvalue = "disable" || $usersmbvalue = "disable" ]]; then
+ if [ $usercifsvalue = "disable" ] || [ $usersmbvalue = "disable" ]; then
uservalue="disable"
fi
echo "$uservalue"
}
-parse_args $@
-if [ "0" = $(is_volume_started "$VOL") ]; then
+parse_args "$@"
+if [ "0" = "$(is_volume_started "$VOL")" ]; then
exit 0
fi
-if [[ "$USERCIFS_SET" = "YES" || "$USERSMB_SET" = "YES" ]]; then
+if [ "$USERCIFS_SET" = "YES" ] || [ "$USERSMB_SET" = "YES" ]; then
#Find smb.conf, smbd pid directory and smbd logfile path
find_config_info
- if [ $(get_smb "$VOL") = "disable" ]; then
+ if [ "$(get_smb "$VOL")" = "disable" ]; then
del_samba_share $VOL
sighup_samba
else
diff --git a/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh b/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh
index c0aa735..885ed03 100755
--- a/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh
+++ b/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh
@@ -104,7 +104,7 @@ function check_volume_status()
echo $status
}
-mount_cmd="mount -t glusterfs "$local_node_hostname":/gluster_shared_storage \
+mount_cmd="mount -t glusterfs $local_node_hostname:/gluster_shared_storage \
/var/run/gluster/shared_storage"
if [ "$option" == "enable" ]; then
@@ -117,7 +117,7 @@ if [ "$option" == "enable" ]; then
if [ "$retry" == 3 ]; then
break;
fi
- status = check_volume_status;
+ status=$(check_volume_status)
done
# Mount the volume on all the nodes
umount /var/run/gluster/shared_storage
diff --git a/extras/hook-scripts/start/post/S29CTDBsetup.sh b/extras/hook-scripts/start/post/S29CTDBsetup.sh
index 4265cba..330ce74 100755
--- a/extras/hook-scripts/start/post/S29CTDBsetup.sh
+++ b/extras/hook-scripts/start/post/S29CTDBsetup.sh
@@ -21,7 +21,7 @@ VOL=
META="all"
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@)
+ ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
eval set -- "$ARGS"
while true; do
@@ -55,7 +55,7 @@ function add_fstab_entry () {
fi
}
-parse_args $@
+parse_args "$@"
if [ "$META" = "$VOL" ]
then
mkdir -p $CTDB_MNT
diff --git a/extras/hook-scripts/start/post/S30samba-start.sh b/extras/hook-scripts/start/post/S30samba-start.sh
index 3e0f257..d6b94e6 100755
--- a/extras/hook-scripts/start/post/S30samba-start.sh
+++ b/extras/hook-scripts/start/post/S30samba-start.sh
@@ -29,7 +29,7 @@ PIDDIR=
GLUSTERD_WORKDIR=
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@)
+ ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
eval set -- "$ARGS"
while true; do
@@ -57,8 +57,8 @@ function find_config_info () {
echo "Samba is not installed"
exit 1
fi
- CONFIGFILE=`echo $cmdout | awk {'print $2'}`
- PIDDIR=`smbd -b | grep PIDDIR | awk {'print $2'}`
+ CONFIGFILE=`echo $cmdout | awk '{print $2}'`
+ PIDDIR=`smbd -b | grep PIDDIR | awk '{print $2}'`
LOGFILEBASE=`smbd -b | grep 'LOGFILEBASE' | awk '{print $2}'`
}
@@ -95,13 +95,13 @@ function get_smb () {
usersmbvalue=$(grep user.smb $GLUSTERD_WORKDIR/vols/"$volname"/info |\
cut -d"=" -f2)
- if [[ $usercifsvalue = "disable" || $usersmbvalue = "disable" ]]; then
+ if [ $usercifsvalue = "disable" ] || [ $usersmbvalue = "disable" ]; then
uservalue="disable"
fi
echo "$uservalue"
}
-parse_args $@
+parse_args "$@"
if [ "$(get_smb "$VOL")" = "disable" ]; then
exit 0
fi
diff --git a/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh b/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
index 5fb49bd..e9116c8 100755
--- a/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
+++ b/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
@@ -12,7 +12,7 @@ VOL=
META="all"
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@)
+ ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
eval set -- "$ARGS"
while true; do
@@ -51,7 +51,7 @@ function remove_fstab_entry () {
fi
}
-parse_args $@
+parse_args "$@"
if [ "$META" = "$VOL" ]
then
umount "$CTDB_MNT"
diff --git a/extras/hook-scripts/stop/pre/S30samba-stop.sh b/extras/hook-scripts/stop/pre/S30samba-stop.sh
index 62cf7d1..6e542da 100755
--- a/extras/hook-scripts/stop/pre/S30samba-stop.sh
+++ b/extras/hook-scripts/stop/pre/S30samba-stop.sh
@@ -22,7 +22,7 @@ CONFIGFILE=
PIDDIR=
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME $@)
+ ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
eval set -- "$ARGS"
while true; do
@@ -46,8 +46,8 @@ function find_config_info () {
echo "Samba is not installed"
exit 1
fi
- CONFIGFILE=`echo $cmdout | awk {'print $2'}`
- PIDDIR=`smbd -b | grep PIDDIR | awk {'print $2'}`
+ CONFIGFILE=`echo $cmdout | awk '{print $2}'`
+ PIDDIR=`smbd -b | grep PIDDIR | awk '{print $2}'`
}
function del_samba_share () {
@@ -65,7 +65,7 @@ function sighup_samba () {
fi
}
-parse_args $@
+parse_args "$@"
find_config_info
del_samba_share $VOL
sighup_samba
--
1.8.3.1

View File

@ -1,225 +0,0 @@
From 281f33b36d3ac39869c313e5c6ba4909ae2d74e0 Mon Sep 17 00:00:00 2001
From: Anoop C S <anoopcs@redhat.com>
Date: Wed, 25 Oct 2017 12:21:12 +0530
Subject: [PATCH 096/128] extras/hooks: Honour all input arguments to scripts
Some of the hook scripts were not honouring the arguments with which
they are invoked during various volume operations. So make sure that
we consider everything while parsing the command line arguments to
avoid following warnings:
. . .
ame: unrecognized option '--first=no'
ame: unrecognized option '--version=1'
ame: unrecognized option '--volume-op=start'
. . .
> Change-Id: I5b08e5e7f32908c8509e97098a042096b507783e
> BUG: 1503983
> Upstream: https://review.gluster.org/#/c/18569/
Change-Id: I5b08e5e7f32908c8509e97098a042096b507783e
BUG: 1444820
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124642
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
extras/hook-scripts/start/post/S29CTDBsetup.sh | 32 ++++++++++++++++++------
extras/hook-scripts/start/post/S30samba-start.sh | 18 ++++++++++++-
extras/hook-scripts/stop/pre/S29CTDB-teardown.sh | 18 +++++++------
extras/hook-scripts/stop/pre/S30samba-stop.sh | 30 +++++++++++++---------
4 files changed, 70 insertions(+), 28 deletions(-)
diff --git a/extras/hook-scripts/start/post/S29CTDBsetup.sh b/extras/hook-scripts/start/post/S29CTDBsetup.sh
index 330ce74..54a4c0c 100755
--- a/extras/hook-scripts/start/post/S29CTDBsetup.sh
+++ b/extras/hook-scripts/start/post/S29CTDBsetup.sh
@@ -9,10 +9,14 @@ CTDB_MNT=/gluster/lock
# Make sure ping-timeout is not default for CTDB volume
PING_TIMEOUT_SECS=10
PROGNAME="ctdb"
-OPTSPEC="volname:"
+OPTSPEC="volname:,gd-workdir:,version:,volume-op:,first:"
HOSTNAME=`hostname`
MNTOPTS="_netdev,transport=tcp,xlator-option=*client*.ping-timeout=${PING_TIMEOUT_SECS}"
VOL=
+GLUSTERD_WORKDIR=
+VERSION=
+VOLUME_OP=
+FIRST=
# $META is the volume that will be used by CTDB as a shared filesystem.
# It is not desirable to use this volume for storing 'data' as well.
# META is set to 'all' (viz. a keyword and hence not a legal volume name)
@@ -29,13 +33,27 @@ function parse_args () {
--volname)
shift
VOL=$1
- ;;
-
+ ;;
+ --gd-workdir)
+ shift
+ GLUSTERD_WORKDIR=$1
+ ;;
+ --version)
+ shift
+ VERSION=$1
+ ;;
+ --volume-op)
+ shift
+ VOLUME_OP=$1
+ ;;
+ --first)
+ shift
+ FIRST=$1
+ ;;
*)
- shift
- break
- ;;
-
+ shift
+ break
+ ;;
esac
shift
diff --git a/extras/hook-scripts/start/post/S30samba-start.sh b/extras/hook-scripts/start/post/S30samba-start.sh
index d6b94e6..a448dbd 100755
--- a/extras/hook-scripts/start/post/S30samba-start.sh
+++ b/extras/hook-scripts/start/post/S30samba-start.sh
@@ -21,12 +21,15 @@
#volume.
PROGNAME="Ssamba-start"
-OPTSPEC="volname:,gd-workdir:"
+OPTSPEC="volname:,gd-workdir:,version:,volume-op:,first:"
VOL=
CONFIGFILE=
LOGFILEBASE=
PIDDIR=
GLUSTERD_WORKDIR=
+VERSION=
+VOLUME_OP=
+FIRST=
function parse_args () {
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
@@ -42,11 +45,24 @@ function parse_args () {
shift
GLUSTERD_WORKDIR=$1
;;
+ --version)
+ shift
+ VERSION=$1
+ ;;
+ --volume-op)
+ shift
+ VOLUME_OP=$1
+ ;;
+ --first)
+ shift
+ FIRST=$1
+ ;;
*)
shift
break
;;
esac
+
shift
done
}
diff --git a/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh b/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
index e9116c8..12f49da 100755
--- a/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
+++ b/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
@@ -2,8 +2,9 @@
CTDB_MNT=/gluster/lock
PROGNAME="ctdb"
-OPTSPEC="volname:"
+OPTSPEC="volname:,last:"
VOL=
+LAST=
# $META is the volume that will be used by CTDB as a shared filesystem.
# It is not desirable to use this volume for storing 'data' as well.
# META is set to 'all' (viz. a keyword and hence not a legal volume name)
@@ -20,15 +21,16 @@ function parse_args () {
--volname)
shift
VOL=$1
- ;;
-
+ ;;
+ --last)
+ shift
+ LAST=$1
+ ;;
*)
- shift
- break
- ;;
-
+ shift
+ break
+ ;;
esac
-
shift
done
}
diff --git a/extras/hook-scripts/stop/pre/S30samba-stop.sh b/extras/hook-scripts/stop/pre/S30samba-stop.sh
index 6e542da..a5c8dd5 100755
--- a/extras/hook-scripts/stop/pre/S30samba-stop.sh
+++ b/extras/hook-scripts/stop/pre/S30samba-stop.sh
@@ -16,27 +16,33 @@
#event by removing the volume related entries(if any) in smb.conf file.
PROGNAME="Ssamba-stop"
-OPTSPEC="volname:"
+OPTSPEC="volname:,last:"
VOL=
CONFIGFILE=
PIDDIR=
+LAST=
function parse_args () {
ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
eval set -- "$ARGS"
while true; do
- case $1 in
- --volname)
- shift
- VOL=$1
- ;;
- *)
- shift
- break
- ;;
- esac
- shift
+ case $1 in
+ --volname)
+ shift
+ VOL=$1
+ ;;
+ --last)
+ shift
+ LAST=$1
+ ;;
+ *)
+ shift
+ break
+ ;;
+ esac
+
+ shift
done
}
--
1.8.3.1

View File

@ -1,164 +0,0 @@
From ca93504c637b922cd633f0f2422b18b828982332 Mon Sep 17 00:00:00 2001
From: Anoop C S <anoopcs@redhat.com>
Date: Thu, 19 Oct 2017 13:40:35 +0530
Subject: [PATCH 097/128] extras/hooks: Fix getopt usage
`getopt` does not have an optional argument as '-name'. It should
be either '-n' or '--name'(see man getopt(1)). This wrong usage
resulted in setting the script name as 'ame' instead of $PROGNAME
in most of the hook-scripts.
Additionally the following line from DESCRIPTION given for `getopt`
shell command expects short options for almost every kind of usage
mentioned in SYNOPSIS:
. . .
If no '-o' or '--options' option is found in the first part, the
first parameter of the second part is used as the short options string.
. . .
Refer http://man7.org/linux/man-pages/man1/getopt.1.html for more
clarity on its usage.
> Change-Id: I95baf5fa8c99025e66b2d83656dd838d4f6048ce
> BUG: 1503983
> Upstream: https://review.gluster.org/#/c/18548/
Change-Id: I95baf5fa8c99025e66b2d83656dd838d4f6048ce
BUG: 1444820
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124641
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh | 2 +-
extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh | 2 +-
extras/hook-scripts/create/post/S10selinux-label-brick.sh | 2 +-
extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh | 2 +-
extras/hook-scripts/set/post/S30samba-set.sh | 2 +-
extras/hook-scripts/start/post/S29CTDBsetup.sh | 2 +-
extras/hook-scripts/start/post/S30samba-start.sh | 2 +-
extras/hook-scripts/stop/pre/S29CTDB-teardown.sh | 2 +-
extras/hook-scripts/stop/pre/S30samba-stop.sh | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh
index ce81816..49ab0a6 100755
--- a/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh
+++ b/extras/hook-scripts/add-brick/post/disabled-quota-root-xattr-heal.sh
@@ -71,7 +71,7 @@ get_and_set_xattr ()
##------------------------------------------
## Parse the arguments
##------------------------------------------
-ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
+ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true;
diff --git a/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh b/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh
index 38af73f..17ae4b4 100755
--- a/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh
+++ b/extras/hook-scripts/add-brick/pre/S28Quota-enable-root-xattr-heal.sh
@@ -37,7 +37,7 @@ activate ()
##------------------------------------------
## Parse the arguments
##------------------------------------------
-ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
+ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true;
diff --git a/extras/hook-scripts/create/post/S10selinux-label-brick.sh b/extras/hook-scripts/create/post/S10selinux-label-brick.sh
index 94c624d..6be4072 100755
--- a/extras/hook-scripts/create/post/S10selinux-label-brick.sh
+++ b/extras/hook-scripts/create/post/S10selinux-label-brick.sh
@@ -14,7 +14,7 @@ OPTSPEC="volname:"
VOL=
parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
+ ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do
diff --git a/extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh b/extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh
index 7851e70..6eba66f 100755
--- a/extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh
+++ b/extras/hook-scripts/delete/pre/S10selinux-del-fcontext.sh
@@ -15,7 +15,7 @@ OPTSPEC="volname:"
VOL=
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
+ ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do
diff --git a/extras/hook-scripts/set/post/S30samba-set.sh b/extras/hook-scripts/set/post/S30samba-set.sh
index c21cfb5..b93415b 100755
--- a/extras/hook-scripts/set/post/S30samba-set.sh
+++ b/extras/hook-scripts/set/post/S30samba-set.sh
@@ -28,7 +28,7 @@ USERSMB_SET=""
USERCIFS_SET=""
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC --name $PROGNAME -o "o:" -- "$@")
+ ARGS=$(getopt -o 'o:' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do
diff --git a/extras/hook-scripts/start/post/S29CTDBsetup.sh b/extras/hook-scripts/start/post/S29CTDBsetup.sh
index 54a4c0c..69a0d89 100755
--- a/extras/hook-scripts/start/post/S29CTDBsetup.sh
+++ b/extras/hook-scripts/start/post/S29CTDBsetup.sh
@@ -25,7 +25,7 @@ FIRST=
META="all"
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
+ ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do
diff --git a/extras/hook-scripts/start/post/S30samba-start.sh b/extras/hook-scripts/start/post/S30samba-start.sh
index a448dbd..92ddaf4 100755
--- a/extras/hook-scripts/start/post/S30samba-start.sh
+++ b/extras/hook-scripts/start/post/S30samba-start.sh
@@ -32,7 +32,7 @@ VOLUME_OP=
FIRST=
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
+ ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do
diff --git a/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh b/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
index 12f49da..0975a00 100755
--- a/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
+++ b/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
@@ -13,7 +13,7 @@ LAST=
META="all"
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
+ ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do
diff --git a/extras/hook-scripts/stop/pre/S30samba-stop.sh b/extras/hook-scripts/stop/pre/S30samba-stop.sh
index a5c8dd5..5e87845 100755
--- a/extras/hook-scripts/stop/pre/S30samba-stop.sh
+++ b/extras/hook-scripts/stop/pre/S30samba-stop.sh
@@ -23,7 +23,7 @@ PIDDIR=
LAST=
function parse_args () {
- ARGS=$(getopt -l $OPTSPEC -name $PROGNAME "$@")
+ ARGS=$(getopt -o '' -l $OPTSPEC -n $PROGNAME -- "$@")
eval set -- "$ARGS"
while true; do
--
1.8.3.1

View File

@ -1,138 +0,0 @@
From b69a36e8c61a0e1d45b3def6436d223bd14e76ef Mon Sep 17 00:00:00 2001
From: Sunny Kumar <sunkumar@redhat.com>
Date: Tue, 28 Nov 2017 13:37:43 +0530
Subject: [PATCH 098/128] snapshot : snapshot creation failed after brick
reset/replace
Problem : snapshot creation was failing after brick reset/replace
Fix : changed code to set mount_dir value in rsp_dict during prerequisites
phase i.e glusterd_brick_op_prerequisites call and removed form prevalidate
phase.
Upstream patch : https://review.gluster.org/c/18730/
>Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
>BUG: 1512451
BUG: 1507394
Change-Id: Ief5d0fafe882a7eb1a7da8535b7c7ce6f011604c
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/124467
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
...51-snapshot-creation-failed-after-brick-reset.t | 39 ++++++++++++++++++++++
xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 8 -----
xlators/mgmt/glusterd/src/glusterd-reset-brick.c | 10 ------
xlators/mgmt/glusterd/src/glusterd-utils.c | 9 +++++
4 files changed, 48 insertions(+), 18 deletions(-)
create mode 100644 tests/bugs/snapshot/bug-1512451-snapshot-creation-failed-after-brick-reset.t
diff --git a/tests/bugs/snapshot/bug-1512451-snapshot-creation-failed-after-brick-reset.t b/tests/bugs/snapshot/bug-1512451-snapshot-creation-failed-after-brick-reset.t
new file mode 100644
index 0000000..0624a5d
--- /dev/null
+++ b/tests/bugs/snapshot/bug-1512451-snapshot-creation-failed-after-brick-reset.t
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../cluster.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../snapshot.rc
+
+cleanup;
+TEST verify_lvm_version
+TEST launch_cluster 2
+TEST setup_lvm 2
+
+TEST $CLI_1 peer probe $H2
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count
+
+TEST $CLI_1 volume create $V0 $H1:$L1/B1 $H2:$L2/B1
+EXPECT 'Created' volinfo_field $V0 'Status'
+
+TEST $CLI_1 volume start $V0
+EXPECT 'Started' volinfo_field $V0 'Status'
+
+TEST $CLI_1 snapshot create ${V0}_snap1 ${V0} no-timestamp
+TEST snapshot_exists 1 ${V0}_snap1
+
+TEST $CLI_1 snapshot delete ${V0}_snap1
+TEST ! snapshot_exists 1 ${V0}_snap1
+
+TEST $CLI_1 volume reset-brick $V0 $H1:$L1/B1 start
+TEST $CLI_1 volume reset-brick $V0 $H1:$L1/B1 $H1:$L1/B1 commit force
+
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status_1 $V0 $H1 $L1/B1
+
+TEST $CLI_1 snapshot create ${V0}_snap1 ${V0} no-timestamp
+TEST snapshot_exists 1 ${V0}_snap1
+
+TEST $CLI_1 snapshot delete ${V0}_snap1
+TEST ! snapshot_exists 1 ${V0}_snap1
+
+cleanup;
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 18fc741..0e28608 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -319,14 +319,6 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
goto out;
}
- ret = dict_set_dynstr_with_alloc (rsp_dict, "brick1.mount_dir",
- dst_brickinfo->mount_dir);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_DICT_SET_FAILED,
- "Failed to set brick1.mount_dir");
- goto out;
- }
ret = dict_set_int32 (rsp_dict, "brick_count", 1);
if (ret) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
index abb44e0..10ee6f4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
@@ -208,16 +208,6 @@ glusterd_reset_brick_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
- ret = dict_set_dynstr_with_alloc (rsp_dict,
- "brick1.mount_dir",
- dst_brickinfo->mount_dir);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_DICT_SET_FAILED,
- "Failed to set brick1.mount_dir");
- goto out;
- }
-
ret = dict_set_int32 (rsp_dict, "brick_count", 1);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index f611fbb..23fc6e9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -13648,6 +13648,15 @@ glusterd_brick_op_prerequisites (dict_t *dict,
(*src_brickinfo)->port);
}
}
+ /* setting mount_dir */
+ ret = dict_set_dynstr_with_alloc (rsp_dict, "brick1.mount_dir",
+ (*src_brickinfo)->mount_dir);
+ if (ret) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_DICT_SET_FAILED,
+ "Failed to set brick1.mount_dir");
+ goto out;
+ }
v = *volinfo;
b = *src_brickinfo;
--
1.8.3.1

Some files were not shown because too many files have changed in this diff Show More