Bug 12368 - mount() returns ENODEV when the requested filesystem is not supported, which is confusing.
Summary: mount() returns ENODEV when the requested filesystem is not supported, which ...
Status: CLOSED WILL_NOT_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 enhancement
Assignee: fs_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-05 15:32 UTC by Jim Bray
Modified: 2012-05-24 14:10 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.28
Subsystem:
Regression: No
Bisected commit-id:


Attachments

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;
}

Note You need to log in before you can comment on or make changes to this bug.