From 20634ce845c65c2d7dfd0ca62d95bf53e170ac53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Mon, 2 Nov 2020 16:10:44 +0100 Subject: [PATCH 1/3] s3-vfs_glusterfs: always disable write-behind translator The "pass-through" option has now been merged upstream as of: https://github.com/gluster/glusterfs/pull/1640 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486 Guenther Signed-off-by: Guenther Deschner Pair-Programmed-With: Anoop C S Pair-Programmed-With: Sachin Prabhu Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Nov 4 22:53:49 UTC 2020 on sn-devel-184 (cherry picked from commit a51cda69ec6a017ad04b5690a3ae67a5478deee9) Autobuild-User(v4-13-test): Karolin Seeger Autobuild-Date(v4-13-test): Thu Nov 5 13:54:25 UTC 2020 on sn-devel-184 --- source3/modules/vfs_glusterfs.c | 20 +++++++++++++++++--- source3/wscript | 3 +++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 190235cf8ae..4e1dc169565 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -365,6 +365,7 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle, glfs_t *fs = NULL; TALLOC_CTX *tmp_ctx; int ret = 0; + bool write_behind_pass_through_set = false; tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { @@ -424,6 +425,17 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle, goto done; } +#ifdef HAVE_GFAPI_VER_7_9 + ret = glfs_set_xlator_option(fs, "*-write-behind", "pass-through", + "true"); + if (ret < 0) { + DBG_ERR("%s: Failed to set xlator option: pass-through\n", + volume); + goto done; + } + write_behind_pass_through_set = true; +#endif + ret = glfs_set_logging(fs, logfile, loglevel); if (ret < 0) { DEBUG(0, ("%s: Failed to set logfile %s loglevel %d\n", @@ -438,9 +450,11 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle, goto done; } - ret = check_for_write_behind_translator(tmp_ctx, fs, volume); - if (ret < 0) { - goto done; + if (!write_behind_pass_through_set) { + ret = check_for_write_behind_translator(tmp_ctx, fs, volume); + if (ret < 0) { + goto done; + } } ret = glfs_set_preopened(volume, handle->conn->connectpath, fs); diff --git a/source3/wscript b/source3/wscript index 7b257bcb845..47f97c60321 100644 --- a/source3/wscript +++ b/source3/wscript @@ -1591,6 +1591,9 @@ main() { conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 7.6" --cflags --libs', msg='Checking for glusterfs-api >= 7.6', uselib_store="GFAPI_VER_7_6") + conf.CHECK_CFG(package='glusterfs-api', args='"glusterfs-api >= 7.9" --cflags --libs', + msg='Checking for glusterfs-api >= 7.9', + uselib_store="GFAPI_VER_7_9") else: conf.SET_TARGET_TYPE('gfapi', 'EMPTY') conf.undefine('HAVE_GLUSTERFS') -- 2.28.0 From bd43929738289dc42d143ee3db01cbb187d05aa5 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Thu, 5 Nov 2020 16:12:09 +0530 Subject: [PATCH 2/3] manpages/vfs_glusterfs: Mention silent skipping of write-behind translator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486 Signed-off-by: Anoop C S Reviewed-by: Andrew Bartlett Reviewed-by: Guenther Deschner Autobuild-User(master): Günther Deschner Autobuild-Date(master): Mon Nov 9 13:30:06 UTC 2020 on sn-devel-184 (cherry picked from commit be03ce7d8bb213633eedcfc3299b8d9865a3c67f) --- docs-xml/manpages/vfs_glusterfs.8.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml index 7a4da1af919..ca6085a0595 100644 --- a/docs-xml/manpages/vfs_glusterfs.8.xml +++ b/docs-xml/manpages/vfs_glusterfs.8.xml @@ -180,6 +180,11 @@ Please disable the write-behind translator for the GlusterFS volume to allow the plugin to connect to the volume. + + With GlusterFS versions >= 9, we silently bypass write-behind + translator during intial connect and failure is avoided. + + -- 2.28.0 From b1ff2dd67f64fa6f50e8fb14cc64e212963d80c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Tue, 24 Nov 2020 15:38:41 +0100 Subject: [PATCH 3/3] vfs_glusterfs: print exact cmdline for disabling write-behind translator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG: https://bugzilla.samba.org/show_bug.cgi?id=14486 Guenther Signed-off-by: Guenther Deschner Reviewed-by: Anoop C S Autobuild-User(master): Günther Deschner Autobuild-Date(master): Fri Nov 27 17:15:07 UTC 2020 on sn-devel-184 (cherry picked from commit 369c1d539837b70e94fe9d533d44860c8a9380a1) --- docs-xml/manpages/vfs_glusterfs.8.xml | 6 +++++- source3/modules/vfs_glusterfs.c | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs-xml/manpages/vfs_glusterfs.8.xml b/docs-xml/manpages/vfs_glusterfs.8.xml index ca6085a0595..d25135e14ac 100644 --- a/docs-xml/manpages/vfs_glusterfs.8.xml +++ b/docs-xml/manpages/vfs_glusterfs.8.xml @@ -179,10 +179,14 @@ translator and refuse to connect if detected. Please disable the write-behind translator for the GlusterFS volume to allow the plugin to connect to the volume. + The write-behind translator can easily be disabled via calling + + gluster volume set <volumename> performance.write-behind off + on the commandline. With GlusterFS versions >= 9, we silently bypass write-behind - translator during intial connect and failure is avoided. + translator during initial connect and failure is avoided. diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 4e1dc169565..ce31b5eba14 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -345,9 +345,12 @@ static int check_for_write_behind_translator(TALLOC_CTX *mem_ctx, if (write_behind_present) { DBG_ERR("Write behind translator is enabled for " "volume (%s), refusing to connect! " - "Please check the vfs_glusterfs(8) manpage for " + "Please turn off the write behind translator by calling " + "'gluster volume set %s performance.write-behind off' " + "on the commandline. " + "Check the vfs_glusterfs(8) manpage for " "further details.\n", - volume); + volume, volume); return -1; } -- 2.28.0