> I would like to ask three questions on the subject in relation to the
> following code from 2.3.46.
>
> if (inode->i_sb)
> file_move(f, &inode->i_sb->s_files);
> if (f->f_op && f->f_op->open) {
> error = f->f_op->open(inode,f);
> if (error)
> goto cleanup_all;
> }
>
> 1. What purposes has the list s_files ?
It's the list where all opened files on this filesystem end up. Keeping them
all on global list didn't scale - we had to traverse the animal in quite
a few places. Only sockets and pipes stay on the old global list - the rest
moves away (every struct file is placed there upon creation, but most of
them migrate, some even twice - e.g. tty layer keeps a list for each TTY and
moves files there upon ->open()).
> 2. How is a file removed from the list if open() fails ?
put_filp()
> 3. Are there any locking requirements concerning this list ?
file_list_{un,}lock(). Better leave it alone - fput() and friends are taking
care of the thing. And scanning it is not a thing to be done lightly - it
should be atomic (we are holding a spinlock) and list still can be long.
Why are you asking? If you are going to play with this layer - ask me about
details. Resurrection of old races here would be the last thing I wanted -
they are a _hell_ to trace.