locks: report l_pid as -1 for FL_FILE_PVT locks
authorJeff Layton <jlayton@redhat.com>
Mon, 3 Feb 2014 17:13:09 +0000 (12:13 -0500)
committerDanny Wood <danwood76@gmail.com>
Tue, 2 Feb 2021 12:39:47 +0000 (12:39 +0000)
commit526625732179fa722dd55ae9165bb9855cf8e2a5
tree241e1e1f8706d2c6406c6bf33efde7372fadf944
parentc318b4d3da3c0451e193201daaa2ac3fc8c26cb5
locks: report l_pid as -1 for FL_FILE_PVT locks

FL_FILE_PVT locks are no longer tied to a particular pid, and are
instead inheritable by child processes. Report a l_pid of '-1' for
these sorts of locks since the pid is somewhat meaningless for them.

This precedent comes from FreeBSD. There, POSIX and flock() locks can
conflict with one another. If fcntl(F_GETLK, ...) returns a lock set
with flock() then the l_pid member cannot be a process ID because the
lock is not held by a process as such.

Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Change-Id: I7d702fcaaaf8592356926d51b60e53ee217ca747
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
fs/locks.c