From nobody@FreeBSD.org  Mon Feb  5 11:22:20 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 56F9C37B491
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  5 Feb 2001 11:22:20 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f15JMKx61176;
	Mon, 5 Feb 2001 11:22:20 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200102051922.f15JMKx61176@freefall.freebsd.org>
Date: Mon, 5 Feb 2001 11:22:20 -0800 (PST)
From: thomas.stratmann@ruhr-uni-bochum.de
To: freebsd-gnats-submit@FreeBSD.org
Subject: ktrace not syncing .out file before panic
X-Send-Pr-Version: www-1.0

>Number:         24882
>Category:       kern
>Synopsis:       ktrace not syncing .out file before panic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 05 11:30:01 PST 2001
>Closed-Date:    Sat Mar 08 20:48:04 UTC 2008
>Last-Modified:  Sat Mar 08 20:48:04 UTC 2008
>Originator:     Thomas Stratmann
>Release:        4.2-Stable
>Organization:
>Environment:
#0: Tue Jan 30 23:32:49 GMT 2001
root@byteslave:/usr/obj/usr/src/sys/KER1 i386
>Description:
Tried to follow bug in mount which caused panic. Did ktrace on mount
call -> empty ktrace.out (zero bytes)
>How-To-Repeat:
Call ktrace something, where something causes kernel panic.
After reboot, look at ktrace.out inside last pwd
>Fix:
kernel tracing does not sync writing to .out-file. If VOP_FSync call is
added inside ktrwrite function in kern_ktrace.c, it works well: I saw
the actual kernel call which caused the panic as the last line output
from kdump. Syncing must be done just before unflocking, of course. The
line of code I added is out of reach for me now - anyway it probably is
pretty useless as I lack kernel hacking experience and did not care
deeply about the exact meanings of the arguments.

As syncing is generally a speed vs. reliability tradeoff, it should be
considered to introduce an option to ktrace which toggles syncing -
if the manpage then is elaborate enough about the issue, even less
experienced users will be able to give more precise error postings.

btw the problem appeared on a 4.1-Stable I ran, but the part inside the
ktrwrite function seemed unchanged to me when I looked at kern_ktrace.c
on my 4.2-Stable box.

This is my first posting here - would me delighted to get mail if anyone
takes care about it to see for myself how useful this is. Thanx alot!

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: rwatson 
State-Changed-When: Sat Mar 8 20:44:37 UTC 2008 
State-Changed-Why:  
First off, apologies for the several years it has taken for someone to look 
at this PR.  Unfortunately, I'm going to go ahead and close it, and point 
you at the kern.sync_on_panic sysctl, which determines whether or not the 
system tries to sync file systems on panic.  As you point out, it is a 
constant trade-off between performance and stability of data, and ktrace is 
not generally a tool that is intended to operate properly in the presence 
of kernel data corruption/panic.  What we might want to consider doing is 
allowing a bound on the amount of un-written ktrace data, sized by data or 
time, but I'm not sure that will necessarily help the case of usin ktrace 
to debug things leading up to a panic.  Recent FreeBSD versions include a 
tool, KTR, to help trace those scenarios, and shortly DTrace will also be 
available. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=24882 
>Unformatted:
