NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/60626: fss(4): fs type detection



>Number:         60626
>Category:       kern
>Synopsis:       fss(4): fs type detection
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 20 19:45:02 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, ...
>Organization:
The NetFstype Detection, Inc.
>Environment:
>Description:

	When /fs is an ffs file system, after

		# fssconfig fss0 /fs /snap

	you can do

		# mount /dev/fss0 /mnt

	and it will just DTRT.

	But if /fs is, say, an lfs file system, the mount won't work:

		# mount /dev/fss0 /mnt
		mount_ffs: /dev/fss0 on /mnt: incorrect super block

	It works for ffs just because mount(8) has a special case: if
	there's no partition type, and there's no : or @ indicating
	nfs, it just assumes ffs.

    293 		/*
    294 		 * If -t flag has not been specified, and spec contains either
    295 		 * a ':' or a '@' then assume that an NFS filesystem is being
    296 		 * specified ala Sun.
    297 		 */
    298 		mntfromname = getfsspecname(buf, sizeof(buf), argv[0]);
    299 		if (mntfromname == NULL)
    300 			err(EXIT_FAILURE, "%s", buf);
    301 		if (vfslist == NULL) {
    302 			if (strpbrk(argv[0], ":@") != NULL) {
    303 				vfstype = "nfs";
    304 			} else {
    305 				vfstype = getfslab(mntfromname);
    306 				if (vfstype == NULL)
    307 					vfstype = ffs_fstype;
    308 			}
    309 		}
    310 		rval = mountfs(vfstype, mntfromname, argv[1], init_flags,
    311 		    options, NULL, 0, NULL, 0);

https://nxr.netbsd.org/xref/src/sbin/mount/mount.c?r=1.108#293

	However, fss(4) must know the type of the file system stored in
	it because it was obtained from a mounted file system with a
	type that can be queried with statvfs(2), giving struct
	statvfs::f_fstypename.

	It would be nice if this could be conveyed to downstream users
	of the /dev/fssN device somehow.  disklabel(8) doesn't work:

		# disklabel fss0
		disklabel: ioctl DIOCGDINFO: Invalid argument

>How-To-Repeat:

	1. fssconfig fss0 <any non-ffs file system>
	2. mount /dev/fss0 /mnt

>Fix:

	Yes, please!




Home | Main Index | Thread Index | Old Index