summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/modules/gpfs.c61
1 files changed, 28 insertions, 33 deletions
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