Take a reference on the already-mounted inode before re-mounting it.

PiperOrigin-RevId: 257855777
This commit is contained in:
Nicolas Lacasse
2019-07-12 13:15:14 -07:00
committed by gVisor bot
parent eff2c264a4
commit 8f11e257c9
+3
View File
@@ -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)
}