lkml.org 
[lkml]   [1998]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.040 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site