From 1723444ba2587a878605622f5c01188e578a97e9 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Fri, 17 Feb 2017 18:43:10 -0800 Subject: [PATCH] snapshot/overlay: prevent committing view Signed-off-by: Derek McGowan (github: dmcgowan) --- snapshot/overlay/overlay.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snapshot/overlay/overlay.go b/snapshot/overlay/overlay.go index 69f1c88..588aec2 100644 --- a/snapshot/overlay/overlay.go +++ b/snapshot/overlay/overlay.go @@ -253,6 +253,13 @@ func (a *activeDir) setParent(name string) error { } func (a *activeDir) commit(name string, c *cache) error { + if _, err := os.Stat(filepath.Join(a.path, "fs")); err != nil { + if os.IsNotExist(err) { + return errors.New("cannot commit view") + } + return err + } + // TODO(stevvooe): This doesn't quite meet the current model. The new model // is to copy all of this out and let the transaction continue. We don't // really have tests for it yet, but this will be the spot to fix it.