VFS: mount_bdev and fill_super

Shrikant Giridhar shrikantgiridhar at gmail.com
Fri Jun 16 01:50:19 EDT 2017


I'm a little confused about how the mount_bdev() call works.

The VFS documentation lists it as a generic method to mount a block device.
Based on what I understood from the source, it seems to open a block device
whose path is passed via the mount() syscall and later associates it with
the superblock, finally returning the corresponding dentry to the caller.

The documentation also mentions that mount() can return a subtree of an
existing filesystem on the block device. However, in the very next line it
mentions that the caller also receives a pointer to the dentry of the root
node. I can see from the source (fs/super.c:1099) that the mount_bdev call
does check if the superblock's s_root == NULL or not and proceeds to set a
new superblock if it is.

I know my question sounds a little vague but I'm having trouble understanding
how mount() can return a dentry for something other than the root?

---
Shrikant



More information about the Kernelnewbies mailing list