From nobody@FreeBSD.org  Wed Jun 27 14:32:48 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 0200837B403
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Jun 2001 14:32:48 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.3/8.11.3) id f5RLWlB79998;
	Wed, 27 Jun 2001 14:32:47 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200106272132.f5RLWlB79998@freefall.freebsd.org>
Date: Wed, 27 Jun 2001 14:32:47 -0700 (PDT)
From: Umesh Krishnaswamy <umesh@juniper.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: When soft updates is enabled, cpl is not restored during an fsync syscall
X-Send-Pr-Version: www-1.0

>Number:         28466
>Category:       kern
>Synopsis:       When soft updates is enabled, cpl is not restored during an fsync syscall
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 27 14:40:00 PDT 2001
>Closed-Date:    Fri Aug 15 20:53:42 PDT 2003
>Last-Modified:  Fri Aug 15 20:53:42 PDT 2003
>Originator:     Umesh Krishnaswamy
>Release:        4.2-STABLE
>Organization:
Juniper Networks
>Environment:
I also have the fix for 'Free lock before returning from
process_worklist_item' (1.88 ffs_softdep.c). Else it is stock FreeBSD4.2.
>Description:
I have instrumentation in the syscall path to catch cases where the 
cpl after the syscall is not 0. I also have soft updates enabled.

When I type reboot at which time a some daemons in my system are doing
a bunch of fsyncs, I get the following error from my instrumentation.

Syscall 95 entered at cpl 0, exited at cpl 3fc0000

(kgdb) bt
#0  dumpsys () at ../../kern/kern_shutdown.c:562
#1  0xc018fbab in boot (howto=256) at ../../kern/kern_shutdown.c:317
#2  0xc01903e6 in panic (
    fmt=0xc0379be0 "Syscall %d entered at cpl %x, exited at cpl %x\n")
    at ../../kern/kern_shutdown.c:807
#3  0xc032192f in syscall2 (frame={tf_fs = 47, tf_es = 47, tf_ds = 47, 
      tf_edi = 528384, tf_esi = 0, tf_ebp = -1077938608, tf_isp = -577204268, 
      tf_ebx = 7, tf_edx = 1209838208, tf_ecx = 1610641556, tf_eax = 0, 
      tf_trapno = 12, tf_err = 2, tf_eip = 1209555732, tf_cs = 31, 
      tf_eflags = 642, tf_esp = -1077949932, tf_ss = 47})
    at ../../i386/i386/trap.c:1450
#4  0xc0314685 in Xint0x80_syscall () at ../../i386/i386/elf_machdep.c:120
(kgdb) p lk
$1 = {lkt_spl = 66846720, lkt_held = -1}


I do not have any problems when soft updates is not enabled. I guess 
there is some code in the fsync path that is not doing an splx.

I added the fix for 'Free lock before returning from
process_worklist_item' (1.88 ffs_softdep.c), but that did not help.

>How-To-Repeat:
1) Add instrumentation in trap.c to panic if the cpl after a syscall 
is not zero.
2) Enable softupdates
3) Touch a lot of files
4) Do fsyncs

Again, I do not hit this all the time. I have seen it twice in 20
attempts.
reboot

>Fix:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: dougb 
State-Changed-When: Thu Jan 23 02:20:48 PST 2003 
State-Changed-Why:  

Is this still a problem on a recent system? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=28466 
State-Changed-From-To: feedback->closed 
State-Changed-By: kris 
State-Changed-When: Fri Aug 15 20:53:34 PDT 2003 
State-Changed-Why:  
Feedback timeout 

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