Bug 224892 - ufs: lock order reversal
Summary: ufs: lock order reversal
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: powerpc Any
: --- Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-04 12:52 UTC by Breno Leitao
Modified: 2018-01-04 21:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Breno Leitao 2018-01-04 12:52:22 UTC
I am running current freebsd (Jan 4st - git commit 6fceb757ffd5b050eca4c75ecbd350710b11db5e) on a powerpc64 machine and I am facing a file system lock order reversal.

lock order reversal:
 1st 0xc0000000008ac748 bufwait (bufwait) @ /root/kernel/freebsd/sys/kern/vfs_bio.c:3564
 2nd 0x4985200 dirhash (dirhash) @ /root/kernel/freebsd/sys/ufs/ufs/ufs_dirhash.c:289
stack backtrace:
#0 0x5ec138 at ??+0
#1 0x5ee360 at ??+0
#2 0x576c2c at ??+0
#3 0x870e50 at ??+0
#4 0x871314 at ??+0
#5 0x875008 at ??+0
#6 0x87f6b4 at ??+0
#7 0x923d0c at ??+0
#8 0x66ede4 at ??+0
#9 0x66ef2c at ??+0
#10 0x908890 at ??+0
#11 0x8fd938 at ??+0


$ awk 'NR >= 3560 && NR <= 3570' /root/kernel/freebsd/sys/kern/vfs_bio.c    
		if (flags & GB_LOCK_NOWAIT)
			lockflags |= LK_NOWAIT;

		error = BUF_TIMELOCK(bp, lockflags,
		    BO_LOCKPTR(bo), "getblk", slpflag, slptimeo);

		/*
		 * If we slept and got the lock we have to restart in case
		 * the buffer changed identities.
		 */
		if (error == ENOLCK)


$ awk 'NR >= 285 && NR <= 295' /root/kernel/freebsd/sys/ufs/ufs/ufs_dirhash.c

	dh = ip->i_dirhash;
	if (dh == NULL)
		return (NULL);
	sx_xlock(&dh->dh_lock);
	if (dh->dh_hash != NULL)
		return (dh);
	ufsdirhash_free_locked(ip);
	return (NULL);
}
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2018-01-04 18:19:51 UTC
An old false positive: http://sources.zabbadoz.net/freebsd/lor/261.html
Comment 2 Conrad Meyer freebsd_committer freebsd_triage 2018-01-04 18:21:06 UTC
More on WITNESS and why it reports false positives:
https://blog.delphij.net/2004/05/freebsd-lor-pag.html
Comment 3 Andriy Gapon freebsd_committer freebsd_triage 2018-01-04 21:28:35 UTC
(In reply to Breno Leitao from comment #0)
Please re-open this bug if you actually experience any technical problem.