From olgeni@uli.it  Thu Nov  9 14:00:16 2000
Return-Path: <olgeni@uli.it>
Received: from vega.uli.it (vega.uli.it [62.212.0.2])
	by hub.freebsd.org (Postfix) with ESMTP id A9A3237B4C5
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  9 Nov 2000 14:00:15 -0800 (PST)
Received: from olgeni.uli.it (olgeni.uli.it [62.212.0.22])
	by vega.uli.it (Postfix) with ESMTP id DE5E03B00E
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  9 Nov 2000 23:00:09 +0100 (CET)
Message-Id: <Pine.BSF.4.21.0011092258440.2122-100000@olgeni.localdomain.net>
Date: Thu, 9 Nov 2000 23:00:22 +0100 (CET)
From: Jimmy <olgeni@uli.it>
To: FreeBSD-gnats-submit@freebsd.org
Subject: mkfifo can cause ext2fs to break sync at shutdown

>Number:         22726
>Category:       kern
>Synopsis:       mkfifo can cause ext2fs to break sync at shutdown
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 09 14:10:00 PST 2000
>Closed-Date:    Sat Nov 11 05:16:14 PST 2000
>Last-Modified:  Sat Nov 11 05:20:04 PST 2000
>Originator:     Jimmy Olgeni
>Release:        FreeBSD 4.2-BETA i386
>Organization:
Colby
>Environment:

FreeBSD 4.2-BETA (recent cvsup)

>Description:

Running mkfifo on a mounted ext2 filesystem (removable media) can
cause the sync at shutdown time to fail. Filesystems are not umounted
and checked by fsck at the next reboot.

>How-To-Repeat:

* Create an ext2fs partition on a removable media (I tried with a SCSI
  MO drive)

* Mount the partition, run "mkfifo SOMEFIFO" on the mounted
  filesystem.

* Run "sync" just to be sure, and umount the partition. sysstat will report
  that there are 0 dirty buffers.

* Eject the media (the drive becomes unlocked at umount time and allows eject). 

* Run "shutdown -h now", the kernel will try to write on the removed media
  (even after umount) and will complain about the missing disk. The "syncing
  disks" sequence will fail and the system will shut down with some buffers
  not committed. At the next reboot the other filesystems will be checked by
  fsck. ext2fs must be repaired on Linux: e2fsck will complain about "bitmap
  differences".

>Fix:

Running shutdown with the media still in the drive helps, but I didn't
try to insert a different disk and see what gets written.


>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: Jimmy <olgeni@uli.it>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/22726: mkfifo can cause ext2fs to break sync at shutdown
Date: Sat, 11 Nov 2000 02:21:22 +1100 (EST)

 On Thu, 9 Nov 2000, Jimmy wrote:
 
 > >Synopsis:       mkfifo can cause ext2fs to break sync at shutdown
 
 Syncing at unmount time was actually broken for all types of files.
 
 This is now fixed in -current.  The commit message was:
 ---
 Quick fix for not writing group descriptor group, inode bitmaps or
                                            ^^^^^ oops, should be "blocks"
 block bitmaps before unmount() completes.  They were written using
 bdwrite(), so they were normally written less than 32 seconds after
 unmount(), but this is too late if the media is removed or the system
 is rebooted soon after unmount().  sync()ing before unmount() didn't
 help, because ext2fs uses buggy private caching for these blocks --
 it doesn't even bdwrite() them until they are uncached or the filesystem
 is unmounted.  sync()ing after unmount() didn't help, because sync()
 only applies to (vnodes for) mounted filesystems.
 ---
 
 > >How-To-Repeat:
 
 Thanks for the detailed instructions.
 
 > >Fix:
 > 
 > Running shutdown with the media still in the drive helps, but I didn't
 > try to insert a different disk and see what gets written.
 
 FreeBSD now retries until shutdown after write errors, so inserting the
 same disk is a safe workaround, but inserting a different disk will
 clobber that disk.
 
 Bruce
 
 
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Sat Nov 11 05:16:14 PST 2000 
State-Changed-Why:  
Fixed in: 
rev.1.6 in -current 
rev.1.5.2.1 in RELENG_4 
rev.1.4.2.1 in RELENG_3 

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