summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/gpfs.c4
-rw-r--r--source3/modules/vfs_gpfs.c13
2 files changed, 14 insertions, 3 deletions
diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c
index b31d9b0d53..57a5a0c9fb 100644
--- a/source3/modules/gpfs.c
+++ b/source3/modules/gpfs.c
@@ -26,7 +26,6 @@
#include "vfs_gpfs.h"
static bool gpfs_getrealfilename;
-static bool gpfs_do_ftruncate;
static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
static int (*gpfs_set_lease_fn)(int fd, unsigned int leaseType);
@@ -135,7 +134,7 @@ int smbd_gpfs_putacl(char *pathname, int flags, void *acl)
int smbd_gpfs_ftruncate(int fd, gpfs_off64_t length)
{
- if (!gpfs_do_ftruncate || (gpfs_ftruncate_fn == NULL)) {
+ if (gpfs_ftruncate_fn == NULL) {
errno = ENOSYS;
return -1;
}
@@ -265,7 +264,6 @@ void init_gpfs(void)
gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename",
True);
- gpfs_do_ftruncate = lp_parm_bool(-1, "gpfs", "ftruncate", True);
return;
}
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 0f084f8578..088d8c0d6b 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -40,6 +40,7 @@ struct gpfs_config_data {
bool hsm;
bool syncio;
bool winattr;
+ bool ftruncate;
};
@@ -1246,6 +1247,15 @@ static int vfs_gpfs_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
SMB_OFF_T len)
{
int result;
+ struct gpfs_config_data *config;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, config,
+ struct gpfs_config_data,
+ return -1);
+
+ if (!config->ftruncate) {
+ return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
+ }
result = smbd_gpfs_ftruncate(fsp->fh->fd, len);
if ((result == -1) && (errno == ENOSYS)) {
@@ -1350,6 +1360,9 @@ int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
config->winattr = lp_parm_bool(SNUM(handle->conn), "gpfs",
"winattr", false);
+ config->ftruncate = lp_parm_bool(SNUM(handle->conn), "gpfs",
+ "ftruncate", true);
+
SMB_VFS_HANDLE_SET_DATA(handle, config,
NULL, struct gpfs_config_data,
return -1);