locking against myself in getcacheblk()?

Matthew Dillon dillon at apollo.backplane.com
Sun Dec 26 12:08:59 PST 2010

::I managed to trigger this panic while trying to find out how to
::reliably reproduce another panic (lockmgr: non-zero exclusive count).
::Just issue the following command on a machine running recent -DEVELOPMENT
::(either on i386 or x86_64):
::$ grep -r --mmap SomeString /usr/pkgsrc

    Ok, this grep caused a 'lockmgr: locking against myself' panic
    due to the grep code doing a read() system call INSIDE the same
    mmap()'d file, causing the uiomove/copyout call to overlap the
    buffer cache buffer being held by the read().

    Hmm.  It looks like it hit a read-ahead-mark and called readrest
    on a valid page.  This should be an allowed operation but I'm going
    to think a bit on how to fix it.. I'll probably have to add a hold_count
    field to the buffer cache buf structure.

    You should be able to temporarily work around the bug by commenting
    out the PG_RAM test on line 1083 of vm/vm_fault.c:

#if 0
	if (fs->m->flags & PG_RAM) {
		if (debug_cluster)
		vm_page_flag_clear(fs->m, PG_RAM);
		goto readrest;

    This code isn't the bug, but it is probably triggering the bug.  If
    that fixes this secondary issue for you you can go back to finding
    the primary panic you were trying to track down and I will continue
    looking into this one figuring out how to fix it properly.


More information about the Bugs mailing list