diff options
author | jhb <jhb@FreeBSD.org> | 2009-01-20 16:35:34 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-01-20 16:35:34 +0000 |
commit | 19686e364d4eaa10fb7ddc1226b367ef47a22480 (patch) | |
tree | ba14b0a460887586c838a5c342ee9a26c03ae4dd /sys/ufs | |
parent | ba6a8e1391694fa0e8c5812a554554200e385452 (diff) | |
download | FreeBSD-src-19686e364d4eaa10fb7ddc1226b367ef47a22480.zip FreeBSD-src-19686e364d4eaa10fb7ddc1226b367ef47a22480.tar.gz |
Add a comment explaining why the "bufwait" / "dirhash" LOR reported by
WITNESS will not actually result in a deadlock.
Discussed with: kib
MFC after: 1 week
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_dirhash.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c index 0eacb58..3b6d5e1 100644 --- a/sys/ufs/ufs/ufs_dirhash.c +++ b/sys/ufs/ufs/ufs_dirhash.c @@ -126,6 +126,18 @@ static struct mtx ufsdirhash_mtx; * free a dirhash structure that was recycled by ufsdirhash_recycle(). * * The dirhash lock may be held across io operations. + * + * WITNESS reports a lock order reversal between the "bufwait" lock + * and the "dirhash" lock. However, this specific reversal will not + * cause a deadlock. To get a deadlock, one would have to lock a + * buffer followed by the dirhash while a second thread locked a + * buffer while holding the dirhash lock. The second order can happen + * under a shared or exclusive vnode lock for the associated directory + * in lookup(). The first order, however, can only happen under an + * exclusive vnode lock (e.g. unlink(), rename(), etc.). Thus, for + * a thread to be doing a "bufwait" -> "dirhash" order, it has to hold + * an exclusive vnode lock. That exclusive vnode lock will prevent + * any other threads from doing a "dirhash" -> "bufwait" order. */ static void |