s3:vfs_gpfs: make sure parameters are set correctly for leases
authorChristian Ambach <ambi@samba.org>
Tue, 7 Aug 2012 16:42:39 +0000 (18:42 +0200)
committerChristian Ambach <ambi@samba.org>
Thu, 16 Aug 2012 16:05:29 +0000 (18:05 +0200)
gpfs:leases requires kernel oplocks = yes and level2 oplocks = no
to work properly

make sure those are set correctly for a share

source3/modules/vfs_gpfs.c

index 874d00d048ce6fb273c3510e828c6d5e0ec60812..a988c0916417c62d154bc05814d2d2091d087a5e 100644 (file)
@@ -1505,6 +1505,31 @@ static int vfs_gpfs_connect(struct vfs_handle_struct *handle,
                                NULL, struct gpfs_config_data,
                                return -1);
 
+       if (config->leases) {
+               /*
+                * GPFS lease code is based on kernel oplock code
+                * so make sure it is turned on
+                */
+               if (!lp_kernel_oplocks(SNUM(handle->conn))) {
+                       DEBUG(5, ("Enabling kernel oplocks for "
+                                 "gpfs:leases to work\n"));
+                       lp_do_parameter(SNUM(handle->conn), "kernel oplocks",
+                                       "true");
+               }
+
+               /*
+                * as the kernel does not properly support Level II oplocks
+                * and GPFS leases code is based on kernel infrastructure, we
+                * need to turn off Level II oplocks if gpfs:leases is enabled
+                */
+               if (lp_level2_oplocks(SNUM(handle->conn))) {
+                       DEBUG(5, ("gpfs:leases are enabled, disabling "
+                                 "Level II oplocks\n"));
+                       lp_do_parameter(SNUM(handle->conn), "level2 oplocks",
+                                       "false");
+               }
+       }
+
        return 0;
 }