From shelton@sentry.granch.com  Thu Mar 22 06:38:47 2001
Return-Path: <shelton@sentry.granch.com>
Received: from sentry.granch.com (sentry.granch.com [212.109.197.55])
	by hub.freebsd.org (Postfix) with ESMTP id 9B55C37B71D
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Mar 2001 06:38:45 -0800 (PST)
	(envelope-from shelton@sentry.granch.com)
Received: (from shelton@localhost)
	by sentry.granch.com (8.11.1/8.9.3) id f2MEcer00388;
	Thu, 22 Mar 2001 20:38:40 +0600 (NOVT)
Message-Id: <200103221438.f2MEcer00388@sentry.granch.com>
Date: Thu, 22 Mar 2001 20:38:40 +0600 (NOVT)
From: "Rashid N. Achilov" <shelton@sentry.granch.com>
Reply-To: shelton@sentry.granch.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: System hangs when read-only floppy has been mounted
X-Send-Pr-Version: 3.2

>Number:         25992
>Category:       kern
>Synopsis:       System hangs when read-only floppy has been mounted
>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 Mar 22 06:40:02 PST 2001
>Closed-Date:    Fri Aug 10 14:54:08 MEST 2001
>Last-Modified:  Fri Aug 10 14:56:30 MEST 2001
>Originator:     Rashid N. Achilov
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
Granch Ltd.
>Environment:

FreeBSD sentry.granch.com 4.2-STABLE FreeBSD 4.2-STABLE #10: Mon Feb 26 19:38:53 NOVT 2001
root@sentry.granch.com:/usr/src/sys/compile/Sentry  i386

>Description:

When read-only floppy has been mounted and start read from it, system
hangs quickly. This tremendous bug exist for ages, I periodically collided
with it from time to time...

>How-To-Repeat:

Open 'read-only' curtain on the floppy disk with any data. Insert this disk
in FDD and start to read data from it. Wait for hangup...

>Fix:

ALWAYS close 'read-only' curtain on floppies...:-(

>Release-Note:
>Audit-Trail:

From: Dima Dorfman <dima@unixfreak.org>
To: shelton@sentry.granch.com
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: kern/25992: System hangs when read-only floppy has been mounted 
Date: Sat, 24 Mar 2001 14:30:37 -0800

 "Rashid N. Achilov" <shelton@sentry.granch.com> writes:
 > 
 > >Number:         25992
 > >Category:       kern
 > >Synopsis:       System hangs when read-only floppy has been mounted
 > >Description:
 > 
 > When read-only floppy has been mounted and start read from it, system
 > hangs quickly. This tremendous bug exist for ages, I periodically collided
 > with it from time to time...
 
 Are you mounting the floppy in read-only mode?  I.e., are you doing
 `mount -r /dev/fd0 /mnt`?  If you're not specifying the ``-r'', then
 I'm not surprised (I guess it should panic, not hang, though).  If you
 are using ``-r'', then I can't reproduce this; I have a couple of
 computers with read-only floppies in them (for tripwire).
 
 Regards
 
 					Dima Dorfman
 					dima@unixfreak.org
State-Changed-From-To: open->feedback 
State-Changed-By: dd 
State-Changed-When: Sat Apr 28 19:26:10 PDT 2001 
State-Changed-Why:  
Are you mounting the floppy in read-only mode?  I.e., are you doing 
`mount -r /dev/fd0 /mnt`?  If you're not specifying the ``-r'', then 
I'm not surprised (I guess it should panic, not hang, though).  If you 
are using ``-r'', then I can't reproduce this; I have a couple of 
computers with read-only floppies in them (for tripwire). 


http://www.freebsd.org/cgi/query-pr.cgi?pr=25992 

From: Szilveszter Adam <sziszi@petra.hos.u-szeged.hu>
To: achilov@granch.ru
Cc: dd@FreeBSD.ORG, freebsd-gnats-submit@freebsd.org
Subject: Re: kern/25992: System hangs when read-only floppy has been mounted
Date: Mon, 30 Apr 2001 14:14:43 +0200

 On Mon, Apr 30, 2001 at 05:51:45PM +0700, Rashid N. Achilov wrote:
 > On Sunday 29 April 2001 09:26, dd@FreeBSD.ORG wrote:
 > >  Are you mounting the floppy in read-only mode?  I.e., are you doing
 > >  `mount -r /dev/fd0 /mnt`?  If you're not specifying the ``-r'', then
 > >  I'm not surprised (I guess it should panic, not hang, though).  If you
 > >  are using ``-r'', then I can't reproduce this; I have a couple of
 > >  computers with read-only floppies in them (for tripwire).
 > 
 > Hang or panic - which difference? One result - reboot :-(
 
 Just as an aside. This problem has been with us forever. I can appreciate
 that the real UNIX gurus do not hurry to fix this one since they always
 know what to type and don't use floppies much anyway. (Neither do I.) But
 this does not mean that in this situation we should panic (or hang for that
 matter) Panics are for the situations where something is seriously wrong so
 much so, that we decide to give up instead of marching on and possibly
 producing non-sense results. But trying writing to a ro floppy should
 simply fail. Why is there an assumption that a floopy is always writeable
 unless indicated by -r otherwise? Would we try to write to (and
 subsequently panic or hang) a CD-ROM as well? That would be a serious flaw
 to me. While it is not the writing processes' business to know if that
 media the FS is mounted from is writeable, but the underlying layers
 certainly ought to know and act accordingly.
 
 BTW the behaviour has changed over time... at a time it was just a hang.
 Othertimes it was a panic. Sometimes it was even (gasp) a simple fail. 
 But this does not seem to be intentional, rather the by-product of other
 changes...
 
 Just like the fact that under 3.x one could mount mixed mode CDs on my
 machine, but since ad(4) came along, this is not possible. But this is
 unrelated, just grumping.
 
 -- 
 Regards:
 
 Szilveszter ADAM
 Szeged University
 Szeged Hungary

From: Dima Dorfman <dima@unixfreak.org>
To: Szilveszter Adam <sziszi@petra.hos.u-szeged.hu>,
	achilov@granch.ru, freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: kern/25992: System hangs when read-only floppy has been mounted 
Date: Tue, 01 May 2001 23:30:55 -0700

 Szilveszter Adam <sziszi@petra.hos.u-szeged.hu> writes:
 > On Mon, Apr 30, 2001 at 05:51:45PM +0700, Rashid N. Achilov wrote:
 > > On Sunday 29 April 2001 09:26, dd@FreeBSD.ORG wrote:
 > > >  Are you mounting the floppy in read-only mode?  I.e., are you doing
 > > >  `mount -r /dev/fd0 /mnt`?  If you're not specifying the ``-r'', then
 > > >  I'm not surprised (I guess it should panic, not hang, though).  If you
 > > >  are using ``-r'', then I can't reproduce this; I have a couple of
 > > >  computers with read-only floppies in them (for tripwire).
 > > 
 > > Hang or panic - which difference? One result - reboot :-(
 
 The difference is that a panic is a whole lot easier to diagnose than
 a hang.
 
 > Just as an aside. This problem has been with us forever. I can appreciate
 
 I'm not sure which problem you're referring to.  I just tried
 inserting a read-only floppy and mounting it read-write.  I got a
 bunch of write failure errors when I tried to unmount it.  No panic,
 no reboot.  Lots of junk in the logs.  Seems like correct behavior to
 me.  I said panic above because I thought it'd be more logical
 behavior than a hang; spitting out write errors is even better.
 
 > that the real UNIX gurus do not hurry to fix this one since they always
 > know what to type and don't use floppies much anyway. (Neither do I.) But
 > this does not mean that in this situation we should panic (or hang for that
 > matter) Panics are for the situations where something is seriously wrong so
 > much so, that we decide to give up instead of marching on and possibly
 > producing non-sense results. But trying writing to a ro floppy should
 > simply fail. Why is there an assumption that a floopy is always writeable
 > unless indicated by -r otherwise? Would we try to write to (and
 
 Becuase it is mounted read-write.  It's fair to assume that if you
 requested that a filesystem be mounted read-write, it can be written
 to.  UFS (FFS?) will try to flush all buffers and update the
 superblock(s) or something like that (I probably got the details
 wrong) when you umount a filesystem mounted as read-write.  As I said
 above, this causes lots of errors.  On my computer (-current a few
 days old), it doesn't panic or hang.
 
 					Dima Dorfman
 					dima@unixfreak.org

From: Bruce Evans <bde@zeta.org.au>
To: Dima Dorfman <dima@unixfreak.org>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/25992: System hangs when read-only floppy has been mounted
Date: Wed, 2 May 2001 18:15:17 +1000 (EST)

 On Tue, 1 May 2001, Dima Dorfman wrote:
 
 >  Szilveszter Adam <sziszi@petra.hos.u-szeged.hu> writes:
 >  The difference is that a panic is a whole lot easier to diagnose than
 >  a hang.
 >  
 >  > Just as an aside. This problem has been with us forever. I can appreciate
 
 More precisely, this bug (at least the panics and hangs for it) have been
 with us since:
 
     RCS file: /home/ncvs/src/sys/kern/vfs_bio.c,v
     Working file: vfs_bio.c
     head: 1.279
     ...
     ----------------------------
     revision 1.196
     date: 1999/01/22 08:59:05;  author: dg;  state: Exp;  lines: +5 -2
     Don't throw away the buffer contents on a fatal write error; just mark
     the buffer as still being dirty. This isn't a perfect solution, but
     throwing away the buffer contents will often result in filesystem
     corruption and this solution will at least correctly deal with transient
     errors.
     Submitted by:	Kirk McKusick <mckusick@mckusick.com>
     ----------------------------
 
 Prior to this commit, write errors were handled by giving up on
 unwritable buffers.  In particular, write errors for attempts to write
 to write protected media were fairly harmless.  Immediately after this
 commit, write errors caused various panics and hangs, especially for
 block devices.  Some of these problems have been fixed, mainly by
 unsupporting block devices, but I vinvalbuf() and thus unmount(2)
 still seems to be very broken.  vinvalbuf() calls VOP_FSYNC() and then
 panics if VOP_FSYNC() didn't manage to sync everything, but VOP_FSYNC()
 can never sync unwritable buffers.  It either loops forever trying to
 do so or returns with some buffers unsynced.
 
 >  I'm not sure which problem you're referring to.  I just tried
 >  inserting a read-only floppy and mounting it read-write.  I got a
 >  bunch of write failure errors when I tried to unmount it.  No panic,
 >  no reboot.  Lots of junk in the logs.  Seems like correct behavior to
 >  me.  I said panic above because I thought it'd be more logical
 >  behavior than a hang; spitting out write errors is even better.
 
 This may depend on the filesystem.  For an empty ffs filesystem on a
 write-protected floppy under -current, I get endless retries and the
 problem can be recovered from by removing the write protection.  This
 is because control doesn't get as far as the panicing vinvalbuf() in
 -current.  dounmount() calls VOP_SYNC() and ffs's VOP_SYNC() (ffs_fsync())
 has been fixed in -current to retry forever after VOP_FSYNC() fails
 (in the MNT_WAIT case).  In RELENG_4, ffs_fsync() still gives up after
 an error fsyncing the vnode for the mounted-on device, so I think
 vinvalbuf() can be reached.  Similarly for most non-ffs filesystems
 in -current.  ffs_fsync() was fixed very recently in:
 
     RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_vfsops.c,v
     Working file: ffs_vfsops.c
     head: 1.152
     ...
     ----------------------------
     revision 1.150
     date: 2001/04/25 08:11:18;  author: mckusick;  state: Exp;  lines: +16 -7
     ...
     Close a loophole that allowed unwritten blocks to be skipped when
     doing ffs_sync with a request to wait for all I/O activity to be
     completed.
     ----------------------------
 
 >  > that the real UNIX gurus do not hurry to fix this one since they always
 >  > know what to type and don't use floppies much anyway. (Neither do I.) But
 >  > this does not mean that in this situation we should panic (or hang for that
 >  > matter) Panics are for the situations where something is seriously wrong so
 >  > much so, that we decide to give up instead of marching on and possibly
 >  > producing non-sense results. But trying writing to a ro floppy should
 >  > simply fail. Why is there an assumption that a floopy is always writeable
 >  > unless indicated by -r otherwise? Would we try to write to (and
 
 The kernel doesn't know whether the floppy is writable until it attempts
 to write to it.  The ancient history of the bug includes a very broken
 attempt to fix this in the floppy driver by attempting to determine
 writability at open time.  I consider this part of the bug unimportant.
 It might not be possible to determine writablity without trying the
 write.  Especially for devices whose writability can change while they
 are open.  When you do something stupid like mounting a write-protected
 floppies read-write, you should just get i/o errors, and these errors
 should be handled properly just like any other i/o errors on the
 device.  Proper i/o error handling doesn't include panicing or spewing
 error messages for each retry like the floppy driver does :-).
 
 Bruce
 
State-Changed-From-To: feedback->closed 
State-Changed-By: joerg 
State-Changed-When: Fri Aug 10 14:54:08 MEST 2001 
State-Changed-Why:  
Duplicate for kern/10870 (and basically also for kern/4413) 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=13632 
State-Changed-From-To: feedback->closed 
State-Changed-By: joerg 
State-Changed-When: Fri Aug 10 14:54:08 MEST 2001 
State-Changed-Why:  
Duplicate for kern/10870 (and basically also for kern/4413) 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=15486 
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Fri Aug 10 14:54:08 MEST 2001 
State-Changed-Why:  
Duplicate for kern/10870 (and basically also for kern/4413) 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=24992 
State-Changed-From-To: feedback->closed 
State-Changed-By: joerg 
State-Changed-When: Fri Aug 10 14:54:08 MEST 2001 
State-Changed-Why:  
Duplicate for kern/10870 (and basically also for kern/4413) 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25992 
>Unformatted:
