]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
build: Fix kernel oplock test
authorVolker Lendecke <vl@samba.org>
Fri, 20 Nov 2020 13:19:21 +0000 (14:19 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 4 Dec 2020 21:08:38 +0000 (21:08 +0000)
In a pure docker environment with overlayfs F_GETLEASE works on /tmp,
but F_SETLEASE does not. This test now correctly detects that.

The effect is that the samba-fileserver environment would run fine in
a shared gitlab runner, at the price of not testing kernel oplocks. We
could move the kernel oplock tests to another environment that for
other reasons can't run on shared gitlab runners.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/wscript

index 011594b38442244f2195a458847c697e11a493f7..a370fae667fc7eddedc47b141c71415132de4a11 100644 (file)
@@ -184,8 +184,12 @@ main() {
 #ifndef F_GETLEASE
 #define F_GETLEASE 1025
 #endif
-main() {
-        exit(fcntl(open("/tmp", O_RDONLY), F_GETLEASE, 0) == -1 ?  1 : 0);
+int main() {
+       const char *fname="/tmp/oplock-test.txt";
+       int fd = open(fname, O_RDWR|O_CREAT, 0644);
+       int ret = fcntl(fd, F_SETLEASE, F_WRLCK);
+       unlink(fname);
+       return (ret == -1) ? 1 : 0;
 }''', 'HAVE_KERNEL_OPLOCKS_LINUX', addmain=False, execute=True,
         msg="Checking for Linux kernel oplocks")