From akiyama@kme.mei.co.jp  Sun Mar 17 18:56:20 1996
Received: from vcgate1.mei.co.jp (vcgate1.mei.co.jp [202.32.14.51])
          by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id SAA23873
          for <freebsd-gnats-submit@freebsd.org>; Sun, 17 Mar 1996 18:56:18 -0800 (PST)
Received: by vcgate1.mei.co.jp (5.65mei1.2g/5.9:4.9:vcgate0:960311)
	id AA22342; Mon, 18 Mar 96 11:57:41 +0900
Received: by vcmei.vanc.mei.co.jp (5.65mei1.1/5.9:4.9:vcmei:960229)
	id AA16685; Mon, 18 Mar 96 11:54:04 +0900
Received: by kmegate.kme.mei.co.jp (4.1/5.5:4.6:kmegate:960308)
	id AA06758; Mon, 18 Mar 96 11:55:21 JST
Message-Id: <9603180255.AA06758@kmegate.kme.mei.co.jp>
Date: Mon, 18 Mar 96 11:55:21 JST
From: akiyama@kme.mei.co.jp
Reply-To: akiyama@kme.mei.co.jp
To: FreeBSD-gnats-submit@freebsd.org
Subject: Device close entry is not called when unmounting UFS.
X-Send-Pr-Version: 3.2

>Number:         1087
>Category:       kern
>Synopsis:       Device close entry is not called when unmounting UFS.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 17 19:00:02 PST 1996
>Closed-Date:    Mon Oct 21 21:10:33 PDT 1996
>Last-Modified:  Mon Oct 21 21:10:57 PDT 1996
>Originator:     Shunsuke Akiyama
>Release:        FreeBSD 2.2-960303-SNAP i386
>Organization:
Kyushu Matsushita Electric Co., Ltd.
>Environment:

	All FreeBSD-2.2-960303-SNAP systems configured with UFS
	(options FFS).

>Description:

	Device close entry is not called when unmounting UFS.  This is
	not occured in FreeBSD-2.1.0-RELEASE.  Device close entry like
	sd or od allow media ejecting in it.  Therefor the SCSI
	removable disk device can not ejected, if it once unmounted.

>How-To-Repeat:

	Every unmounting UFS.
	(I checked UFS on wd, fd, sd and od.)

	In sys/miscfs/specfs/spec_vnops.c:spec_close(), the case of
	VBLK, vcount() always returns 2 even if the last close.  Then
	device close entry never called from spec_close() function.

>Fix:
	
	I don't know why vcount() returns 2 at last close, so I
	beleive this is not a ture fix.

--- sys/miscfs/specfs/spec_vnops.c-dist	Tue Jan  2 05:20:45 1996
+++ sys/miscfs/specfs/spec_vnops.c	Mon Mar 18 10:52:36 1996
@@ -625,7 +625,7 @@
 		 * sum of the reference counts on all the aliased
 		 * vnodes descends to one, we are on last close.
 		 */
-		if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
+		if (vcount(vp) > 2 && (vp->v_flag & VXLOCK) == 0)
 			return (0);
 		devclose = bdevsw[major(dev)]->d_close;
 		mode = S_IFBLK;
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: FreeBSD-gnats-submit@freebsd.org, akiyama@kme.mei.co.jp
Cc: dyson@freebsd.org
Subject: Re: kern/1087: Device close entry is not called when unmounting UFS.
Date: Mon, 18 Mar 1996 16:31:54 +1100

 >	In sys/miscfs/specfs/spec_vnops.c:spec_close(), the case of
 >	VBLK, vcount() always returns 2 even if the last close.  Then
 >	device close entry never called from spec_close() function.
 
 >>Fix:
 >	
 >	I don't know why vcount() returns 2 at last close, so I
 >	beleive this is not a ture fix.
 
 vn_vmio holds a reference.  See ffs_unmount() and vn_close().  Perhaps
 the correct fix is to move the vn_vmio_close() before the VOP_CLOSE()?
 WHere does the reference count get incremented for the non-VREG case
 of vn_open()?  vn_close() releases a reference in all cases.
 
 >--- sys/miscfs/specfs/spec_vnops.c-dist	Tue Jan  2 05:20:45 1996
 >+++ sys/miscfs/specfs/spec_vnops.c	Mon Mar 18 10:52:36 1996
 >@@ -625,7 +625,7 @@
 > 		 * sum of the reference counts on all the aliased
 > 		 * vnodes descends to one, we are on last close.
 > 		 */
 >-		if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
 >+		if (vcount(vp) > 2 && (vp->v_flag & VXLOCK) == 0)
 > 			return (0);
 > 		devclose = bdevsw[major(dev)]->d_close;
 > 		mode = S_IFBLK;
 
 Bruce

From: J Wunsch <j@uriah.heep.sax.de>
To: akiyama@kme.mei.co.jp
Cc: FreeBSD-gnats-submit@freebsd.org, mmead@glock.com
Subject: Re: kern/1087: Device close entry is not called when unmounting UFS.
Date: Mon, 18 Mar 1996 09:49:56 +0100 (MET)

 As akiyama@kme.mei.co.jp wrote:
 
 > >Description:
 > 
 > 	Device close entry is not called when unmounting UFS.  This is
 > 	not occured in FreeBSD-2.1.0-RELEASE.  Device close entry like
 > 	sd or od allow media ejecting in it.  Therefor the SCSI
 > 	removable disk device can not ejected, if it once unmounted.
 
 Ah, this does also explain the problems with the JAZ drives!
 
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
 Never trust an operating system you don't have sources for. ;-)
State-Changed-From-To: open->closed 
State-Changed-By: scrappy 
State-Changed-When: Mon Oct 21 21:10:33 PDT 1996 
State-Changed-Why:  

Originator confirms closure  

>Unformatted:
