From a8d2654d52bd8539eb73cafe9da5666aad7c7d50 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 20 Nov 2020 14:19:21 +0100 Subject: [PATCH] build: Fix kernel oplock test 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 Reviewed-by: Jeremy Allison --- source3/wscript | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source3/wscript b/source3/wscript index 011594b3844..a370fae667f 100644 --- a/source3/wscript +++ b/source3/wscript @@ -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") -- 2.47.3