Skip to content

Commit

Permalink
Write backingStoreFsDev file in the store root
Browse files Browse the repository at this point in the history
* Fix issues with cleanup when XFS driver and quotas are in use

[finishes #140762137]

Signed-off-by: Tiago Scolari <[email protected]>
  • Loading branch information
Callisto13 authored and tscolari committed Mar 1, 2017
1 parent fa79e0e commit c87252f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions integration/clean_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ var _ = Describe("Clean", func() {
_, err := Runner.Create(groot.CreateSpec{
ID: "my-image-2",
BaseImage: anotherBaseImagePath,
DiskLimit: 10 * 1024 * 1024,
})
Expect(err).NotTo(HaveOccurred())

Expand Down
17 changes: 7 additions & 10 deletions integration/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ var _ = Describe("Create", func() {
_, err := Runner.Create(groot.CreateSpec{
ID: "my-busybox",
BaseImage: "docker:///busybox:1.26.2",
DiskLimit: 10 * 1024 * 1024,
})
Expect(err).NotTo(HaveOccurred())

Expand All @@ -425,11 +426,9 @@ var _ = Describe("Create", func() {
Expect(preContents).To(HaveLen(1))

_, err = Runner.Create(groot.CreateSpec{
ID: "my-empty",
BaseImage: "docker:///cfgarden/empty:v0.1.1",
CleanOnCreate: true,
CleanOnCreateIgnoreImages: []string{"docker://my-image"},
CleanOnCreateThresholdBytes: int64(250000),
ID: "my-empty",
BaseImage: "docker:///cfgarden/empty:v0.1.1",
CleanOnCreate: true,
})
Expect(err).NotTo(HaveOccurred())

Expand Down Expand Up @@ -463,11 +462,9 @@ var _ = Describe("Create", func() {
Expect(preContents).To(HaveLen(1))

_, err = Runner.Create(groot.CreateSpec{
ID: "my-empty",
BaseImage: "docker:///cfgarden/empty:v0.1.1",
CleanOnCreate: false,
CleanOnCreateIgnoreImages: []string{"docker://my-image"},
CleanOnCreateThresholdBytes: int64(250000),
ID: "my-empty",
BaseImage: "docker:///cfgarden/empty:v0.1.1",
CleanOnCreate: false,
})
Expect(err).NotTo(HaveOccurred())

Expand Down
8 changes: 8 additions & 0 deletions store/filesystems/overlayxfs/image_driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,14 @@ var _ = Describe("ImageDriver", func() {
spec.DiskLimit = 1024 * 1024 * 10
})

It("creates the backingFsBlockDev device in the `images` parent folder", func() {
backingFsBlockDevPath := filepath.Join(StorePath, "backingFsBlockDev")

Expect(backingFsBlockDevPath).ToNot(BeAnExistingFile())
Expect(driver.CreateImage(logger, spec)).To(Succeed())
Expect(backingFsBlockDevPath).To(BeAnExistingFile())
})

It("can overwrite files from the lowerdirs", func() {
Expect(driver.CreateImage(logger, spec)).To(Succeed())
imageRootfsPath := filepath.Join(spec.ImagePath, overlayxfs.RootfsDir)
Expand Down
1 change: 1 addition & 0 deletions store/filesystems/overlayxfs/quota/projectquota_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ func getDirFd(dir *C.DIR) uintptr {
// and create a block device node under the home directory
// to be used by quotactl commands
func makeBackingFsDev(home string) (string, error) {
home = path.Dir(home)
fileinfo, err := os.Stat(home)
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion store/garbage_collector/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (g *GarbageCollector) unusedVolumes(logger lager.Logger, keepImages []strin

volumes, err := g.volumeDriver.Volumes(logger)
if err != nil {
return nil, errorspkg.Errorf("failed to retrieve volume list")
return nil, errorspkg.Wrap(err, "failed to retrieve volume list")
}

orphanedVolumes := make(map[string]bool)
Expand Down

0 comments on commit c87252f

Please sign in to comment.