google / google/gvisor

Multiple containers in one pod bind the same dir in host may result in disk space leak

Open
#2,416 6 comments 0 reactions 0 assignees View on GitHub
area: container runtime area: filesystem area: integration priority: p2 type: enhancement
Dominant language
Go
Stars
19.3k
Forks
2k
Avg merge
3d 5h
Merged PRs (30d)
264

Description

In our environment, there are more than one containers in one pod, and the different containers may share the the same dir in host with "type bind".
The config may like this:
``` {"destination":"/tmp/logs","type":"bind","source":"/tmp/test","options":["rbind","rprivate"]} ```

Because of the dirent cache in sentry, if two containers operator the same file in the shared dir, it may result in two problems:

1. Container A opens file X and close it, then sentry will hold the dirent cache of file X, and sandbox process and the gofer process of container A will hold the fd of file X.
Then if container B deletes file X, file X will be "deleted" state, and the disk space will not be released util the cache of file X be cleaned up.

2. Container A opens file X and close it.
Contianer B renames file X to file Y.
Container A deletes file Y.
file Y will be "deleted" state, and the disk space will not be released util the cache of file Y be cleaned up.

I have no way to solve the problem, unless close the dirent cache.

```
runsc --version
runsc version release-20200323.0-119-g78126611e61e
spec: 1.0.1-dev
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.