From 00959280b2801d21a2e637023c8b3006c3d24ffd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 May 2007 19:54:26 +0000 Subject: r23228: Merge cleanup to the gpfs module from Tridge. Also potentially disable gpfs share modes in special situations. This might be split up in several modules later. (This used to be commit 553fe9245165ce4a14902daa722935c94ff32d61) --- source3/modules/gpfs.c | 61 +++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 33 deletions(-) (limited to 'source3/modules') diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c index 19050ad3ca..d274984ec7 100644 --- a/source3/modules/gpfs.c +++ b/source3/modules/gpfs.c @@ -25,6 +25,7 @@ #include "gpfs_gpl.h" static void *libgpfs_handle = NULL; +static BOOL gpfs_share_modes; 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); @@ -39,6 +40,10 @@ 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; } @@ -84,6 +89,10 @@ int set_gpfs_lease(int fd, int leasetype) { int gpfs_type = GPFS_LEASE_NONE; + if (!gpfs_share_modes) { + return True; + } + if (gpfs_set_lease_fn == NULL) { errno = EINVAL; return -1; @@ -138,15 +147,7 @@ void init_gpfs(void) if (gpfs_set_share_fn == NULL) { DEBUG(3, ("libgpfs_gpl.so does not contain the symbol " "'gpfs_set_share'\n")); - sys_dlclose(libgpfs_handle); - - /* leave libgpfs_handle != NULL around, no point - in trying twice */ - gpfs_set_share_fn = NULL; - gpfs_set_lease_fn = NULL; - gpfs_getacl_fn = NULL; - gpfs_putacl_fn = NULL; - return; + goto failed; } gpfs_set_lease_fn = sys_dlsym(libgpfs_handle, "gpfs_set_lease"); @@ -155,45 +156,39 @@ void init_gpfs(void) "'gpfs_set_lease'\n")); sys_dlclose(libgpfs_handle); - /* leave libgpfs_handle != NULL around, no point - in trying twice */ - gpfs_set_share_fn = NULL; - gpfs_set_lease_fn = NULL; - gpfs_getacl_fn = NULL; - gpfs_putacl_fn = NULL; - return; + goto failed; } gpfs_getacl_fn = sys_dlsym(libgpfs_handle, "gpfs_getacl"); if (gpfs_getacl_fn == NULL) { DEBUG(3, ("libgpfs_gpl.so does not contain the symbol " "'gpfs_getacl'\n")); - sys_dlclose(libgpfs_handle); - - /* leave libgpfs_handle != NULL around, no point - in trying twice */ - gpfs_set_share_fn = NULL; - gpfs_set_lease_fn = NULL; - gpfs_getacl_fn = NULL; - gpfs_putacl_fn = NULL; - return; + goto failed; } gpfs_putacl_fn = sys_dlsym(libgpfs_handle, "gpfs_putacl"); if (gpfs_putacl_fn == NULL) { DEBUG(3, ("libgpfs_gpl.so does not contain the symbol " "'gpfs_putacl'\n")); - sys_dlclose(libgpfs_handle); + goto failed; + } - /* leave libgpfs_handle != NULL around, no point - in trying twice */ - gpfs_set_share_fn = NULL; - gpfs_set_lease_fn = NULL; - gpfs_getacl_fn = NULL; - gpfs_putacl_fn = NULL; - return; + if (lp_parm_bool(-1, "gpfs", "sharemodes", True)) { + gpfs_share_modes = True; + } else { + gpfs_share_modes = False; } + return; + +failed: + sys_dlclose(libgpfs_handle); + /* leave libgpfs_handle != NULL around, no point + in trying twice */ + gpfs_set_share_fn = NULL; + gpfs_set_lease_fn = NULL; + gpfs_getacl_fn = NULL; + gpfs_putacl_fn = NULL; } #else -- cgit