Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Data loss on open #44

Closed
Stebalien opened this issue Dec 19, 2018 · 2 comments
Closed

Data loss on open #44

Stebalien opened this issue Dec 19, 2018 · 2 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@Stebalien
Copy link
Member

In Open, need to lock the file before getting the current node, not after. Otherwise, we could clobber previous updates.

That is, the following code needs to move up:

go-mfs/file.go

Lines 88 to 96 in 2019c38

switch flags {
case OpenReadOnly:
fi.desclock.RLock()
case OpenWriteOnly, OpenReadWrite:
fi.desclock.Lock()
default:
// TODO: support other modes
return nil, fmt.Errorf("mode not supported")
}

@Stebalien Stebalien added the kind/bug A bug in existing code (including security flaws) label Dec 19, 2018
@schomatis
Copy link
Contributor

Yes, that will be handled in #32 (closing this to avoid duplicates, but please reopen if I'm conflating different issues).

@Stebalien
Copy link
Member Author

Ah. I thought that issue looked familiar!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

2 participants