Skip to content

Conversation

@McBane87
Copy link

To be clear in the beginning:
I cannot ensure that I did everything the right way, because I'm not really a C Programmer.
I only have a very basic knowledge in C.

What have I done:

  • Adjusted all existing functions to work with Fuse 3
  • Added an special option filter. This way one can pass options like "nofail" without libfuse complaining. Such options are neccessary for systemd+fstab, but will be ignored by fuse and bindfs.

What I havn't done:

  • Testing proper functionality with other OS like "OS X".
    You maybe have to finetune. I only did testing CentOS 7 so far.

@mpartel
Copy link
Owner

mpartel commented Jan 27, 2021

Oh wow, thanks!

I'll go through the code in detail in a few days.

Some questions in the meantime:

  • Did you run the tests? (cd tests && ./test_bindfs.rb && sudo ./test_bindfs.rb && ./test_bindfs.rb --valgrind && sudo ./test_bindfs.rb --valgrind (which I really should simplify and document))
  • Is the renameat2 fallback implementation copied from somewhere or did you write it yourself?
  • The fallback adds quite a lot of complexity. Would it be reasonable to just not support flags != 0 on platforms that don't have renameat2?

@McBane87
Copy link
Author

  • Did you run the tests? (cd tests && ./test_bindfs.rb && sudo ./test_bindfs.rb && ./test_bindfs.rb --valgrind && sudo ./test_bindfs.rb --valgrind (which I really should simplify and document))

No, I wasn't aware of this. But I will do this now.

  • I already run into an error with "readdir inodes", looks like putting the options readdir_ino & use_ino into bindfs_init function isn't working. Unfortunately just passing them via -o isn't working anymore in fuse3. Those options are not known anymore.
  • Also I have to recheck my filter_special_opts function. Running into a segfault, when it is used. Odd thing is. Some hours ago it was working somehow....
  • Is the renameat2 fallback implementation copied from somewhere or did you write it yourself?

I wrote this myself. With my basic C knowledge

  • The fallback adds quite a lot of complexity. Would it be reasonable to just not support flags != 0 on platforms that don't have renameat2?

I guess just ignoring the flags should also work. In their (libfuse) own example passthrough.c, they also just ignore the flags

@McBane87
Copy link
Author

McBane87 commented Jan 27, 2021

Fixed my Segfault on filter_special_opts with commit 7ddb769

@McBane87
Copy link
Author

McBane87 commented Jan 27, 2021

Regarding readdir_ino & use_ino:
Looks like setting those options in bindfs_init is working. But it is not possible to use both options together.

fuse.h comment for readdir_ino:

If use_ino option is given, this option is ignored.

fuse.h completely for both options:

	/**
	 * Honor the st_ino field in the functions getattr() and
	 * fill_dir(). This value is used to fill in the st_ino field
	 * in the stat(2), lstat(2), fstat(2) functions and the d_ino
	 * field in the readdir(2) function. The filesystem does not
	 * have to guarantee uniqueness, however some applications
	 * rely on this value being unique for the whole filesystem.
	 *
	 * Note that this does *not* affect the inode that libfuse 
	 * and the kernel use internally (also called the "nodeid").
	 */
	int use_ino;

	/**
	 * If use_ino option is not given, still try to fill in the
	 * d_ino field in readdir(2). If the name was previously
	 * looked up, and is still in the cache, the inode number
	 * found there will be used.  Otherwise it will be set to -1.
	 * If use_ino option is given, this option is ignored.
	 */
	int readdir_ino;

So this way I will never be able to pass the test because always one of the ino tests will fail. When commenting out the preserves readdir inode numbers check, then I'm able to pass the check successful in non-root mode. But with root I run into an issue, which also happen when I compile with fuse2. So I guess the test scripts are outdated?

--- --create-as-user should be default for root ---
[    ]
/var/tmp/sclwTRY6O: line 8: -u: command not found
/var/tmp/sclsG43dO: line 8: -u: command not found
/var/tmp/sclGahATR: line 8: -u: command not found
ERROR: testcase `--create-as-user should be default for root' failed
No such file or directory - mnt/file
  ./test_bindfs.rb:109:in `stat'
  ./test_bindfs.rb:109:in `block (2 levels) in <main>'
  /home/mcbane/build/GIT/bindfs/tests/common.rb:223:in `assert'
  ./test_bindfs.rb:109:in `block in <main>'
  /home/mcbane/build/GIT/bindfs/tests/common.rb:150:in `call'
  /home/mcbane/build/GIT/bindfs/tests/common.rb:150:in `testenv'
  /home/mcbane/build/GIT/bindfs/tests/common.rb:195:in `root_testenv'
  ./test_bindfs.rb:103:in `<main>'

@mpartel mpartel changed the base branch from master to fuse3 January 30, 2021 07:18
@mpartel
Copy link
Owner

mpartel commented Jan 30, 2021

Thanks! I'll merge this to branch fuse3 and play around with it a bit and then get back to you.

@mpartel
Copy link
Owner

mpartel commented Jan 30, 2021

Making progress, but not there yet.

  • Will need to work around the readdir use_ino problem. Even if it's a FUSE bug, lots of distros will probably never patch it.
  • Got all other tests to pass (on Debian 10 at least).
  • I've not yet reviewed filter_special_opts properly.
  • More testing, more cleanup..

I'll continue when I find a bit of time again.

@mpartel
Copy link
Owner

mpartel commented Feb 14, 2021

Released as 1.15.0!

@mpartel mpartel mentioned this pull request Feb 16, 2021
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

Successfully merging this pull request may close these issues.

2 participants