Re: NULL task->files problem?

David S. Miller (davem@jenolan.rutgers.edu)
Sat, 4 Oct 1997 14:16:37 -0400


Date: Sat, 04 Oct 1997 13:49:50 -0400
From: Bill Hawes <whawes@star.net>

Is there any reason why a process needs to have a task->files
structure to fork another process? I want the nfs lockd and rpciod
processes to not hold their parent's files open, but the code in
do_fork() isn't checking for task->files being NULL. So if I do an
exit_files in lockd, this causes an oops if the rpciod process
hasn't already been started.

I suppose I could defer doing the exit_files(), but it seems it
would be easier to have do_fork() check for NULL. Any suggestions
on this?

Interesting problem.

What you could do for the moment is the following. Fork the kernel
thread with the CLONE_FILES flag set, in copy_files() change the first
couple lines to go:

oldf = current->files;
if(clone_flags & CLONE_FILES) {
if(oldf)
oldf->count++;
return 0;
}

And everything else should be happy... I think.

Later,
David "Sparc" Miller
davem@caip.rutgers.edu