[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Apr 23 00:34:04 UTC 2019


The branch, master has been updated
       via  1c3731ccefb vfs_gpfs: Block punchhole calls for non-sparse files
       via  a0bc1f9d430 gpfswrap: Remove unused gpfs_prealloc wrapper
       via  066ec8d6c75 vfs_gpfs: Remove gpfs:prealloc from manpage
       via  0b203d94471 vfs_gpfs: Remove usage of gpfs_prealloc
      from  ef35d4d8cd4 s4-torture: add test to check for max. number of channels per session.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1c3731ccefb198adc9fb00b8bd61150c3ce23d14
Author: Christof Schmitt <cs at samba.org>
Date:   Wed Aug 8 14:54:24 2018 -0700

    vfs_gpfs: Block punchhole calls for non-sparse files
    
    The core smbd code implements ZERO_DATA for non-sparse files by punching
    a hole and filling it again with a fallocate(FL_KEEP_SIZE) call. As GPFS
    does not provide the fallocate(FL_KEEP_SIZE) call and non-sparse files
    should not contain holes, block the punchhole; effectively only allowing
    ZERO_DATA/punchhole calls for sparse files.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Apr 23 00:33:03 UTC 2019 on sn-devel-144

commit a0bc1f9d430aec7a5c3974f51689248390b2e469
Author: Christof Schmitt <cs at samba.org>
Date:   Mon May 14 14:35:28 2018 -0700

    gpfswrap: Remove unused gpfs_prealloc wrapper
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 066ec8d6c75b172ba08d2d64938b2e2d50f66c84
Author: Christof Schmitt <cs at samba.org>
Date:   Mon May 14 14:34:32 2018 -0700

    vfs_gpfs: Remove gpfs:prealloc from manpage
    
    The option is no longer in the code, remove it from the manpage as well.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0b203d94471002d67d23333ecef72f7c6788464b
Author: Christof Schmitt <cs at samba.org>
Date:   Mon May 14 14:33:15 2018 -0700

    vfs_gpfs: Remove usage of gpfs_prealloc
    
    All supported versions of GPFS now support fallocate. Use the default
    codepath instead of the API call. Keep the function stub as it will
    be used for a check later.
    
    Signed-off-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/manpages/vfs_gpfs.8.xml | 27 +----------------------
 lib/util/gpfswrap.c              | 12 ----------
 lib/util/gpfswrap.h              |  1 -
 source3/modules/vfs_gpfs.c       | 47 ++++++++++++----------------------------
 4 files changed, 15 insertions(+), 72 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_gpfs.8.xml b/docs-xml/manpages/vfs_gpfs.8.xml
index 15e7bcf9d77..2f3b4274e4b 100644
--- a/docs-xml/manpages/vfs_gpfs.8.xml
+++ b/docs-xml/manpages/vfs_gpfs.8.xml
@@ -13,7 +13,7 @@
 
 <refnamediv>
 	<refname>vfs_gpfs</refname>
-	<refpurpose>gpfs specific samba extensions like acls and prealloc</refpurpose>
+	<refpurpose>gpfs specific samba extensions like acls</refpurpose>
 </refnamediv>
 
 <refsynopsisdiv>
@@ -339,31 +339,6 @@
 		</varlistentry>
 		<varlistentry>
 
-		<term>gpfs:prealloc = [ yes | no ]</term>
-		<listitem>
-		<para>
-		If set to yes the gpfs_prealloc function will be used in the
-		fallocate callback when appropriate. If set to no gpfs_prealloc
-		will not be used. In both cases the system and libc calls are
-		avoided.
-		</para>
-
-		<itemizedlist>
-		<listitem><para>
-		<command>yes (default)</command> - Use gpfs_prealloc for the
-		fallocate callback.
-		</para></listitem>
-		<listitem><para>
-		<command>no</command> - Do not use gpfs_prealloc for the
-		fallocate callback.
-		</para></listitem>
-		</itemizedlist>
-		</listitem>
-
-		</varlistentry>
-
-		<varlistentry>
-
 		<term>gpfs:settimes = [ yes | no ]</term>
 		<listitem>
 		<para>
diff --git a/lib/util/gpfswrap.c b/lib/util/gpfswrap.c
index 0632ee20757..32be942bc7c 100644
--- a/lib/util/gpfswrap.c
+++ b/lib/util/gpfswrap.c
@@ -34,7 +34,6 @@ static int (*gpfs_set_winattrs_fn)(int fd, int flags,
 static int (*gpfs_get_winattrs_path_fn)(char *pathname,
 					struct gpfs_winattr *attrs);
 static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs);
-static int (*gpfs_prealloc_fn)(int fd, gpfs_off64_t start, gpfs_off64_t bytes);
 static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length);
 static int (*gpfs_lib_init_fn)(int flags);
 static int (*gpfs_set_times_path_fn)(char *pathname, int flags,
@@ -68,7 +67,6 @@ int gpfswrap_init(void)
 	gpfs_set_winattrs_fn	      = dlsym(l, "gpfs_set_winattrs");
 	gpfs_get_winattrs_path_fn     = dlsym(l, "gpfs_get_winattrs_path");
 	gpfs_get_winattrs_fn	      = dlsym(l, "gpfs_get_winattrs");
-	gpfs_prealloc_fn	      = dlsym(l, "gpfs_prealloc");
 	gpfs_ftruncate_fn	      = dlsym(l, "gpfs_ftruncate");
 	gpfs_lib_init_fn	      = dlsym(l, "gpfs_lib_init");
 	gpfs_set_times_path_fn	      = dlsym(l, "gpfs_set_times_path");
@@ -173,16 +171,6 @@ int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs)
 	return gpfs_get_winattrs_fn(fd, attrs);
 }
 
-int gpfswrap_prealloc(int fd, gpfs_off64_t start, gpfs_off64_t bytes)
-{
-	if (gpfs_prealloc_fn == NULL) {
-		errno = ENOSYS;
-		return -1;
-	}
-
-	return gpfs_prealloc_fn(fd, start, bytes);
-}
-
 int gpfswrap_ftruncate(int fd, gpfs_off64_t length)
 {
 	if (gpfs_ftruncate_fn == NULL) {
diff --git a/lib/util/gpfswrap.h b/lib/util/gpfswrap.h
index 1c9c64f7e8c..40202104064 100644
--- a/lib/util/gpfswrap.h
+++ b/lib/util/gpfswrap.h
@@ -37,7 +37,6 @@ int gpfswrap_set_winattrs_path(char *pathname, int flags,
 int gpfswrap_set_winattrs(int fd, int flags, struct gpfs_winattr *attrs);
 int gpfswrap_get_winattrs_path(char *pathname, struct gpfs_winattr *attrs);
 int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs);
-int gpfswrap_prealloc(int fd, gpfs_off64_t start, gpfs_off64_t bytes);
 int gpfswrap_ftruncate(int fd, gpfs_off64_t length);
 int gpfswrap_lib_init(int flags);
 int gpfswrap_set_times_path(char *pathname, int flags,
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index d86d0996fcd..52c4e5ef25d 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -48,7 +48,6 @@ struct gpfs_config_data {
 	bool ftruncate;
 	bool getrealfilename;
 	bool dfreequota;
-	bool prealloc;
 	bool acl;
 	bool settimes;
 	bool recalls;
@@ -1944,40 +1943,25 @@ static int vfs_gpfs_ntimes(struct vfs_handle_struct *handle,
 }
 
 static int vfs_gpfs_fallocate(struct vfs_handle_struct *handle,
-		       struct files_struct *fsp, uint32_t mode,
-		       off_t offset, off_t len)
+			      struct files_struct *fsp, uint32_t mode,
+			      off_t offset, off_t len)
 {
-	int ret;
-	struct gpfs_config_data *config;
-
-	SMB_VFS_HANDLE_GET_DATA(handle, config,
-				struct gpfs_config_data,
-				return -1);
-
-	if (!config->prealloc) {
-		/* you should better not run fallocate() on GPFS at all */
-		errno = ENOTSUP;
-		return -1;
-	}
-
-	if (mode != 0) {
-		DEBUG(10, ("unmapped fallocate flags: %lx\n",
-		      (unsigned long)mode));
+	if (mode == (VFS_FALLOCATE_FL_PUNCH_HOLE|VFS_FALLOCATE_FL_KEEP_SIZE) &&
+	    !fsp->is_sparse &&
+	    lp_strict_allocate(SNUM(fsp->conn))) {
+		/*
+		 * This is from a ZERO_DATA request on a non-sparse
+		 * file. GPFS does not support FL_KEEP_SIZE and thus
+		 * cannot fill the whole again in the subsequent
+		 * fallocate(FL_KEEP_SIZE). Deny this FL_PUNCH_HOLE
+		 * call to not end up with a hole in a non-sparse
+		 * file.
+		 */
 		errno = ENOTSUP;
 		return -1;
 	}
 
-	ret = gpfswrap_prealloc(fsp->fh->fd, offset, len);
-
-	if (ret == -1 && errno != ENOSYS) {
-		DEBUG(0, ("GPFS prealloc failed: %s\n", strerror(errno)));
-	} else if (ret == -1 && errno == ENOSYS) {
-		DEBUG(10, ("GPFS prealloc not supported.\n"));
-	} else {
-		DEBUG(10, ("GPFS prealloc succeeded.\n"));
-	}
-
-	return ret;
+	return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
 }
 
 static int vfs_gpfs_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
@@ -2152,9 +2136,6 @@ static int vfs_gpfs_connect(struct vfs_handle_struct *handle,
 	config->dfreequota = lp_parm_bool(SNUM(handle->conn), "gpfs",
 					  "dfreequota", false);
 
-	config->prealloc = lp_parm_bool(SNUM(handle->conn), "gpfs",
-				   "prealloc", true);
-
 	config->acl = lp_parm_bool(SNUM(handle->conn), "gpfs", "acl", true);
 
 	config->settimes = lp_parm_bool(SNUM(handle->conn), "gpfs",


-- 
Samba Shared Repository



More information about the samba-cvs mailing list