Skip to content
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

pathInode.Truncate and friends ignore file argument #95

Closed
rfjakob opened this issue Jan 24, 2016 · 1 comment
Closed

pathInode.Truncate and friends ignore file argument #95

rfjakob opened this issue Jan 24, 2016 · 1 comment

Comments

@rfjakob
Copy link
Contributor

rfjakob commented Jan 24, 2016

For example, https://github.com/hanwen/go-fuse/blob/master/fuse/pathfs/pathfs.go#L666 . The passed file argument is ignored and instead it uses a random (?) file handle.

This sometimes picks a file handle that is already closed when gocryptfs handles the truncate request, leading to unneccessary error messages and a general sense of "how the heck can this even happen" at yours sincerly.

Is there a reason for not using file or are you ok if I fix this?

rfjakob added a commit to rfjakob/gocryptfs that referenced this issue Jan 24, 2016
...against concurrent closes.

The testcase

	(set -e; while true; do truncate -s $RANDOM b; done) &
	(set -e; while true; do truncate -s $RANDOM b; done) &

uncovered lots of unnecessary RMW failures that were the result
of concurrent closes.

With this patch, the only remaining error is "Truncate on forgotten file"
that is probably caused by a problem in the go-fuse lib
( hanwen/go-fuse#95 )
@hanwen
Copy link
Owner

hanwen commented Jan 28, 2016

if the file is specifiied, it's probably better to use it, so yes, a fix would be welcome.

The code that picks a random file is trying to do something intelligent, in case somebody truncates a file using truncate(), while it is being opened as a handle as well.

rfjakob added a commit to rfjakob/go-fuse that referenced this issue Jan 31, 2016
If the file handle is specified we should use it instead of
picking one at random.

Fixes hanwen#95.
rfjakob added a commit to rfjakob/go-fuse that referenced this issue Jan 31, 2016
If the file handle is specified we should use it instead of
picking one at random.

Note that the only real change is for ftruncate. For fstat, fchown
and fchmod the kernel currently never passes a file descriptor.

Fixes hanwen#95.
rfjakob added a commit to rfjakob/go-fuse that referenced this issue Feb 4, 2016
If the file handle is specified we should use it instead of
picking one at random.

Note that the only real change is for ftruncate. For fstat, fchown
and fchmod the kernel currently never passes a file descriptor.

Fixes hanwen#95.
rfjakob added a commit to rfjakob/go-fuse that referenced this issue Feb 6, 2016
If the file handle is specified we should use it instead of
picking one at random.

Note that the only real change is for ftruncate. For fstat, fchown
and fchmod the kernel currently never passes a file descriptor.

Fixes hanwen#95.
@hanwen hanwen closed this as completed in #97 Feb 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants