summaryrefslogtreecommitdiff
path: root/source3/smbd/oplock_linux.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-06-20 15:50:00 -0700
committerJeremy Allison <jra@samba.org>2012-06-21 21:53:58 +0200
commitdd763d6d8e999b03164cef79a97c1350a556fef7 (patch)
treef76141216978db02606c6a2d36549cca93668a5f /source3/smbd/oplock_linux.c
parent7b43053ad6d1ee00895f592e7524c8591894144b (diff)
downloadsamba-dd763d6d8e999b03164cef79a97c1350a556fef7.tar.gz
samba-dd763d6d8e999b03164cef79a97c1350a556fef7.tar.bz2
samba-dd763d6d8e999b03164cef79a97c1350a556fef7.zip
Fix bug #8974 - Kernel oplocks are broken when uid(file) != uid(process).
Based on a fix from "Etienne Dechamps " <e-t172@akegroup.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Jun 21 21:53:58 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3/smbd/oplock_linux.c')
-rw-r--r--source3/smbd/oplock_linux.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index 190578e0cc..7fa9b7cb2c 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -76,9 +76,22 @@ int linux_setlease(int fd, int leasetype)
{
int ret;
+ /* First set the signal handler. */
+ if (linux_set_lease_sighandler(fd) == -1) {
+ return -1;
+ }
ret = fcntl(fd, F_SETLEASE, leasetype);
if (ret == -1 && errno == EACCES) {
set_effective_capability(LEASE_CAPABILITY);
+ /*
+ * Bug 8974 - work around Linux kernel bug
+ * https://bugzilla.kernel.org/show_bug.cgi?id=43336.
+ * "fcntl(F_SETLEASE) resets signal number when
+ * called multiple times"
+ */
+ if (linux_set_lease_sighandler(fd) == -1) {
+ return -1;
+ }
ret = fcntl(fd, F_SETLEASE, leasetype);
}