Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] Handle OFD lock flags
@ 2019-01-15 12:31 Stefan Agner
  2019-01-15 14:45 ` Seebs
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Agner @ 2019-01-15 12:31 UTC (permalink / raw)
  To: openembedded-core, seebs

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@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Handle OFD lock flags
  2019-01-15 12:31 [PATCH] Handle OFD lock flags Stefan Agner
@ 2019-01-15 14:45 ` Seebs
  0 siblings, 0 replies; 2+ messages in thread
From: Seebs @ 2019-01-15 14:45 UTC (permalink / raw)
  To: Stefan Agner; +Cc: openembedded-core

On Tue, 15 Jan 2019 13:31:13 +0100
Stefan Agner <stefan@agner.ch> wrote:

> +	case F_OFD_GETLK:
> +	case F_OFD_SETLK:
> +	case F_OFD_SETLKW:

These probably need an #ifdef for systems that don't have those names
yet, but otherwise this looks reasonable?

-s


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-15 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-15 12:31 [PATCH] Handle OFD lock flags Stefan Agner
2019-01-15 14:45 ` Seebs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox