mount FS without filesystem type

piyush moghe pmkernel at gmail.com
Thu Jul 21 04:20:50 EDT 2011


I have a question regarding mounting filesystem without giving filesystem
type as argument to mount command:


AFAIK when mount command is run to mount a FS the corresponding call made in
kernel is "compat_sys_mount" as per kernel 2.6.36. Now compat_sys_kernel
expects a filesystem "type" name as argument but in compat_sys_mount there
is no check for "type" argument as NULL, now as part of this mount path
do_kern_mount also called which uses the "type" argument to compat_sys_mount
and finds out the corresponding file_system_type structure from the
file_system_type structure list and if not matching structure is found it
returns with error.

    842 asmlinkage long compat_sys_mount(const char __user * dev_name,
    843                                  const char __user * dir_name,
    844                                  const char __user * type, unsigned
long flags,    <====== type argument to compat_sys_mount
    845                                  const void __user * data)
    846 {
    847         char *kernel_type;
    848         unsigned long data_page;
    849         char *kernel_dev;
    850         char *dir_page;
    851         int retval;
    852
    853         retval = copy_mount_string(type, &kernel_type);


   1098 do_kern_mount(const char *fstype, int flags, const char *name, void
*data)
   1099 {
   1100         struct file_system_type *type = get_fs_type(fstype);
<======= same type argument to search in list
   1101         struct vfsmount *mnt;
   1102         if (!type)
                 <=======  if the type name entry not found in list return
ERRROR
   1103                 return ERR_PTR(-ENODEV);
   1104         mnt = vfs_kern_mount(type, flags, name, data);
   1105         if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&
   1106             !mnt->mnt_sb->s_subtype)
   1107                 mnt = fs_set_subtype(mnt, fstype);
   1108         put_filesystem(type);
   1109         return mnt;
   1110 }


Now my question is that if I don't provide FS type name to mount command how
the FS gets mounted. Is there some other path for this code or if before
calling compat_sys_mount i.e in user mode FS type is determined somehow?


Regards,
Piyush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110721/24ed1e52/attachment.html 


More information about the Kernelnewbies mailing list