From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sun, 8 Feb 1998 10:16:01 -0600 From: G. David Butler gdb@dbSystems.com Subject: [9fans] create(2)/open(2) race for file creation Topicbox-Message-UUID: 71fa9280-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19980208161601.6oERwsfpuvmqjXnjWE3yYGHkCy2xFmVbhj43qR0qtuU@z> >From: "Dave Presotto" >This is why I got ken to introduce exclusive access files. I >use one as a lock for a directory/file/whatever. I tried that with: open(lock file in directory) if open fail { create write close } close(lock file) But the 9p overhead and the bottleneck created convinced me that it was not a good idea. The above becomes: open(2) walk(5) open(5) open(2) walk(5) [fails] create(2) walk(5) [create(2) trying to determine to send the create(5)] create(5) write(2)... close(2) clunk(5) close(2) clunk(5) If we change create(2) to do create(5) then: if create() success { write close } becomes: create(2) create(5) write(2)... close(2) clunk(5) Much better. David Butler gdb@dbSystems.com