Subject: Re: kern/37034: Processes stuck on vnlock: accessing msdos fs mounted from img (vnconfig)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Antti Kantee <pooka@cs.hut.fi>
List: netbsd-bugs
Date: 09/28/2007 15:05:03
The following reply was made to PR kern/37034; it has been noted by GNATS.

From: Antti Kantee <pooka@cs.hut.fi>
To: gnats-bugs@NetBSD.org
Cc: netbsd@eq.cz
Subject: Re: kern/37034: Processes stuck on vnlock: accessing msdos fs mounted from img (vnconfig)
Date: Fri, 28 Sep 2007 18:00:25 +0300

 On Fri Sep 28 2007 at 14:40:02 +0000, rudolf wrote:
 >  No problem, but it is quite big: 16 GB uncompressed. If you'll need it, 
 >  we can arrange it somehow.
 
 Ok, let's try to avoid that.
 
 >  >  Meanwhile, try if this helps:
 >  [...]
 >  
 >  With this patch I could do 'ls -al /top_of_msdosfs/', 'find 
 >  /top_of_msdosfs/', ... and everything was ok. Then 'shutdown -r now' 
 >  caused this panic:
 >  
 >  syncing disks... done
 >  unmounting file systems...
 >  unmounting /mnt2 (/dev/vnd0a)... vrele: bad ref count: tag VT_UFS(1) 
 >  type VBLK(3), usecount -1, writecount 0, refcount 1858, flags(0<LOCKSWORK>)
 >  tag VT_UFS, ino 184765, on dev 0, 32 flags 0x0, effnlink 1, nlink 1
 >  mode 060640, owner 0, group 5, size 0 not locked
 >  panic: vrele: ref cnt vp 0xffff80004c203e20
 >  Stopped in pid 60.1 (reboot) at netbsd:cpu_Debugger+0x5: leave
 
 Ah, brilliant.  I'm not familiar enough with msdosfs to see the thread
 logic in the function, but this should fix that:
 
 Index: msdosfs_denode.c
 ===================================================================
 RCS file: /cvsroot/src/sys/fs/msdosfs/msdosfs_denode.c,v
 retrieving revision 1.17
 diff -p -u -r1.17 msdosfs_denode.c
 --- msdosfs_denode.c	25 Nov 2006 12:17:30 -0000	1.17
 +++ msdosfs_denode.c	28 Sep 2007 14:59:35 -0000
 @@ -335,8 +335,11 @@ deget(pmp, dirclust, diroffset, depp)
  		/* leave the other fields as garbage */
  	} else {
  		error = readep(pmp, dirclust, diroffset, &bp, &direntptr);
 -		if (error)
 +		if (error) {
 +			ldep->de_devvp = NULL;
 +			vput(nvp);
  			return (error);
 +		}
  		DE_INTERNALIZE(ldep, direntptr);
  		brelse(bp);
  	}
 
 -- 
 Antti Kantee <pooka@iki.fi>                     Of course he runs NetBSD
 http://www.iki.fi/pooka/                          http://www.NetBSD.org/
     "la qualité la plus indispensable du cuisinier est l'exactitude"