Closed TheJonny closed 2 months ago
Hi, thanks for working on this!
What about we set the close-on-exec flag for the test files in that bind-mount fs (as well as the fds in other mount tests), I kinda think this would be more straightforward, thoughts?
The close-on exec-flag will not prevent the issue, because the issue is not exec, but fork: it copies any opened file descriptors and then they live until exit or exec. if a file descriptor to something on the mountpoint is forked, unmount will fail.
it copies any opened file descriptors and then they live until exit or exec.
You are right, there is still a timespan between fork()
and execxxx()
that could theoretically make the test fail
fork() duplicates all open file descriptors, which then could prevent a successful umount().
So either when creating file descriptors or when requiring a file descriptor to be closed, we must make sure that no child processes have copies. since wile descriptors are created all over the place, It is more practical to wait for all child processes before unlock.
TODO: