From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 25 Feb 1998 17:42:34 -0600 From: G. David Butler gdb@dbSystems.com Subject: [9fans] create(2)/open(2) race for file creation Topicbox-Message-UUID: 727aa9f2-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19980225234234.YV-HDw_b8xSv3fvMaWyqU3VbxT5Y52pWx6JYqmDo1JU@z> I'm sure many of you wish this topic would go away, but... As you can guess I have made the change I have been advocating in this thread and have found an interesting race that affects everybody. In /sys/src/cmd/rc/plan9.c in the function Execute the statement Updenv(); Is in a race with the same call in /sys/src/cmd/rc/simple.c in the function Xsimple(). During the fork and subsequent exec, both the parent and child are writing the environment with sometimes spectacular results. With the new create(2), I saw periodic rc: can't open #e/blah since Create() in /sys/src/cmd/rc/plan9.c now has open(OWRITE|OTRUNC) and only if that fails create(OWRITE). If I add the additional open(OWRITE|OTRUNC) call to emulate the old create(2) call, the race stays hidden. I took out the Updenv() in Execute to follow /sys/src/cmd/rc/unix.c and because it makes sense. Also, if anybody is interested, the OTRUNC handling in /sys/src/9/port/devenv.c needs to include things other than OWRITE. David Butler gdb@dbSystems.com