Fixing the creation of multiple inode creation for the same name when…#572
Fixing the creation of multiple inode creation for the same name when…#572skuppa-veeva wants to merge 1 commit intokahing:masterfrom
Conversation
… MkDir or CreateFile executed simultaneously. Get parent lock before creating inode from `Goofys.MkDir` or `Goofys.CreateFile` to avoid creating a duplicate inode. Remove get lock from `Inode.Create` and `Inode.MkDir` since it lock already acquired by the caller.
d714e44 to
1ff2c07
Compare
| parent.mu.Lock() | ||
| defer parent.mu.Unlock() | ||
|
|
There was a problem hiding this comment.
We don't need to parent lock since it is already locked from caller.
| parent.mu.Lock() | ||
| defer parent.mu.Unlock() | ||
|
|
There was a problem hiding this comment.
We need lock here as well, since caller already has a lock.
| inode, fh := parent.Create(op.Name, op.Metadata) | ||
|
|
||
| parent.mu.Lock() | ||
|
|
There was a problem hiding this comment.
The folder creation is moved after acquiring the parent lock. This lock needs to be atomic between creating inode and inserting into map of inodes.
| parent.mu.Lock() | ||
|
|
There was a problem hiding this comment.
The folder creation is moved after acquiring the parent lock. This lock needs to be atomic between creating inode and inserting into map of inodes.
|
@kahing could you review this PR and give us your expert advice. |
|
@kahing could you review this PR? |
|
This PR seems to fix multiple issues but we need a rebase to make it work with current code base. I'm not sure you're still tracking it but we probably want to try to get this PR merged as part of the next release. |
Fixing the creation of multiple inode creation for the same name when MkDir executed simultaneously.