File descriptors and Clones.

From: J. Scott Kasten (jsk@tetracon-eng.net)
Date: Tue May 23 2000 - 15:24:36 EST


I have an application that creates two clones using the clone() function
with arguments sufficient to share all memory, etc... One clone then
creates a file descriptor. The second clone then attempts to use that
file descriptor, after having used an interlock to ensure that the
variable holding the file descriptor has been loaded.

What happens is that the second clone sometimes receives an invalid file
descriptor error. However, if a delay slot is introduced in the second
clone, such as a syslog message "I'm here!" in this case, the problem goes
away. It's as if the kernel takes some time to propegate the process file
tables, or else invoking a kernel call such as schedualing the I/O for
the syslog message causes the tables to be refreshed so that the I/O on
the target file descriptor can proceed when requested.

Examination of the file descriptor variable before use in the second clone
does verify that the clone interlock is working and that it is not being
used un-initialized, even when the I/O request fails.

The kernel is 2.3.48 running on an NEC vr4300 (32 bit MIPS core) in an
embeded environment. Are there some known issues with file handles and
clones? Is this a bug that has been fixed in later dev kernels? Comments
please...

--

J. Scott Kasten Email: jsk AT tetracon-eng DOT net

"The only future you have is the one you choose to make for yourself..."

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:24 EST