diff --git a/internal/dir.go b/internal/dir.go index 687674f0..e40bcdce 100644 --- a/internal/dir.go +++ b/internal/dir.go @@ -905,9 +905,6 @@ func (parent *Inode) Create( fs := parent.fs - parent.mu.Lock() - defer parent.mu.Unlock() - now := time.Now() inode = NewInode(fs, parent, &name) inode.Attributes = InodeAttributes{ @@ -948,9 +945,6 @@ func (parent *Inode) MkDir( return } - parent.mu.Lock() - defer parent.mu.Unlock() - inode = NewInode(fs, parent, &name) inode.ToDir() inode.touch() diff --git a/internal/goofys.go b/internal/goofys.go index 9070fb54..2546ea11 100644 --- a/internal/goofys.go +++ b/internal/goofys.go @@ -1013,10 +1013,10 @@ func (fs *Goofys) CreateFile( parent := fs.getInodeOrDie(op.Parent) fs.mu.RUnlock() - inode, fh := parent.Create(op.Name, op.Metadata) - parent.mu.Lock() + inode, fh := parent.Create(op.Name, op.Metadata) + fs.mu.Lock() defer fs.mu.Unlock() fs.insertInode(parent, inode) @@ -1049,14 +1049,14 @@ func (fs *Goofys) MkDir( parent := fs.getInodeOrDie(op.Parent) fs.mu.RUnlock() + parent.mu.Lock() + // ignore op.Mode for now inode, err := parent.MkDir(op.Name) if err != nil { return err } - parent.mu.Lock() - fs.mu.Lock() defer fs.mu.Unlock() fs.insertInode(parent, inode)