From nobody@FreeBSD.org  Sat May 20 05:05:53 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E528116A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 20 May 2006 05:05:53 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B4BB143D4C
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 20 May 2006 05:05:53 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k4K55r1s057793
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 20 May 2006 05:05:53 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k4K55r2I057792;
	Sat, 20 May 2006 05:05:53 GMT
	(envelope-from nobody)
Message-Id: <200605200505.k4K55r2I057792@www.freebsd.org>
Date: Sat, 20 May 2006 05:05:53 GMT
From: Helmut Schellong <var@schellong.biz>
To: freebsd-gnats-submit@FreeBSD.org
Subject: umount: unmount of /card failed: Device busy ?!
X-Send-Pr-Version: www-2.3

>Number:         97513
>Category:       bin
>Synopsis:       umount: unmount of /card failed: Device busy ?!
>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:   Sat May 20 05:10:14 GMT 2006
>Closed-Date:    Fri Jun 15 11:13:27 GMT 2007
>Last-Modified:  Fri Jun 15 11:13:27 GMT 2007
>Originator:     Helmut Schellong
>Release:        6.1
>Organization:
private
>Environment:
FreeBSD fbsd.lokal.biz 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sat May 13 08:45:34 CEST 2006
root@fbsd.lokal.biz:/usr/src/sys/i386/compile/BSD61  i386

>Description:
54]  safecard /home
Kartengert: /dev/da1s2

safe.bsh: TMP=/tmp/safe_3345
----------------------------------------------------------------
/dev/da1s2 on /card (ufs, local, soft-updates, fsid 76c16b449495314e)
..
/home/.fonts.cache-1 -> /card/home/.fonts.cache-1
/home/.serverauth.586 -> /card/home/.serverauth.586
umount: unmount of /card failed: Device busy
/u/sh/cmd/safecard: -> safe.bsh: Exit=1

Device busy?!
In any case  cd /card  was not true ...

Up to now this was a single event at ~6 safe actions.
>How-To-Repeat:
safecard /home (-> safe.bsh -> umount ...)

But up to now this was a single event at ~6 safe actions.
>Fix:
..
[ M -eq 1 ] && umount -v "$MDIR" || { sleep 5; umount -v "$MDIR"; } || exit

Or - is there a little 'wait' bug in umount?
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: arved 
State-Changed-When: Sat May 20 11:35:52 UTC 2006 
State-Changed-Why:  
You need to add more information to make your PR useful. 

Not everyone knows that /dev/da1 is your ZIP drive. 
Did you verify that no files are open on /card (fstat(1), lsof) 

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

From: Helmut Schellong <var@schellong.biz>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Date: Sun, 21 May 2006 04:46:00 +0200

 /dev/da1 (s2,s1) ist a CompactFlash Card 8 GB. Sometimes da0.
 
 At the time of the message "Device busy" I had not run
 any other process that accessed /dev/da1. The script safecard only.
 Before the runtime of the script the filesytem on Card was unmounted.
 
 safecard:
 =======================================================================
 #!/u/bin/bsh
 
 MDIR=/card
 [ -d "$MDIR" ] || mkdir "$MDIR"
 LST='/boot /home /root /u /dos/cie'
 [ -n "$*" ] && LST="$*"
 camcontrol devlist | grep -m '19>.%{5,}da[0-9]' | readl Z || { echo camcontrol; exit 1; }
 set DEV:.50
 expr "$Z" :DEV '%(%<da[0-9]%{1,2}%>%)' || { echo "expr da#"; exit 2; }
 DEV="/dev/${DEV}s2"
 [ -c "$DEV" -o -b "$DEV" ] || { echo "DEV=$DEV"; exit 3; }
 echo "Kartengert: $DEV"
 
 safe.bsh "$DEV" "$MDIR" "$LST" || echo "$0: -> safe.bsh: Exit=$?"
 :
 
 
 safe.bsh
 ==============================================
 #!/u/bin/bsh
 
 TMP=/tmp/safe_$$
 [ $# -ne 3 ] && exit 1
 [ ! -e "$1" -o ! -d "$2" -o -z "$3" ] && exit 2
 DEV="$1" MDIR="$2" LST="$3"
 C="$0"
 expr "$0" :C '%([^/]%{1,}%)$'
 echo "%n$C: TMP=$TMP"
 echo ----------------------------------------------------------------
 M=0
 mount > $TMP || exit
 grep -q "$DEV .%{2,} $MDIR " $TMP || M=1
 [ M -eq 1 ] && mount -v $DEV $MDIR || exit
 sleep 3
 set DIR:.500 F:.1000
 
 for DIR in $LST
 do
    [ -d $DIR ] || continue
    echo "$C: $DIR ..."
    find $DIR -print > $TMP
    [ -s $TMP ] || continue
    <$TMP
    while readl F
    do
       if [ -L "$F" ]
       then
          [ -f "$F" -o -d "$F" ] || {
             echo "$C: Typ != -f -d: $F"; continue
          }
          fstat -tv T "$F" || {
             echo "$C: Gebrochener Link: $F"; continue
          }
          [ -e "$MDIR$F" ] && [ ! -L "$MDIR$F" ] && {
             echo "$C: Kein SYMLINK: $MDIR$F"; continue
          }
          [ -e "$MDIR$F" ] && continue
          echo "$C: SYMLINK:"
       else
          [ -d "$F" ] && {
             [ -d "$MDIR$F" ] && continue
             [ -e "$MDIR$F" ] && {
                echo "$C: Kein DIR: $MDIR$F"; continue
             }
             mkdir -pv "$MDIR$F"; continue
          }
          [ -e "$MDIR$F" ] && [ ! "$F" -nt "$MDIR$F" ] && continue
       fi
       cp -Rpv "$F" "$MDIR$F"
    done
    ><
 done
 
 rm $TMP
 [ M -eq 1 ] && umount -v "$MDIR" || { sleep 5; umount -v "$MDIR"; } || exit
 echo ----------------------------------------------------------------
 =======================================================================
 
 
 -- 
 Mit freundlichen Gren
 Helmut Schellong   var@schellong.biz
 www.schellong.de   www.schellong.com   www.schellong.biz
 http://www.schellong.de/c.htm

From: Helmut Schellong <var@schellong.biz>
To: Tilman Linneweh <arved@freebsd.org>
Cc: freebsd-bugs@freebsd.org
Subject: Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Date: Sun, 21 May 2006 04:09:19 +0200

 Tilman Linneweh wrote:
 > Synopsis: umount: unmount of /card failed: Device busy ?!
 >
 > State-Changed-From-To: open->feedback
 > State-Changed-By: arved
 > State-Changed-When: Sat May 20 11:35:52 UTC 2006
 > State-Changed-Why: 
 > You need to add more information to make your PR useful.
 >
 > Not everyone knows that /dev/da1 is your ZIP drive.
 > Did you verify that no files are open on /card (fstat(1), lsof)
 >
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=97513
 >
 >   
 /dev/da1 (s2,s1) ist a CompactFlash Card 8 GB. Sometimes da0.
 
 At the time of the message "Device busy" I had not run
 any other process that accessed /dev/da1. The script safecard only.
 Before the runtime of the script the filesytem on Card was unmounted.
 
 safecard:
 =======================================================================
 #!/u/bin/bsh
 
 MDIR=/card
 [ -d "$MDIR" ] || mkdir "$MDIR"
 LST='/boot /home /root /u /dos/cie'
 [ -n "$*" ] && LST="$*"
 camcontrol devlist | grep -m '19>.%{5,}da[0-9]' | readl Z || { echo 
 camcontrol; exit 1; }
 set DEV:.50
 expr "$Z" :DEV '%(%<da[0-9]%{1,2}%>%)' || { echo "expr da#"; exit 2; }
 DEV="/dev/${DEV}s2"
 [ -c "$DEV" -o -b "$DEV" ] || { echo "DEV=$DEV"; exit 3; }
 echo "Kartengert: $DEV"
 
 safe.bsh "$DEV" "$MDIR" "$LST" || echo "$0: -> safe.bsh: Exit=$?"
 :
 
 
 safe.bsh
 ==============================================
 #!/u/bin/bsh
 
 TMP=/tmp/safe_$$
 [ $# -ne 3 ] && exit 1
 [ ! -e "$1" -o ! -d "$2" -o -z "$3" ] && exit 2
 DEV="$1" MDIR="$2" LST="$3"
 C="$0"
 expr "$0" :C '%([^/]%{1,}%)$'
 echo "%n$C: TMP=$TMP"
 echo ----------------------------------------------------------------
 M=0
 mount > $TMP || exit
 grep -q "$DEV .%{2,} $MDIR " $TMP || M=1
 [ M -eq 1 ] && mount -v $DEV $MDIR || exit
 sleep 3
 set DIR:.500 F:.1000
 
 for DIR in $LST
 do
    [ -d $DIR ] || continue
    echo "$C: $DIR ..."
    find $DIR -print > $TMP
    [ -s $TMP ] || continue
    <$TMP
    while readl F
    do
       if [ -L "$F" ]
       then
          [ -f "$F" -o -d "$F" ] || {
             echo "$C: Typ != -f -d: $F"; continue
          }
          fstat -tv T "$F" || {
             echo "$C: Gebrochener Link: $F"; continue
          }
          [ -e "$MDIR$F" ] && [ ! -L "$MDIR$F" ] && {
             echo "$C: Kein SYMLINK: $MDIR$F"; continue
          }
          [ -e "$MDIR$F" ] && continue
          echo "$C: SYMLINK:"
       else
          [ -d "$F" ] && {
             [ -d "$MDIR$F" ] && continue
             [ -e "$MDIR$F" ] && {
                echo "$C: Kein DIR: $MDIR$F"; continue
             }
             mkdir -pv "$MDIR$F"; continue
          }
          [ -e "$MDIR$F" ] && [ ! "$F" -nt "$MDIR$F" ] && continue
       fi
       cp -Rpv "$F" "$MDIR$F"
    done
    ><
 done
 
 rm $TMP
 [ M -eq 1 ] && umount -v "$MDIR" || { sleep 5; umount -v "$MDIR"; } || exit
 echo ----------------------------------------------------------------
 =======================================================================
 
 -- 
 Mit freundlichen Gren
 Helmut Schellong   var@schellong.biz
 www.schellong.de   www.schellong.com   www.schellong.biz
 http://www.schellong.de/c.htm

From: Helmut Schellong <var@schellong.biz>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Date: Wed, 31 May 2006 23:37:22 +0200

 Today a 2nd event:
 ------------------
 ...
 ...
 /dos/cie/mc/c/mu2000/abs/mu2000.abs -> /s/dos/cie/mc/c/mu2000/abs/mu2000.abs
 /dos/cie/mc/c/mu2000/abs/mu2000.mhx -> /s/dos/cie/mc/c/mu2000/abs/mu2000.mhx
 /dos/cie/mc/c/mu2000/abs/mu2000v143b263.mhx -> /s/dos/cie/mc/c/mu2000/abs/mu2000v143b263.mhx
 /dos/cie/pkg/CanWatch/USB_Dgle.INI -> /s/dos/cie/pkg/CanWatch/USB_Dgle.INI
 umount: unmount of /s failed: Device busy
 /dev/s: unmount from /s
 ----------------------------------------------------------------
 29]
 
 
 
 -- 
 Mit freundlichen Gren
 Helmut Schellong   var@schellong.biz
 www.schellong.de   www.schellong.com   www.schellong.biz
 http://www.schellong.de/c.htm

From: Helmut Schellong <var@schellong.biz>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Date: Wed, 31 May 2006 23:55:46 +0200

 Following this was okay:
 (/card:CFcard; /s:2nd harddisk)
 -------------------------------
 ...
 ...
 /dos/cie/mc/c/mu2000/lst/dkl.lst -> /card/dos/cie/mc/c/mu2000/lst/dkl.lst
 /dos/cie/mc/c/mu2000/abs/mu2000.abs -> /card/dos/cie/mc/c/mu2000/abs/mu2000.abs
 /dos/cie/mc/c/mu2000/abs/mu2000.mhx -> /card/dos/cie/mc/c/mu2000/abs/mu2000.mhx
 /dos/cie/mc/c/mu2000/abs/mu2000v143b263.mhx -> 
 /card/dos/cie/mc/c/mu2000/abs/mu2000v143b263.mhx
 /dos/cie/pkg/CanWatch/USB_Dgle.INI -> /card/dos/cie/pkg/CanWatch/USB_Dgle.INI
 /dev/da0s2: unmount from /card
 ----------------------------------------------------------------
 36]
 
 
 -- 
 Mit freundlichen Gren
 Helmut Schellong   var@schellong.biz
 www.schellong.de   www.schellong.com   www.schellong.biz
 http://www.schellong.de/c.htm

From: Helmut Schellong <schellong@t-online.de>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Date: Thu, 08 Jun 2006 04:00:27 +0200

 Today a 3rd event on /dev/s (2nd harddisc).
 
 
 -- 
 Mit freundlichen Gren
 Helmut Schellong   var@schellong.biz
 www.schellong.de   www.schellong.com   www.schellong.biz
 http://www.schellong.de/c.htm

From: Helmut Schellong <var@schellong.biz>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Date: Thu, 08 Jun 2006 05:14:53 +0200

 Today a 3rd event on /dev/s (2nd harddisc).
 
 
 -- 
 Mit freundlichen Gren
 Helmut Schellong   var@schellong.biz
 www.schellong.de   www.schellong.com   www.schellong.biz
 http://www.schellong.de/c.htm
State-Changed-From-To: feedback->open 
State-Changed-By: linimon 
State-Changed-When: Fri Jun 15 09:51:55 UTC 2007 
State-Changed-Why:  
Note that feedback was received some time ago. 

Note to submitter: does this problem still recur with more recent versions 
of FreeBSD? 

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

From: Helmut Schellong <schellong@t-online.de>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/97513: umount: unmount of /card failed: Device busy ?!
Date: Fri, 15 Jun 2007 13:03:20 +0200

 FreeBSD 6.2:  no event
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Jun 15 11:13:01 UTC 2007 
State-Changed-Why:  
Apparently this is fixed as of 6.2. 

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