summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2018-05-09 15:43:47 -0700
committerShentubot <shentubot@google.com>2018-05-09 15:44:26 -0700
commit4453b56bd92c4ab9c0480dd99e80c65994711d33 (patch)
tree459da459f8a27b26d6892835eb60a682b4ade274 /pkg/sentry
parent1bdec86baed82fe8d79100693949f1259636e9db (diff)
Increment link count in CreateHardlink
Closes #28 PiperOrigin-RevId: 196041391 Change-Id: I5d79f1735b9d72744e8bebc6897002b27df9aa7a
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/fs/gofer/path.go6
1 files changed, 4 insertions, 2 deletions
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
}