From 4453b56bd92c4ab9c0480dd99e80c65994711d33 Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Wed, 9 May 2018 15:43:47 -0700 Subject: Increment link count in CreateHardlink Closes #28 PiperOrigin-RevId: 196041391 Change-Id: I5d79f1735b9d72744e8bebc6897002b27df9aa7a --- pkg/sentry/fs/gofer/path.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/sentry/fs/gofer/path.go b/pkg/sentry/fs/gofer/path.go index d696f1561..6c4c2eed9 100644 --- a/pkg/sentry/fs/gofer/path.go +++ b/pkg/sentry/fs/gofer/path.go @@ -150,8 +150,10 @@ func (i *inodeOperations) CreateHardLink(ctx context.Context, _ *fs.Inode, targe if err := i.fileState.file.link(ctx, &targetOpts.fileState.file, newName); err != nil { return err } - // TODO: Don't increase link count because we can't properly accounts for links - // with gofers. + if i.session().cachePolicy == cacheAll { + // Increase link count. + targetOpts.cachingInodeOps.IncLinks(ctx) + } i.touchModificationTime(ctx) return nil } -- cgit v1.2.3