Subject: kern/34882: vnconfig does not work with files on tmpfs
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <jmmv@netbsd.org>
List: netbsd-bugs
Date: 10/22/2006 20:50:00
>Number:         34882
>Category:       kern
>Synopsis:       vnconfig does not work with files on tmpfs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 22 20:50:00 +0000 2006
>Originator:     Julio M. Merino Vidal
>Release:        NetBSD 4.99.3
>Organization:
Julio M. Merino Vidal <jmmv@NetBSD.org>
>Environment:
	
	
Architecture: N/A
Machine: N/A
>Description:
	When configuring a vnd device using a file stored in a tmpfs file
	system, vnconfig does not raise any error despite this operation
	should not be supported.  Later on, when using the configured vnd
	device, any operation on it will cause a EOPNOTSUPP error due to
	the lack of some vnode operations in the underlying file system.

	More specifically, vnd requires the file system holding the regular
	file to implement the VOP_STRATEGY and VOP_BMAP operations.  tmpfs
	currently does not implement them and uses the generic
	genfs_eopnotsupp function as a fallback.  As the name implies, this
	makes the two operations to always return EOPNOTSUPP.

	When configuring a new vnd device, the operation succeeds because
	there is currently no way to know if the file system will support
	the required operations.  This launches a new vndthread for the
	device which will later return errors for any operation.
>How-To-Repeat:
	Mount a tmpfs file system.
	Put a disk image on it.
	Configure a vnd device with that image stored in tmpfs.
	Attempt to mount it; see it fail.

	This mail contains a more detailed sequence:
	http://mail-index.netbsd.org/tech-kern/2006/08/03/0000.html
>Fix:
	The long-term fix to this problem is to make vnd work with files
	stored in tmpfs.  If this means implementing the VOP_BMAP and
	VOP_STRATEGY operations in tmpfs, I don't know.

	Additionally, it might be good if vnd could know if the underlying
	file system supports the required operations instead of assuming
	they are there; this way it'd report the error during configuration
	intead of during mounting.  (And this could be applicable to any
	other file system with similar problems, not only to tmpfs.)

>Unformatted: