summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2019-07-12 13:11:53 -0700
committergVisor bot <gvisor-bot@google.com>2019-07-12 13:15:14 -0700
commit8f11e257c9fbbde4ea2232f54313812a4c4a1fe9 (patch)
treec5fb42cd563090c5df47d912de5a4068fdb54a65 /runsc
parenteff2c264a48611a714cb89f28693a18ac029886a (diff)
Take a reference on the already-mounted inode before re-mounting it.
PiperOrigin-RevId: 257855777
Diffstat (limited to 'runsc')
-rw-r--r--runsc/boot/fs.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/runsc/boot/fs.go b/runsc/boot/fs.go
index f9a6f2d3c..d3e3196fd 100644
--- a/runsc/boot/fs.go
+++ b/runsc/boot/fs.go
@@ -906,7 +906,10 @@ func (c *containerMounter) mountSharedSubmount(ctx context.Context, mns *fs.Moun
}
defer target.DecRef()
+ // Take a ref on the inode that is about to be (re)-mounted.
+ source.root.IncRef()
if err := mns.Mount(ctx, target, source.root); err != nil {
+ source.root.DecRef()
return fmt.Errorf("bind mount %q error: %v", mount.Destination, err)
}