aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-01-29 23:48:55 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-02-17 23:22:05 +0000
commitfa3bd463cee5c3abeac29a83dc86eb3abfa97b06 (patch)
tree00effb7f68f6bd16e710dad29fb806ce2c2554e1 /sys/sys
parent351d06eeb509a420f3470c96b4a265467c87e2c2 (diff)
downloadsrc-fa3bd463cee5c3abeac29a83dc86eb3abfa97b06.tar.gz
src-fa3bd463cee5c3abeac29a83dc86eb3abfa97b06.zip
lockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK)
or EX_SHLOCK. Do it by setting a vnode iflag indicating that the locking exclusive open is in progress, and not allowing F_LOCK request to make a progress until the first open finishes. Requested by: mckusick Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28697
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/fcntl.h1
-rw-r--r--sys/sys/vnode.h2
2 files changed, 3 insertions, 0 deletions
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
index 3c29c04e46db..70e68246be13 100644
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -287,6 +287,7 @@ typedef __pid_t pid_t;
#define F_POSIX 0x040 /* Use POSIX semantics for lock */
#define F_REMOTE 0x080 /* Lock owner is remote NFS client */
#define F_NOINTR 0x100 /* Ignore signals when waiting */
+#define F_FIRSTOPEN 0x200 /* First right to advlock file */
#endif
/*
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 639a16881e09..9d68f9e236f6 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -254,6 +254,8 @@ struct xvnode {
#define VI_DOINGINACT 0x0004 /* VOP_INACTIVE is in progress */
#define VI_OWEINACT 0x0008 /* Need to call inactive */
#define VI_DEFINACT 0x0010 /* deferred inactive */
+#define VI_FOPENING 0x0020 /* In open, with opening process having the
+ first right to advlock file */
#define VV_ROOT 0x0001 /* root of its filesystem */
#define VV_ISTTY 0x0002 /* vnode represents a tty */