ensure that we've unrequested mapping when applying empty storage

This commit is contained in:
Seebs 2020-02-07 12:29:31 -06:00 committed by Matt Jaffee
parent 337e451cc7
commit 99d865c2ea
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF

View file

@ -294,6 +294,9 @@ func (f *fragment) importStorage(data []byte, file *os.File, newGen generation,
// to use a new storage as backing store.
func (f *fragment) applyStorage(data []byte, file *os.File, newGen generation, mapped bool) (bool, error) {
if len(data) == 0 {
// This shouldn't be used anyway in this path, but just in
// case, we'll be explicit about it.
f.storage.PreferMapping(false)
if file != nil {
fi, err := file.Stat()
if err != nil {