Bug 12368

Summary: mount() returns ENODEV when the requested filesystem is not supported, which is confusing.
Product: File System Reporter: Jim Bray (jimsantelmo)
Component: OtherAssignee: fs_other
Status: CLOSED WILL_NOT_FIX    
Severity: enhancement CC: alan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.28 Subsystem:
Regression: No Bisected commit-id:

Description Jim Bray 2009-01-05 15:32:13 UTC
The syscall mount() returns  ENODEV if there is no driver available for the filesystem (see below). This is a very confusing error message to get in this situation, since it is logical to conclude that there is a problem with the requested device rather than the filesystem type. Returning ENOPKG, EUNATCH or ENOTSUP would give more of a clue to the actual problem.

  V7 and 4.3BSD only had one filesystem; there is no code in them for this case, I think. Opensolaris appears to return EINVAL (see
http://tamacom.com/tour/kernel/solaris/S/3736.html#L792
). FreeBSD appears to return ENODEV (see
http://tamacom.com/tour/kernel/freebsd/S/4513.html#L804
).

 Probably changing this behavior is politically impossible, but I wanted to mention the idea anyway.

fs/super.c::do_kernel_mount():
struct vfsmount *
do_kern_mount(const char *fstype, int flags, const char *name, void *data)
{
	struct file_system_type *type = get_fs_type(fstype);
	struct vfsmount *mnt;
	if (!type)
		return ERR_PTR(-ENODEV);
	mnt = vfs_kern_mount(type, flags, name, data);
	if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&
	    !mnt->mnt_sb->s_subtype)
		mnt = fs_set_subtype(mnt, fstype);
	put_filesystem(type);
	return mnt;
}