From 8f11e257c9fbbde4ea2232f54313812a4c4a1fe9 Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Fri, 12 Jul 2019 13:11:53 -0700 Subject: Take a reference on the already-mounted inode before re-mounting it. PiperOrigin-RevId: 257855777 --- runsc/boot/fs.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runsc') 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) } -- cgit v1.2.3