cmount: check for filesystem blowing up before Init is called

This commit is contained in:
Nick Craig-Wood 2017-05-10 09:34:01 +01:00
parent 0384364c3e
commit e6ffe3464c

View File

@ -269,8 +269,15 @@ func mount(f fs.Fs, mountpoint string) (*mountlib.FS, <-chan error, func() error
return errors.New("host unmount failed")
}
// Wait for the filesystem to become ready
<-fsys.ready
// Wait for the filesystem to become ready, checking the file
// system didn't blow up before starting
select {
case err := <-errChan:
err = errors.Wrap(err, "mount stopped before calling Init")
return nil, nil, nil, err
case <-fsys.ready:
}
return fsys.FS, errChan, unmount, nil
}