[OE-core] [PATCH] Handle OFD lock flags

Stefan Agner stefan at agner.ch
Tue Jan 15 12:31:13 UTC 2019


Linux 3.15 and newer introduced new open file description locks.
Currently pseudo prints a warning if fcntl is used with OFD locks:
  unknown fcntl argument 37, assuming long argument.

However, calls to fcntl with a OFC lock set need a struct flock
pointer. Treat F_OFD_GETLK (and friends) like F_GETLK (and friends).

This issue has been observed with ostree. Comparing strace output
between two runs with/without this patch shows the same fcntl calls,
hence it seems not to matter in practice.

Signed-off-by: Stefan Agner <stefan at agner.ch>
---
Hi,

I noticed this when using meta-updater which uses ostree to commit
the root file system. We observe this warnings on every build, but
the last error message only rather seldom:

...
unknown fcntl argument 37, assuming long argument.
unknown fcntl argument 37, assuming long argument.
unknown fcntl argument 37, assuming long argument.
error: Locking repo exclusive failed: Resource temporarily unavailable

Looking at a strace it seems that with pseudo in place the fcntl
seems to pass the argument properly nontheless:
fcntl(7, F_OFD_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
fcntl(7, F_OFD_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0

So this effectively just gets rid of the warnings.

--
Stefan

 ports/linux/guts/fcntl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ports/linux/guts/fcntl.c b/ports/linux/guts/fcntl.c
index 639fd24..3991e25 100644
--- a/ports/linux/guts/fcntl.c
+++ b/ports/linux/guts/fcntl.c
@@ -50,6 +50,9 @@
 	case F_GETLK:
 	case F_SETLK:
 	case F_SETLKW:
+	case F_OFD_GETLK:
+	case F_OFD_SETLK:
+	case F_OFD_SETLKW:
 		rc = real_fcntl(fd, cmd, lock);
 		break;
 #if defined(F_GETLK64) && (F_GETLK64 != F_GETLK)
-- 
2.20.1



More information about the Openembedded-core mailing list