The branch, v3-5-test has been updated via 84745fe Fix bug #6762 - ctdb on gpfs error with MS Office. from fbf1a26 s3/vfs_gpfs: s/syncops/gpfs
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test - Log ----------------------------------------------------------------- commit 84745fe2ef953b1b5edfef473c88c71cc71d4d1e Author: Martin Vogt <martin.v...@itwm.fraunhofer.de> Date: Thu Apr 7 21:20:06 2011 +0200 Fix bug #6762 - ctdb on gpfs error with MS Office. ----------------------------------------------------------------------- Summary of changes: source3/modules/gpfs.c | 17 +++++++++++++++-- source3/modules/vfs_gpfs.c | 14 ++++++++++++++ source3/modules/vfs_gpfs.h | 1 + 3 files changed, 30 insertions(+), 2 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c index c8fb88d..e04a9c9 100644 --- a/source3/modules/gpfs.c +++ b/source3/modules/gpfs.c @@ -26,6 +26,7 @@ static bool gpfs_getrealfilename; static bool gpfs_winattr; +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); @@ -36,7 +37,7 @@ static int (*gpfs_get_realfilename_path_fn)(char *pathname, char *filenamep, static int (*gpfs_set_winattrs_path_fn)(char *pathname, int flags, struct gpfs_winattr *attrs); 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_ftruncate_fn)(int fd, gpfs_off64_t length); bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask, uint32 share_access) @@ -131,6 +132,16 @@ int smbd_gpfs_putacl(char *pathname, int flags, void *acl) return gpfs_putacl_fn(pathname, flags, acl); } +int smbd_gpfs_ftrunctate(int fd, gpfs_off64_t length) +{ + if (!gpfs_do_ftruncate || (gpfs_ftruncate_fn == NULL)) { + errno = ENOSYS; + return -1; + } + + return gpfs_ftruncate_fn(fd, length); +} + int smbd_gpfs_get_realfilename_path(char *pathname, char *filenamep, int *buflen) { @@ -237,12 +248,14 @@ void init_gpfs(void) init_gpfs_function(&gpfs_get_winattrs_path_fn,"gpfs_get_winattrs_path"); init_gpfs_function(&gpfs_set_winattrs_path_fn,"gpfs_set_winattrs_path"); init_gpfs_function(&gpfs_get_winattrs_fn,"gpfs_get_winattrs"); - + init_gpfs_function(&gpfs_ftruncate_fn,"gpfs_ftruncate"); gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename", True); gpfs_winattr = lp_parm_bool(-1, "gpfs", "winattr", False); + 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 5e21a4b..ca29f64 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -1171,6 +1171,19 @@ int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service, } +static int vfs_gpfs_ftruncate(struct vfs_handle_struct *handle, + struct files_struct *fsp, + SMB_OFF_T len) +{ + int result; + + result = smbd_gpfs_ftrunctate(fsp->fh->fd, len); + if ((result == -1) && (errno == ENOSYS)) { + return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len); + } + return result; +} + static struct vfs_fn_pointers vfs_gpfs_fns = { .connect_fn = vfs_gpfs_connect, .kernel_flock = vfs_gpfs_kernel_flock, @@ -1193,6 +1206,7 @@ static struct vfs_fn_pointers vfs_gpfs_fns = { .fstat = vfs_gpfs_fstat, .lstat = vfs_gpfs_lstat, .ntimes = vfs_gpfs_ntimes, + .ftruncate = vfs_gpfs_ftruncate, }; NTSTATUS vfs_gpfs_init(void); diff --git a/source3/modules/vfs_gpfs.h b/source3/modules/vfs_gpfs.h index d2899b5..0fccceb 100644 --- a/source3/modules/vfs_gpfs.h +++ b/source3/modules/vfs_gpfs.h @@ -34,4 +34,5 @@ int smbd_gpfs_get_realfilename_path(char *pathname, char *filenamep, int smbd_fget_gpfs_winattrs(int fd, struct gpfs_winattr *attrs); int get_gpfs_winattrs(char * pathname,struct gpfs_winattr *attrs); int set_gpfs_winattrs(char * pathname,int flags,struct gpfs_winattr *attrs); +int smbd_gpfs_ftrunctate(int fd, gpfs_off64_t length); void init_gpfs(void); -- Samba Shared Repository