vfs_glusterfs: Fix exporting subdirs with shadow_copy2
authorMichael Adam <obnox@samba.org>
Fri, 20 Oct 2017 12:55:10 +0000 (14:55 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 20 Oct 2017 18:03:12 +0000 (20:03 +0200)
Since the glusterfs vfs module does not operate on a
locally mounted path, but on a "virtual" path starting
at the volume root, some assumptions of the code about
the vfs connect path fail. One example is the shadow_copy2
module which tries to detect the mount point from the
connectpath. In order to circumvent this problem, this
patch forces the "shadow:mountpoint" option to "/", which
skips the mount-point-detection code.

This patch will only have an effect if both the glusterfs
and the shadow_copy2 module are listed in vfs objects
in the right order, i.e. first shadow_copy2, and then
glusterfs.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13091

Pair-Programmed-With: Anoop C S <anoopcs@redhat.com>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_glusterfs.c

index 91cf87faa118cba36add05a751058d752b3ed3fb..8d12ac65f026993d8ce915fc629141a12fcdfe52 100644 (file)
@@ -352,6 +352,16 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
                          volume, strerror(errno)));
                goto done;
        }
+
+       /*
+        * The shadow_copy2 module will fail to export subdirectories
+        * of a gluster volume unless we specify the mount point,
+        * because the detection fails if the file system is not
+        * locally mounted:
+        * https://bugzilla.samba.org/show_bug.cgi?id=13091
+        */
+       lp_do_parameter(SNUM(handle->conn), "shadow:mountpoint", "/");
+
 done:
        if (ret < 0) {
                if (fs)