The branch, v3-5-test has been updated
       via  fbf1a26 s3/vfs_gpfs: s/syncops/gpfs
       via  4413d05 s3:vfs:gpfs convert sharemodes/leases parameter
      from  c9015e3 s3: Fix bug 8042: File creation on OS/X

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit fbf1a26be29f3d78d09e5f4285c973db9e16327f
Author: Björn Jacke <[email protected]>
Date:   Sun Apr 3 16:19:11 2011 +0200

    s3/vfs_gpfs: s/syncops/gpfs
    
    as pointed out by Metze in bug #8031
    
    cherry-picked from dca465fa53f4d16cdce1353685b11010aa8ff0c7
    
    The last two patches address bug #8031 - merge patc to make
    sharemodes/leases parameter a per share setting.

commit 4413d05bd742f879a6af71206265791ff76070bb
Author: Christian Ambach <[email protected]>
Date:   Fri Oct 8 13:15:57 2010 +0200

    s3:vfs:gpfs convert sharemodes/leases parameter
    
    convert gpfs:sharemodes and gpfs:leases parameters from a global setting
    to a per share setting
    
    cherry-picked from 22018b8b887c2677d30bbb4589f800197edf0e98

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

Summary of changes:
 source3/modules/gpfs.c     |   12 -------
 source3/modules/vfs_gpfs.c |   72 +++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 64 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c
index e059808..c8fb88d 100644
--- a/source3/modules/gpfs.c
+++ b/source3/modules/gpfs.c
@@ -24,8 +24,6 @@
 #include "gpfs_gpl.h"
 #include "vfs_gpfs.h"
 
-static bool gpfs_share_modes;
-static bool gpfs_leases;
 static bool gpfs_getrealfilename;
 static bool gpfs_winattr;
 
@@ -47,10 +45,6 @@ bool set_gpfs_sharemode(files_struct *fsp, uint32 
access_mask,
        unsigned int deny = GPFS_DENY_NONE;
        int result;
 
-       if (!gpfs_share_modes) {
-               return True;
-       }
-
        if (gpfs_set_share_fn == NULL) {
                return False;
        }
@@ -96,10 +90,6 @@ int set_gpfs_lease(int fd, int leasetype)
 {
        int gpfs_type = GPFS_LEASE_NONE;
 
-       if (!gpfs_leases) {
-               return True;
-       }
-
        if (gpfs_set_lease_fn == NULL) {
                errno = EINVAL;
                return -1;
@@ -249,8 +239,6 @@ void init_gpfs(void)
         init_gpfs_function(&gpfs_get_winattrs_fn,"gpfs_get_winattrs");
 
 
-       gpfs_share_modes = lp_parm_bool(-1, "gpfs", "sharemodes", True);
-       gpfs_leases      = lp_parm_bool(-1, "gpfs", "leases", True);
        gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename",
                                            True);
        gpfs_winattr = lp_parm_bool(-1, "gpfs", "winattr", False);
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 0c28408..5e21a4b 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -30,18 +30,29 @@
 #include "nfs4_acls.h"
 #include "vfs_gpfs.h"
 
+struct gpfs_config_data {
+       bool sharemodes;
+       bool leases;
+};
+
+
 static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, 
                                 uint32 share_mode, uint32 access_mask)
 {
 
+       struct gpfs_config_data *config;
+
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return -1);
+
        START_PROFILE(syscall_kernel_flock);
 
        kernel_flock(fsp->fh->fd, share_mode, access_mask);
 
-       if (!set_gpfs_sharemode(fsp, access_mask, fsp->share_access)) {
-
+       if (config->sharemodes
+               && !set_gpfs_sharemode(fsp, access_mask, fsp->share_access)) {
                return -1;
-
        }
 
        END_PROFILE(syscall_kernel_flock);
@@ -51,7 +62,14 @@ static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, 
files_struct *fsp,
 
 static int vfs_gpfs_close(vfs_handle_struct *handle, files_struct *fsp)
 {
-       if ((fsp->fh != NULL) && (fsp->fh->fd != -1)) {
+
+       struct gpfs_config_data *config;
+
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return -1);
+
+       if (config->sharemodes && (fsp->fh != NULL) && (fsp->fh->fd != -1)) {
                set_gpfs_sharemode(fsp, 0, 0);
        }
 
@@ -61,16 +79,23 @@ static int vfs_gpfs_close(vfs_handle_struct *handle, 
files_struct *fsp)
 static int vfs_gpfs_setlease(vfs_handle_struct *handle, files_struct *fsp, 
                             int leasetype)
 {
-       int ret;
+       struct gpfs_config_data *config;
+       int ret=0;
+
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return -1);
 
        START_PROFILE(syscall_linux_setlease);
 
-       if ( linux_set_lease_sighandler(fsp->fh->fd) == -1)
+       if (linux_set_lease_sighandler(fsp->fh->fd) == -1)
                return -1;
 
-       ret = set_gpfs_lease(fsp->fh->fd,leasetype);
+       if (config->leases) {
+               ret = set_gpfs_lease(fsp->fh->fd,leasetype);
+       }
 
-       if ( ret < 0 ) {
+       if (ret < 0) {
                /* This must have come from GPFS not being available */
                /* or some other error, hence call the default */
                ret = linux_setlease(fsp->fh->fd, leasetype);
@@ -1116,7 +1141,38 @@ static int vfs_gpfs_ntimes(struct vfs_handle_struct 
*handle,
 
 }
 
+int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
+                       const char *user)
+{
+       struct gpfs_config_data *config;
+       int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
+
+       if (ret < 0) {
+               return ret;
+       }
+
+       config = talloc_zero(handle->conn, struct gpfs_config_data);
+       if (!config) {
+               SMB_VFS_NEXT_DISCONNECT(handle);
+               DEBUG(0, ("talloc_zero() failed\n")); return -1;
+       }
+
+       config->sharemodes = lp_parm_bool(SNUM(handle->conn), "gpfs",
+                                       "sharemodes", true);
+
+       config->leases = lp_parm_bool(SNUM(handle->conn), "gpfs",
+                                       "leases", true);
+
+       SMB_VFS_HANDLE_SET_DATA(handle, config,
+                               NULL, struct gpfs_config_data,
+                               return -1);
+
+       return 0;
+}
+
+
 static struct vfs_fn_pointers vfs_gpfs_fns = {
+       .connect_fn = vfs_gpfs_connect,
        .kernel_flock = vfs_gpfs_kernel_flock,
         .linux_setlease = vfs_gpfs_setlease,
         .get_real_filename = vfs_gpfs_get_real_filename,


-- 
Samba Shared Repository

Reply via email to