Merge CTDB-related fixes from samba-ctdb 3.0 branch (http://samba.org/~tridge/3_0...
[ddiss/samba.git] / source3 / smbd / oplock_linux.c
index 05021b6c74e30f039a19bf33c80055271050a64a..fa7cb42bc6d9ca4bcb17e617ad0a35ef01fa755e 100644 (file)
@@ -93,17 +93,27 @@ static void set_capability(unsigned capability)
                return;
        }
 
-       data.effective |= (1<<capability);
+       if (0 == (data.effective & (1<<capability))) {
+               data.effective |= (1<<capability);
 
-       if (capset(&header, &data) == -1) {
-               DEBUG(3,("Unable to set %d capability (%s)\n", 
-                        capability, strerror(errno)));
+               if (capset(&header, &data) == -1) {
+                       DEBUG(3,("Unable to set %d capability (%s)\n", 
+                                capability, strerror(errno)));
+               }
        }
 }
 
 /*
- Call to set the kernel lease signal handler
-*/
+ * public function to get linux lease capability. Needed by some VFS modules (eg. gpfs.c)
+ */
+void linux_set_lease_capability(void)
+{
+       set_capability(CAP_LEASE);
+}
+
+/* 
+ * Call to set the kernel lease signal handler
+ */
 int linux_set_lease_sighandler(int fd)
 {
         if (fcntl(fd, F_SETSIG, RT_SIGNAL_LEASE) == -1) {