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

Rename does not work #3

Closed
rfjakob opened this issue Sep 7, 2015 · 4 comments
Closed

Rename does not work #3

rfjakob opened this issue Sep 7, 2015 · 4 comments
Assignees
Labels

Comments

@rfjakob
Copy link

rfjakob commented Sep 7, 2015

Renaming a file leaves the renamed file in a broken state that is only fixed by unmounting and mounting again:

$ echo foo > foo.txt
$ ls -l
-rw-rw-r--. 1 jakob jakob 4  7. Sep 20:58 foo.txt
$ mv foo.txt bar.txt
$ ls -l
----------. 0 root root 0  1. Jan 1970  bar.txt
$ rm bar.txt
rm: cannot remove ‘bar.txt’: Input/output error
@airnandez airnandez added the bug label Sep 9, 2015
@airnandez airnandez self-assigned this Sep 9, 2015
@airnandez
Copy link
Owner

Thanks for this report. I managed to reproduce it in Ubuntu, but not on MacOS X. From what I have observed, the file is correctly renamed in the shadow directory but its metadata attributes are incorrectly exposed by clueFS after the rename operation.

I think I have a reasonably good idea of where the problem is and am working on fixing it.

@rfjakob
Copy link
Author

rfjakob commented Sep 9, 2015

As I understand it, the kernel gets node ids from Lookup(). bazil.org/fuse saves those node ids for later access. The kernel knows that the node id does not change when it renames a file. So the next stat() goes to the same old bazil.org/fuse node.

The problem is that the rename operates on the parent directory and not on the file node. So you'd have to somehow find the affected file node and change file.name there.

This problem is solved in go-fuse in the pathfs layer, see https://github.com/hanwen/go-fuse/blob/master/fuse/pathfs/pathfs.go

@rfjakob
Copy link
Author

rfjakob commented Sep 9, 2015

That it works on OSX is probably because the FUSE module in the OSX kernel is more basic and does not remember the node id when you rename the file.

Edit: go-fuse has a fully working loopback example: https://github.com/hanwen/go-fuse/tree/master/example/loopback

airnandez added a commit that referenced this issue Sep 17, 2015
…ist of entries

in it and their association to their directory or file objects.
@airnandez
Copy link
Owner

Fixed in master. No release yet since I want to add other modifications before tagging a new release.

Thanks for having reported this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants