From 7181624aaa3ccdc83ab87edd795ed5cd3f2f124b Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Thu, 30 May 2002 05:55:22 +0000 Subject: [PATCH] Record the file, line, and pid of the last successful shared lock holder. This is useful as a last effort in debugging file system deadlocks. This is enabled via 'options DEBUG_LOCKS' --- sys/kern/kern_lock.c | 6 ++++++ sys/sys/lockmgr.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index fddfd26b69c..5189bb71567 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -259,6 +259,12 @@ debuglockmgr(lkp, flags, interlkp, td, name, file, line) if (error) break; sharelock(lkp, 1); +#if defined(DEBUG_LOCKS) + lkp->lk_slockholder = pid; + lkp->lk_sfilename = file; + lkp->lk_slineno = line; + lkp->lk_slockername = name; +#endif break; } /* diff --git a/sys/sys/lockmgr.h b/sys/sys/lockmgr.h index 9ba18847c70..b5bb25175d2 100644 --- a/sys/sys/lockmgr.h +++ b/sys/sys/lockmgr.h @@ -62,6 +62,11 @@ struct lock { const char *lk_filename; const char *lk_lockername; int lk_lineno; + + pid_t lk_slockholder; + const char *lk_sfilename; + const char *lk_slockername; + int lk_slineno; #endif }; /*