Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jan 1997 11:21:26 -0500
From:      tatsuya Hagino <tatsuya_Hagino@visitor-4.sp.cs.cmu.edu>
To:        freebsd-bugs@freebsd.org
Subject:   mount_mfs
Message-ID:  <199701311622.IAA29072@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
I am currently developing a 4.4BSD Lite Server for RT-Mach and making 
it to work with FreeBSD 2.2-BETA.  I found a bug in mount_mfs command
(whith is the same as newfs).  When it creates a memory file system,
it issues a mount system call but the size field is twice as small as
it should be.

In /usr/src/sbin/newfs/mkfs.c line 460, fssize is converted from
sector size to file system block size (which is tipically 1024 byte).

	sblock.fs_size = fssize = dbtofsb(&sblock, fssize);

However, mount system call argument is caliculated in
/usr/src/sbin/newfs/newfs.c line 554

	args.size = fssize * sectorsize;

where it uses the sector size (512 byte).  This confusion of sector
size and file system block size is causing the problem.

The reason why FreeBSD mount_mfs works is that FreeBSD kernel does not
check the size limit in mfs_vnops.c.  I have found this bug when I was
implementing the memory file system for Lites and Lites hanged because
of illegal memory accesses.

Tatsuya Hagino

P.S. Could you also change the fspec name?  Since the special file
name for a memory file system is "mfs:<pid>", the kernel tries to find 
the host name "mfs" when it shut down (it looks like nfs mount).  If
the machine is disconnected from the network, the name resolution
(which failes) takes quite a time.
----------------------------------------------------------------------------
Tatsuya Hagino
th+@cs.cmu.edu                          hagino@sfc.keio.ac.jp
School of Computer Science              Fuculty of Environmental Information
Carnegie Mellon University              Keio University
5000 Forbes Ave. Pittsburgh, PA 15213   5322 Endoh, Fujisawa, Kanagawa 252



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701311622.IAA29072>