diff options
author | Fabricio Voznika <fvoznika@google.com> | 2018-05-09 15:43:47 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-05-09 15:44:26 -0700 |
commit | 4453b56bd92c4ab9c0480dd99e80c65994711d33 (patch) | |
tree | 459da459f8a27b26d6892835eb60a682b4ade274 | |
parent | 1bdec86baed82fe8d79100693949f1259636e9db (diff) |
Increment link count in CreateHardlink
Closes #28
PiperOrigin-RevId: 196041391
Change-Id: I5d79f1735b9d72744e8bebc6897002b27df9aa7a
-rw-r--r-- | pkg/sentry/fs/gofer/path.go | 6 |
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 } |