Subject: kern/7380: vnode disks fail on MSDOSFS files.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <elric@imrryr.org>
List: netbsd-bugs
Date: 04/14/1999 01:52:15
>Number:         7380
>Category:       kern
>Synopsis:       vnode disks fail on MSDOSFS files.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 14 01:50:01 1999
>Last-Modified:
>Originator:     R. C. Dowdeswell
>Organization:
	
>Release:        NetBSD 1.4_ALPHA
>Environment:
	
System: NetBSD mabelode.imrryr.org 1.4_ALPHA NetBSD 1.4_ALPHA (MABELODE) #1: Wed Apr 14 01:28:20 PDT 1999 elric@mabelode.imrryr.org:/usr/src/sys/arch/alpha/compile/MABELODE alpha


>Description:
	If one points a vnd at a file residing in an MSDOSFS,
	the virtual disk does not properly represent the data
	in the file.

>How-To-Repeat:
	# mount -t msdos /dev/wd0e /mnt/
	# cd /mnt/
	# jot 131072 > fs
	# vnconfig vnd0 fs
	# more /dev/rvnd0d

	notice that you basically get a lot of odd repititions.
	certainly not what you might have expected.
>Fix:
	I think that the problem is basically that msdosfs_bmap()
	calls pcbmap() converting clusters into blocks.  But,
	in msdosfs a "cluster" is what a "block" is in FFS.

	This patch got me going, and able to create an FFS in a
	file on an MSDOSFS, and run some tars and mtrees to check
	out that it was working.

*** msdosfs_vnops.c.orig        Wed Apr 14 00:58:01 1999
--- msdosfs_vnops.c     Wed Apr 14 01:05:11 1999
***************
*** 1757,1763 ****
                int *a_runp;
        } */ *ap = v;
        struct denode *dep = VTODE(ap->a_vp);
-       struct msdosfsmount *pmp = dep->de_pmp;
  
        if (ap->a_vpp != NULL)
                *ap->a_vpp = dep->de_devvp;
--- 1757,1762 ----
***************
*** 1769,1775 ****
                 */
                *ap->a_runp = 0;
        }
!       return (pcbmap(dep, de_bn2cn(pmp, ap->a_bn), ap->a_bnp, 0, 0));
  }
  
  int
--- 1768,1774 ----
                 */
                *ap->a_runp = 0;
        }
!       return (pcbmap(dep, ap->a_bn, ap->a_bnp, 0, 0));
  }
  
  int

>Audit-Trail:
>Unformatted: