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

Bug: Can't mount with -o allow_other on WSL, and blobfuse2 print no error message and errno is 0 #1081

Closed
cvvz opened this issue Mar 13, 2023 · 19 comments · Fixed by #1087
Closed
Assignees
Milestone

Comments

@cvvz
Copy link
Contributor

cvvz commented Mar 13, 2023

Which version of blobfuse was used?

blobfuse2 2.0.2

Which OS distribution and version are you using?

WSL2.0

If relevant, please share your mount command.

blobfuse2 mount ~/myblob -o allow_other --file-cache-timeout-in-seconds=120 --use-attr-cache=true --cancel-list-on-mount-seconds=10 -o attr_timeout=120 -o entry_timeout=120 -o negative_timeout=120 --log-level=LOG_WARNING --cache-size-mb=1000 --container-name=pvc-0e85db3b-d632-49ab-b4ba-cc93d332a132 --pre-mount-validate=true --use-https=true --empty-dir-check=false --tmp-path=/mnt/tmp

What was the issue encountered?

mount failed, but blobfuse2 print no error message, and the errno is 0.
image

blobfuse mount failed as well, but it prints concrete error message which help me to solve this problem.
image

  1. There is definitely a bug in blobfuse2, since it doesn't print error message and errno is 0 when the mount operation actually failed.

  2. Another question is, why mount with -o allow_other on WSL would fail whereas Linux won't? I checked /etc/fuse.conf, the content of them is the same:

cat  /etc/fuse.conf   
                                                                                                                          15:26:36  羽3m 15.082s
# The file /etc/fuse.conf allows for the following parameters:
#
# user_allow_other - Using the allow_other mount option works fine as root, in
# order to have it work as user you need user_allow_other in /etc/fuse.conf as
# well. (This option allows users to use the allow_other option.) You need
# allow_other if you want users other than the owner to access a mounted fuse.
# This option must appear on a line by itself. There is no value, just the
# presence of the option.

#user_allow_other


# mount_max = n - this option sets the maximum number of mounts.
# Currently (2014) it must be typed exactly as shown
# (with a single space before and after the equals sign).

#mount_max = 1000

Have you found a mitigation/solution?

mount without -o allow_other on WSL

Please share logs if available.

	cat /var/log/blobfuse2.log
	Mar 13 14:30:28 WIN-QPHICKGMG9J blobfuse2[13282]: LOG_WARNING [mount.go (364)]: mount: unsupported v1 CLI parameter: pre-mount-validate is always true in blobfuse2.
	Mar 13 14:30:28 WIN-QPHICKGMG9J blobfuse2[13282]: LOG_CRIT [mount.go (384)]: Starting Blobfuse2 Mount : 2.0.2 on [Ubuntu 22.04.1 LTS]
	Mar 13 14:30:28 WIN-QPHICKGMG9J blobfuse2[13282]: LOG_CRIT [mount.go (385)]: Logging level set to : LOG_WARNING
	Mar 13 14:30:28 WIN-QPHICKGMG9J blobfuse2[13282]: LOG_WARNING [config.go (331)]: ParseAndValidateConfig : account endpoint not provided, assuming the default .core.windows.net style endpoint
	Mar 13 14:30:31 WIN-QPHICKGMG9J blobfuse2[13292]: LOG_WARNING [mount.go (364)]: mount: unsupported v1 CLI parameter: pre-mount-validate is always true in blobfuse2.
	Mar 13 14:30:31 WIN-QPHICKGMG9J blobfuse2[13292]: LOG_CRIT [mount.go (384)]: Starting Blobfuse2 Mount : 2.0.2 on [Ubuntu 22.04.1 LTS]
	Mar 13 14:30:31 WIN-QPHICKGMG9J blobfuse2[13292]: LOG_CRIT [mount.go (385)]: Logging level set to : LOG_WARNING
	Mar 13 14:30:31 WIN-QPHICKGMG9J blobfuse2[13292]: LOG_WARNING [config.go (331)]: ParseAndValidateConfig : account endpoint not provided, assuming the default .core.windows.net style endpoint
	Mar 13 14:30:31 WIN-QPHICKGMG9J blobfuse2[13292]: LOG_ERR [libfuse_handler.go (178)]: Libfuse::initFuse : failed to mount fuse
	Mar 13 14:30:31 WIN-QPHICKGMG9J blobfuse2[13292]: LOG_ERR [libfuse.go (150)]: Libfuse::Start : Failed to init fuse [failed to mount fuse]
	Mar 13 14:30:31 WIN-QPHICKGMG9J blobfuse2[13292]: LOG_ERR [mount.go (483)]: mount: error unable to start pipeline [failed to mount fuse]
@cvvz cvvz changed the title Bug: Can't mount with -o allow_other on WSL, but blobfuse2 print no error message and errno is 0 Bug: Can't mount with -o allow_other on WSL, and blobfuse2 print no error message and errno is 0 Mar 13, 2023
@vibhansa-msft
Copy link
Member

"There is definitely a bug in blobfuse2, since it doesn't print error message and errno is 0 when the mount operation actually failed." : When fuse based system is mounted it forks into another process. This failure is hit in child process and by that time parent process is already complete and hence it can not print anything on that console. This is the reason to print the logs in a log file. Blobfuse will do config validation at its end before the fork where if any of your config is invalid, error will be printed and exit code will be non-zero but allow_other is a fuse config and hence it can not be validated by blobfuse binary itself.

@vibhansa-msft vibhansa-msft self-assigned this Mar 13, 2023
@vibhansa-msft vibhansa-msft added this to the V2-2.0.3 milestone Mar 13, 2023
@cvvz
Copy link
Contributor Author

cvvz commented Mar 13, 2023

Why Blobfuse v1 can print error logs as expected but blobfuse2 can't?

@cvvz
Copy link
Contributor Author

cvvz commented Mar 13, 2023

When fuse based system is mounted it forks into another process. This failure is hit in child process and by that time parent process is already complete and hence it can not print anything on that console.

I think parent process should wait for child process until it has completed the mount operation successfully, otherwise we can never know whether the mount operation is successful or not.

@andyzhangx
Copy link
Contributor

can we reopen this issue?

@cvvz
Copy link
Contributor Author

cvvz commented Mar 13, 2023

@vibhansa-msft blob csi driver rely on the result of blobfuse2 mount operation. If the actual result of mount is failed but the operation return success anyway it will cause confusing problem. I think this is a problem needs to solve.

@vibhansa-msft vibhansa-msft reopened this Mar 13, 2023
@vibhansa-msft
Copy link
Member

In case of v1 we cache the stderr handle and it uses that to print out the error message, but allow_other failure is not returned back in form of an error code. Once mount is complete (fork the child) parent always returns back with success there as well.
What we have done in v1 is also a hacky way only and not a clean design.

@vibhansa-msft
Copy link
Member

One potential way to get the error on console and get a non-0 error code is to mount in foreground which means your shell will be blocked till the time blobfuse is running.

@vibhansa-msft
Copy link
Member

User who has executed the mount command may not have access to /etc/fuse.conf file and hence we can not pre-validate that mount will work or not. Hence relying on fuse to provide the error is the only option we have here.

@vibhansa-msft
Copy link
Member

Also, do you really need allow_other option to be there? It's more of a security threat using this option as this means your mount point is available to all the users on the system. So, unless really required you shall not use this feature.

@cvvz
Copy link
Contributor Author

cvvz commented Mar 13, 2023

In case of v1 we cache the stderr handle and it uses that to print out the error message, but allow_other failure is not returned back in form of an error code.

I've tried blobfuse v1 and the errno is non-zero.

@cvvz
Copy link
Contributor Author

cvvz commented Mar 13, 2023

One potential way to get the error on console and get a non-0 error code is to mount in foreground which means your shell will be blocked till the time blobfuse is running.

I think this behavior is acceptable, IMO, mount operation should be synchronized, otherwise we cannot know whether the mount point is ready for usage.

@cvvz
Copy link
Contributor Author

cvvz commented Mar 13, 2023

do you really need allow_other option to be there?

No, it's just for testing.

@vibhansa-msft
Copy link
Member

In case of v1 we cache the stderr handle and it uses that to print out the error message, but allow_other failure is not returned back in form of an error code.

I've tried blobfuse v1 and the errno is non-zero.

Yes I was investigating that from my end too. Reason for this is in v1 we fork using libfuse's mount api directly but in case of Golang, that does not work directly so we need to create a child process before we call libfuse's mount. Child process starts again from beginging and not from the point its forked and hence it's not possible here to catch that error code. I do not see any easy way out of this as of now. If possible either you can avoid using allow_other or try mounting in foreground which just means your shell will be hung up till blobfuse runs and may be you will need another bash to access the mount point.

@cvvz
Copy link
Contributor Author

cvvz commented Mar 13, 2023

Is it possible to choose mounting in foreground using blobfuse2?

@vibhansa-msft
Copy link
Member

Yes it is, you can provide a cli option "--foreground=true"to do the same.

@cvvz
Copy link
Contributor Author

cvvz commented Mar 14, 2023

Is this a new option in blobfuse2 or blobfuse v1 also support?
Which mode (foreground or background) is the same behavior as v1?

@vibhansa-msft
Copy link
Member

V1 also supports foreground mount with "-d" cli option, in V2 both -d and --foreground shall work fine. Also, just to reiterate if you mount in foreground your shell will be blocked until you unmount blobfuse.

@cvvz
Copy link
Contributor Author

cvvz commented Mar 15, 2023

V1 also supports foreground mount with "-d" cli option

We never used this option in V1 before, but we did not encounter such problem ever. I wonder is there any behavior change between V1 and V2?

@cvvz
Copy link
Contributor Author

cvvz commented Mar 15, 2023

Could you take a look to confirm whether there are any other similar issues like this could happen as well?

vibhansa-msft added a commit that referenced this issue Mar 21, 2023
… in fuse config (#1087)

* Fix for #1081 to return with non zero status code if allow_other is not enable in fuse.conf
vibhansa-msft pushed a commit that referenced this issue Mar 22, 2023
#1079
Pod deletion will cause global mount point to disappear. The root cause is csi driver will bind mount the global mount point into Pod volume immediately after blobfuse2 mount return successfully. However, fuse is still mounting at background, so actually bind mount and fuse mount happened at the same time, this will lead to a problem that unmount the bind mount (when deleting a Pod) will cause the original mount point unmounted as well.
#1081
Mount is actually failed, but the errno returned by blobfuse2 is 0 and no error log (both terminal and log file).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants