This commit is contained in:
Alex Yatskov 2015-06-21 22:02:46 +09:00
parent 51df28c6ee
commit b51f14aa7b

12
dir.go
View File

@ -109,6 +109,10 @@ func (vd *verDir) createFile(name string, flags fuse.OpenFlags, mode os.FileMode
} }
func (vd *verDir) removeDir(name string) error { func (vd *verDir) removeDir(name string) error {
if err := vd.version(); err != nil {
return err
}
node := vd.dirs[name].node node := vd.dirs[name].node
ver := node.ver ver := node.ver
@ -127,6 +131,10 @@ func (vd *verDir) removeDir(name string) error {
} }
func (vd *verDir) removeFile(name string) error { func (vd *verDir) removeFile(name string) error {
if err := vd.version(); err != nil {
return err
}
node := vd.files[name].node node := vd.files[name].node
ver := node.ver ver := node.ver
@ -195,10 +203,6 @@ func (vd *verDir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
vd.mutex.Lock() vd.mutex.Lock()
defer vd.mutex.Unlock() defer vd.mutex.Unlock()
if err := vd.version(); err != nil {
return err
}
if req.Dir { if req.Dir {
return vd.removeDir(req.Name) return vd.removeDir(req.Name)
} else { } else {