* VFS cont, super_operations a lot of refcount ops in linux start with get/put: - dget/dput (dentry) - iget/iput (inode) * pathname lookup (namei), revisited unlink("/a/b/c/d/foo.txt"): Any new pathname that comes through a syscall, gets put into a struct called a "nameidata" (ND) structure. 1. a series of ->lookup and ->permission - if no permission: return error EPERM/EACCES - if intermediate component (non-leaf) is NOT a directory: return ENOTDIR - if any component doesn't exist: ENOENT 2. If any component is a symlink - do a ->readlink and "replace" component w/ symlink's content/target - suspend processing of orig pathname and perform a "subroutine" to interpret new symlink - any path of a symlink could itself be a symlink... - when creating a ND struct, count how many times we crossed a symlink - if counter is greater than some threshold (often 20), then abort lookup and return error ENAMETOOLONG 3. If a directory is a mountpoint, need to cross that mount point # mount -t ext4 /dev/sda1 /usr $ ls /usr homes/ $ ls -R /usr (only homes) # mount -t nfs server:/path /usr/homes $ ls /usr homes/ $ ls -R /usr (lots of files, all of /usr/homes/*/*...) $ ls /usr/homes/jdoe/foo.txt lookup "usr" in "/", find that it belongs to ext4 - check each dentry you got back if dentry->d_flags & DCACHE_MOUNTED lookup "homes" inside "usr", initially get the dentry+inode for ext4's "homes" - now finding that ext4's "homes" dentry is DCACHE_MOUNTED - if found, consult a global hash table of mount points, lookup the dentry that's mounted "here". What's returned is the root dentry of the f/s mounted here (nfs in above example). next lookup goes into nfs f/s, looking for "jdoe" inside the newly found root dentry of that mounted nfs f/s. #define DCACHE_MOUNTED 0x00010000 /* is a mountpoint */ - ->unlink at the very end * struct file_system_type name of f/s flags and ctor and dtor for struct super_block (ctor has to create struct sb, populate it, and fill in sb->s_root -- root dentry).