VFS: mount_bdev and fill_super

Rohan Puri rohan.puri15 at gmail.com
Fri Jun 16 02:09:16 EDT 2017


On 16-Jun-2017 11:21 AM, "Shrikant Giridhar" <shrikantgiridhar at gmail.com>
wrote:

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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Hi Shrikant,

I just had a quick look at mount_bdev() code for Linux v3.15, mount_bdev()
can return only root dentry or error.

Also please include the kernel version to which you are referring.

- Rohan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170616/95774d4e/attachment.html 


More information about the Kernelnewbies mailing list