Generally you should read a book like this one to get answers for most such details inside kernel. But, in general, yes, the process is that:
- Filesystem is traversed using the specified path, from the process' root (it can differ to known system FS root due to
LXC and analogs) in case of an absolute path, or from current process directory, or from specified directory (in calls like
openat), both in case of relative path. Specified path is split into sequence of path components, which are processed in sequence. Directory contents and mountpoint crossings are analyzed during this process (named "path lookup", "namei lookup"), and each path component result in temporary reference to a
sfile in old Unixes,
inode in Linux) object. As the result, if this succeeds, final file's vnode is found (created, if needed) and held up.
- "Open file" object is created, referencing this vnode, and attached to process'
file descriptor, allocated for this request.
Details of directory search for this are very specific for particular VFS. It can be of any kind including memory-only ones (
tmpfs), disk-based ones (
ext4, etc.), but the common concept of hierarchy of directories is kept in effect.