-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails xfstests generic/035, directory file handle is lost #55
Comments
By the way, the good news is that tests 002 to 034 pass! |
your explanation sounds plausible, but I can't repro. func TestOpenDirFStat(t *testing.T) {
} gives me $ go test -v -run OpenDirFStat as you can see, the kernel sends the inode correctly, so the fstat succeeds. |
Interesting. This is what the test does: https://github.com/rfjakob/fuse-xfstests/blob/gocryptfs/src/t_rename_overwrite.c |
I think your test is missing the second directory -
This is what I get using t_rename_overwrite.c :
I can reproduce this every time. |
interesting. I didn't know rename for a directory could have an empty directory as target. so, note that fstat doesnt have Fh set, but IIRC that also holds for non-directory fstat. I'll have a look to see if I can so something. |
Yes, you can also do that using `mv` :
mkdir a otherdir otherdir/a
mv otherdir/a .
|
mv dir1 dir2 actually executes rename("dir1", "dir2/dir1") but I can repro the problem now. |
Yes exactly, that's why you need "otherdir"
|
If this is difficult to fix, maybe we can get away with documenting it as a
known limitation and leave it as is.
It seems to be important enough to get its own xfstest, but I can't think
of a use case that would break.
|
The test seemed to pass because the inode number is overridden in rawBridge.getattr, but looking at the permissions shows that the wrong directory is stat()ed: $ go test ./fs -run TestPosix/RenameOpenDir -count 1 -v [...] 17:49:46.454077 received ENODEV (unmount request), thread exiting 17:49:46.454343 received ENODEV (unmount request), thread exiting --- PASS: TestPosix (0.01s) --- SKIP: TestPosix/RenameOpenDir (0.01s) test.go:392: got permissions 0755, want 0700. Known limitation - see hanwen#55 PASS ok github.com/hanwen/go-fuse/v2/fs 0.016s Also, add a log message whenever the inode number is overridden, this should (probably) not happen during normal operation. And it actually only happens once in the test suite (in RenameOpenDir): $ go test ./... -count 1 -v 2>&1 | grep "overriding ino" 14:48:44.143694 warning: rawBridge.getattr: overriding ino 188663 with 186314 See hanwen#55 Change-Id: I8b2ddb84c35a3b28b4f5e032e7113f8d484a5981
Some ".deleted" logic was in place, but did not work properly when the Inode was in the root directory. Fix that by introducing the `found` variable and add a test that verifies that it works. Also, return `.go-fuse.$RANDOM/deleted` to make it very unlikely that the placeholder name matches an actual file or directory. Introducing the `/deleted` subdir makes sure operations creating a file or directory fail reliably with ENOENT. Tests now look like this: $ go test ./fs -run TestPosix/RenameOpenDir -count 1 -v === RUN TestPosix === RUN TestPosix/RenameOpenDir [...] --- PASS: TestPosix (0.01s) --- SKIP: TestPosix/RenameOpenDir (0.01s) test.go:383: Fstat failed: no such file or directory. Known limitation - see hanwen#55 PASS ok github.com/hanwen/go-fuse/v2/fs 0.014s Change-Id: I2eb6fd48a11df543c9b7daf62647cb9d8a892568
The test seemed to pass because the inode number is overridden in rawBridge.getattr, but looking at the permissions shows that the wrong directory is stat()ed: $ go test ./fs -run TestPosix/RenameOpenDir -count 1 -v [...] 17:49:46.454077 received ENODEV (unmount request), thread exiting 17:49:46.454343 received ENODEV (unmount request), thread exiting --- PASS: TestPosix (0.01s) --- SKIP: TestPosix/RenameOpenDir (0.01s) test.go:392: got permissions 0755, want 0700. Known limitation - see #55 PASS ok github.com/hanwen/go-fuse/v2/fs 0.016s Also, add a log message whenever the inode number is overridden, this should (probably) not happen during normal operation. And it actually only happens once in the test suite (in RenameOpenDir): $ go test ./... -count 1 -v 2>&1 | grep "overriding ino" 14:48:44.143694 warning: rawBridge.getattr: overriding ino 188663 with 186314 See #55 Change-Id: I8b2ddb84c35a3b28b4f5e032e7113f8d484a5981
Some ".deleted" logic was in place, but did not work properly when the Inode was in the root directory. Fix that by introducing the `found` variable and add a test that verifies that it works. Also, return `.go-fuse.$RANDOM/deleted` to make it very unlikely that the placeholder name matches an actual file or directory. Introducing the `/deleted` subdir makes sure operations creating a file or directory fail reliably with ENOENT. Tests now look like this: $ go test ./fs -run TestPosix/RenameOpenDir -count 1 -v === RUN TestPosix === RUN TestPosix/RenameOpenDir [...] --- PASS: TestPosix (0.01s) --- SKIP: TestPosix/RenameOpenDir (0.01s) test.go:383: Fstat failed: no such file or directory. Known limitation - see #55 PASS ok github.com/hanwen/go-fuse/v2/fs 0.014s Change-Id: I2eb6fd48a11df543c9b7daf62647cb9d8a892568
Note: xfstests generic/035 still fails, because the fstat cannot succeed |
loopbackfs (actually, anything that implements the nodefs API) fails xfstests generic/035.
What this test does is simple:
This fails because unlike handles that point to files, handles that point to directories are not kept open until the user closes them.
nodefs.OpenDir() should work like Open() and pass the file handle up.
The text was updated successfully, but these errors were encountered: