fusefrontend_reverse: workaround ext4 test failure

The extended TestLongnameStat() exposes a pathological case
when run on ext4, as ext4 reuses inode numbers immediately.

This change modifies the test to not delete the files immediately,
so the inode numbers cannot be reused immediately.

Fix for the underlying issue is a TODO.
This commit is contained in:
Jakob Unterwurzacher 2017-10-03 21:15:17 +02:00
parent 4da245c69d
commit 64e5906ffa

View File

@ -2,6 +2,7 @@ package reverse_test
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"syscall"
@ -23,13 +24,17 @@ func TestLongnameStat(t *testing.T) {
fd.Close()
path := dirC + "/" + name
if !test_helpers.VerifyExistence(path) {
t.Fail()
t.Fatalf("failed to verify %q", path)
}
test_helpers.VerifySize(t, path, 0)
// A large number of longname files is a performance problem in
// reverse mode. Delete the file once we are done with it to speed up
// the test (2 seconds -> 0.2 seconds)
syscall.Unlink(dirA + "/" + name)
// reverse mode. Move the file out of the way once we are done with it
// to speed up the test (2 seconds -> 0.2 seconds).
// We do NOT unlink it because ext4 reuses inode numbers immediately,
// which will cause "Found linked inode, but Nlink == 1" warnings and
// file not found errors.
// TODO: This problem should be handled at the go-fuse level.
syscall.Rename(dirA+"/"+name, test_helpers.TmpDir+"/"+fmt.Sprintf("x%d", i))
}
}