On 19-Jun-2017 10:38 AM, "Shrikant Giridhar" <shrikantgiridhar@xxxxxxxxx> wrote:
On Fri, 16 Jun 2017, Rohan Puri wrote:I tried looking at the d_name of the s_root dentry when mounting a device and
> If s_root is set it means the superblock is already filled up so call
> fill_super() only if s_root is NULL meaning superblock is not filled yet.
its always '/'. I presume this is due to it being the root dentry of the
subtree we're attaching to the main file hierarchy.
Yes.
Can the dentry of a superblock be something other than '/' on mounting it?
Are you talking about s_root field of struct super_block ? Then it ideally should be of root. I checked some file systems implementation of fill_super().
fill_super() is the method that sets the s_root field of super_block. I found all of those file systems *rightly* calling d_make_root() API which actually makes root dentry with name '/'.
So the question you should ask yourself is which file systems code are you referring too, how is it setting the s_root field of super_block in their fill_super method. You will get your answer. Unless some file system is doing some very weird thing, I believe it would be calling d_make_root() VFS API only which does the task for you.
Apologies if my question is a little vague. Any documentation about this would
help too.
---
Shrikant
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies