Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Nov 2001 17:35:17 +0300 (MSK)
From:      Maxim Konovalov <maxim@macomnet.ru>
To:        current@freebsd.org
Subject:   has 'options LOCKF_DEBUG' ever worked? (w/ patch)
Message-ID:  <20011108171446.Q82640-100000@news1.macomnet.ru>

next in thread | raw e-mail | index | archive | help

Hello,

Seems 'options LOCKF_DEBUG' does not work at all.

How to repeat:

echo 'options LOCKF_DEBUG' >> KERNELCONF,
recompile the kernel, install it, reboot,

# sysctl -w debug.lockf_debug=1
$ lockf -k /etc/passwd sleep 1

.. and got the panic:

Script started on Wed Nov  7 14:03:14 2001
miss# gdb -k /usr/obj/usr/src/sys/MISS/kernel.debug vmcore.4
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...
IdlePTD 3858432
initial pcb at 303b40
panicstr: bdwrite: buffer is not busy
panic messages:
---
Fatal trap 12: page fault while in kernel mode
fault virtual address	= 0x1d
fault code		= supervisor read, page not present
instruction pointer	= 0x8:0xc018f581
stack pointer	        = 0x10:0xc66ebb40
frame pointer	        = 0x10:0xc66ebb50
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 416 (lockf)
trap number		= 12
panic: page fault

syncing disks... panic: bdwrite: buffer is not busy
Uptime: 6m54s

dumping to dev ad0s1b, offset 393600
dump ata0: resetting devices .. done
63 62 61 [CTRL-C to abort] 60 59 [CTRL-C to abort] 58 [CTRL-C to abort] 57 [CTRL-C to abort] 56 [CTRL-C to abort] 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
---
#0  0xc0197d7e in dumpsys () at /usr/src/sys/kern/kern_shutdown.c:476
476	}
(kgdb) bt
#0  0xc0197d7e in dumpsys () at /usr/src/sys/kern/kern_shutdown.c:476
#1  0xc0df244c in ?? ()
#2  0xc0197b6b in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:334
#3  0xc0197f9d in panic (fmt=0xc0299721 "bdwrite: buffer is not busy")
    at /usr/src/sys/kern/kern_shutdown.c:632
#4  0xc01c93e3 in bdwrite (bp=0xc213a91c) at /usr/src/sys/kern/vfs_bio.c:841
#5  0xc02286ad in ffs_update (vp=0xc65cb380, waitfor=0)
    at /usr/src/sys/ufs/ffs/ffs_inode.c:119
#6  0xc023539a in ffs_fsync (ap=0xc66eb9f4)
    at /usr/src/sys/ufs/ffs/ffs_vnops.c:292
#7  0xc02339aa in ffs_sync (mp=0xc0de5e00, waitfor=2, cred=0xc05ade00,
    td=0xc031a8e4) at vnode_if.h:441
#8  0xc01d59c5 in sync (td=0xc031a8e4, uap=0x0)
    at /usr/src/sys/kern/vfs_syscalls.c:662
#9  0xc0197770 in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:244
#10 0xc0197f9d in panic (fmt=0xc02b129e "%s")
    at /usr/src/sys/kern/kern_shutdown.c:632
#11 0xc02747e3 in trap_fatal (frame=0xc66ebb00, eva=29)
    at /usr/src/sys/i386/i386/trap.c:939
#12 0xc0274525 in trap_pfault (frame=0xc66ebb00, usermode=0, eva=29)
    at /usr/src/sys/i386/i386/trap.c:851
#13 0xc0273f37 in trap (frame={tf_fs = -1071841256, tf_es = -965869552,
      tf_ds = 16, tf_edi = 0, tf_esi = 0, tf_ebp = -965821616,
      tf_isp = -965821652, tf_ebx = -1058144640, tf_edx = -1071033256,
      tf_ecx = -1069469696, tf_eax = 1, tf_trapno = 12, tf_err = 0,
      tf_eip = -1072106111, tf_cs = 8, tf_eflags = 66118,
      tf_esp = -1071033241, tf_ss = 0}) at /usr/src/sys/i386/i386/trap.c:403
#14 0xc0266488 in alltraps_with_regs_pushed ()
#15 0xc018ea2a in lf_setlock (lock=0xc0edfe80)
    at /usr/src/sys/kern/kern_lockf.c:211
#16 0xc018e9c3 in lf_advlock (ap=0xc66ebc04, head=0xc0edd93c, size=0)
    at /usr/src/sys/kern/kern_lockf.c:176
#17 0xc023d30e in ufs_advlock (ap=0xc66ebc04)
    at /usr/src/sys/ufs/ufs/ufs_vnops.c:2190
#18 0xc023d7f9 in ufs_vnoperate (ap=0xc66ebc04)
    at /usr/src/sys/ufs/ufs/ufs_vnops.c:2658
#19 0xc01d64e3 in open (td=0xc6691e04, uap=0xc66ebd20) at vnode_if.h:843
#20 0xc0274c64 in syscall (frame={tf_fs = 47, tf_es = 47, tf_ds = 47,
      tf_edi = -1, tf_esi = -1077938004, tf_ebp = -1077938176,
      tf_isp = -965821068, tf_ebx = -1077937786, tf_edx = -1077938012,
      tf_ecx = 672100864, tf_eax = 5, tf_trapno = 12, tf_err = 2,
      tf_eip = 671764168, tf_cs = 31, tf_eflags = 663, tf_esp = -1077938220,
      tf_ss = 47}) at /usr/src/sys/i386/i386/trap.c:1127
#21 0xc02664bd in syscall_with_err_pushed ()
#22 0x8048ae2 in ?? ()
#23 0x80488f1 in ?? ()
(kgdb) quit    p   quit
miss# exit
exit

Script done on Wed Nov  7 14:04:38 2001

It panics because of if_inode is not initiliazed:

/sys/kern/kern_lockf.c:1.25:153

/*      lock->lf_inode = ip; */ /* XXX JH */

I have no idea what ``JH'' means, the comment appeared in 1.10.

The patch against kern_lockf.c:1.38

Index: kern_lockf.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_lockf.c,v
retrieving revision 1.38
diff -u -r1.38 kern_lockf.c
--- kern_lockf.c	12 Sep 2001 08:37:44 -0000	1.38
+++ kern_lockf.c	7 Nov 2001 10:59:04 -0000
@@ -163,7 +163,7 @@
 	lock->lf_start = start;
 	lock->lf_end = end;
 	lock->lf_id = ap->a_id;
-/*	lock->lf_inode = ip; */	/* XXX JH */
+	lock->lf_inode = VTOI(ap->a_vp);
 	lock->lf_type = fl->l_type;
 	lock->lf_head = head;
 	lock->lf_next = (struct lockf *)0;

Works for me on yesterday -current.

- -maxim

-- 
Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
phone: +7 (095) 796-9079, mailto: maxim@macomnet.ru


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011108171446.Q82640-100000>