You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If 2 threads call `MkdirAll` at the same time, they can both fail the
`Walk` check. 1 thread will succeed when calling `Mkdir`, and the other
will fail with `EEXIST`.
This is a classic mistake. I think this is a result of the initial
implementation not having access to the error code constants. When this
was resolved (by exporting them so they may be compared against), the
logic was not updated to account for this erroneous sequence.
This change inverts the order of operations, and simply ignores `EEXIST`
in the first call to `Mkdir. There's still a chance the directory can be
manipulated between the call to `Mkdir` and `Walk`, and this change does
not account for nor resolve that.
The POSIX spec does not currently define a standard way to atomically
create and open a directory in the same way `creat` works (which extends
into the 9P2000.L standard we're conforming to).
In the future we may decide to account for this problem using some
extension to the file system protocol, and/or by utilizing file system
locks. Again POSIX does not define locking semantics in regard to
directories as it does for regular files.
0 commit comments