diff options
author | Christian Ambach <christian.ambach@de.ibm.com> | 2010-10-08 13:15:57 +0200 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2010-10-13 12:53:16 +0000 |
commit | 22018b8b887c2677d30bbb4589f800197edf0e98 (patch) | |
tree | 589567f9125233c9c59133d61b41db123be62f12 /source3 | |
parent | 9e4a386d6782b51325d28e41a1bef82b8e1ea31d (diff) | |
download | samba-22018b8b887c2677d30bbb4589f800197edf0e98.tar.gz samba-22018b8b887c2677d30bbb4589f800197edf0e98.tar.bz2 samba-22018b8b887c2677d30bbb4589f800197edf0e98.zip |
s3:vfs:gpfs convert sharemodes/leases parameter
convert gpfs:sharemodes and gpfs:leases parameters from a global setting
to a per share setting
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/gpfs.c | 12 | ||||
-rw-r--r-- | source3/modules/vfs_gpfs.c | 72 |
2 files changed, 64 insertions, 20 deletions
diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c index e05980888b..c8fb88d92e 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 5fdcef94db..be035a83bc 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); @@ -1103,7 +1128,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 syncops_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, |