linux kernel path walk. lookup_slow explaination

664 views Asked by At

I am trying to understand the linux kernel path walk. How is the below case resolved:

For the Path,

"/ext3_dir/ext4_dir"

Lets say we have following mounted filesystems, ext4_dir is root of ext4 filesystem, mounted on ext3 directory ext3_dir.

Q1: Is it possible that at any time dentry for ext4_dir is not present on dentry cache or it will always be there after ext4 mounted on top of ext3 ?

Q2: If dcache miss case is possible then in the slow path below:

link_path_walk->walk_component->lookup_slow()

first dentry is allocated

dentry = d_alloc_parallel(dir, name, &wq);

and then we call

inode->i_op->lookup(inode, dentry, flags);

which calls the actual filesystem function to read the component inside the data blocks of inode of the parent directory, here ext3_dir. Since ext3_dir is in ext3 filesystem, how does the ext4 filesystem is accessed in this case to read the data of ext4_dir into dentry?

Thanks, Kapil

1

There are 1 answers

2
Tsyvarev On BEST ANSWER

Dentry represented mount point of a filesystem is always in the cache. Also, root inode for a filesystem always exists.

So, no filesystem's function is required to navigate to "/ext3_dir/ext4_dir": both dentry and inode are extracted with use of VFS cache.