Messages in this thread | | | Date | Mon, 2 Feb 1998 10:04:53 +0100 | From | Martin von Loewis <> | Subject | Re: Some questions |
| |
> 2> Whie mounting a fs readonly, the kernel will set all dir perms etc. to > r--- for root. How does it decide user perms while mounting the fs with > home directories? Cud u direct me to the appropriate kernel code in this > case ?
What file system are you using? I believe ext2 would always display the permissions that are stored on the disk. This can be seen in fs/ext2/inode.c:ext2_read_inode.
> 3 > How exactly doees unlink".") work? What I feel is that the dir is > unlinked but the inode is still active(refcnt>10 and process is able to > acces the dir. as before until it exists. But what happemns if he now > executes the pwd ccommand?
The VFS executes the per-fs unlink operation, but keeps the dcache entries (at least in Linux 2.1). The inode won't be released until the VFS calls the delete_inode operation, which is not called until the last process releases the dentry.
What pwd would do depends on the implementation of pwd :-) Some shells cache the path, and don't do any system calls. When they do so (e.g. /bin/pwd), they call getcwd(3). In the current C library, this will try to travers .., ../.., ../../.. etc, and try to find the cwd step by step. If the current directory is unlinked, this will fail. Future implementations might consider /proc/self/cwd instead.
> 4 > How does the mkdir command work exactly?
mkdir(1) invokes mkdir(2). This, in turn, invokes a file-system dependent operation. On ext2, you can see the code in namei.c:ext2_mkdir.
Regards, Martin
| |