NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/60187: diagnostic tool to find who holds what file locks



>Number:         60187
>Category:       bin
>Synopsis:       diagnostic tool to find who holds what file locks
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 12 14:10:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The NetBSD Foundalock
>Environment:
>Description:

	When a set of processes hangs because they're all waiting for a
	file lock, it would be nice to know who holds the lock.

	For POSIX file locks, fcntl(F_SETLK), one can query which
	process holds a lock by fcntl(F_GETLK).  But that's only for
	the `completely stupid' SysV/POSIX semantics of file locks,
	which most applications -- including the flock(1) utility --
	don't use.  Applications that use BSD file locks instead, with
	flock(2), don't expose this information.

	There should be a diagnostic tool (even if it is not reliable
	for applications to make decisions, much like the kernel
	mutex_owner function) for finding what processes hold open
	files with locks that would cause another process trying to
	take a lock to hang.

	There should maybe also be a diagnostic tool to just print all
	the file locks that are currently held.  This is a little
	tricky because there is no vfs-generic way to find file locks:
	all the file locking records are per-fs, for reasons unclear to
	me since they all seem to defer to the lf_advlock(9) function.

>How-To-Repeat:

	try to diagnose why an application is hanging on file locks

>Fix:

	Yes, please!




Home | Main Index | Thread Index | Old Index