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

Add a notification mechanism for signaling when the mountpoint is ready #110

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

ariel-miculas
Copy link
Contributor

Add the notify_pipe option which allows the user to specify the path to a named pipe. When the mountpoint is ready, a message will be written to this pipe: 's' for success and 'f' for failure. To avoid blocking the fuse process until the pipe is read, a new process is spawned which performs a blocking operation on the pipe. In case of mount failure, no additional process is created and the main process blocks until the pipe is read.

An example of operation is provided below:

set -x
FIFO=$(mktemp -u)
mkfifo "$FIFO"
./squashfuse_ll -o notify_pipe="$FIFO" -f /path/to/squashfs/archive /tmp/squash&
STATUS=$(head -c1 "$FIFO")
if [ "$STATUS" = "s" ]; then
	echo "Mountpoint contains:"
	ls /tmp/squash
else
	echo "Mounting squashfuse on /tmp/squash failed"
fi

Fixes #49

@DrDaveD
Copy link
Collaborator

DrDaveD commented Aug 29, 2023

Is there any reason why this can't be done with squashfuse as well as squashfuse_ll?

@ariel-miculas
Copy link
Contributor Author

No, I'll add this to squashfuse also.

@DrDaveD
Copy link
Collaborator

DrDaveD commented Aug 30, 2023

The code looks pretty good to me now (although the CI checks are running at the moment). Please also add the new option to the squashfuse.1 man page and add an automated test or tests.

ll.c Outdated Show resolved Hide resolved
ll.c Outdated Show resolved Hide resolved
fuseprivate.c Outdated Show resolved Hide resolved
@vasi
Copy link
Owner

vasi commented Aug 31, 2023

Added some comments, but overall looks great!

@ariel-miculas
Copy link
Contributor Author

Thanks, @vasi. I've addressed your comments, updated the squashfuse.1 manpage and modified some tests in ll-smoke.sh.in to use this new notification mechanism.

@DrDaveD
Copy link
Collaborator

DrDaveD commented Sep 1, 2023

The new new smoke test unfortunately failed on the freebsd check. Look for FAIL:. It says

Image mounted successfully when it should have failed

@ariel-miculas
Copy link
Contributor Author

Thanks, I was looking for this log but couldn't find it. So it's probably fine to overmount squashfuse on top of an existing squashfuse mountpoint on freebsd, I need to change the test to make it fail the mount in other ways.

Add the notify_pipe option which allows the user to specify the path to
a named pipe. When the mountpoint is ready, a message will be written to
this pipe: 's' for success and 'f' for failure. To avoid blocking the
fuse process until the pipe is read, a new process is spawned which
performs a blocking operation on the pipe. In case of mount failure, no
additional process is created and the main process blocks until the pipe
is read.

An example of operation is provided below:
```
set -x
FIFO=$(mktemp -u)
mkfifo "$FIFO"
./squashfuse_ll -o notify_pipe="$FIFO" -f /path/to/squashfs/archive /tmp/squash&
STATUS=$(head -c1 "$FIFO")
if [ "$STATUS" = "s" ]; then
	echo "Mountpoint contains:"
	ls /tmp/squash
else
	echo "Mounting squashfuse on /tmp/squash failed"
fi
```

Fixes vasi#49
@ariel-miculas
Copy link
Contributor Author

I'm still awaiting approval for one workflow.

@DrDaveD
Copy link
Collaborator

DrDaveD commented Sep 7, 2023

Thanks for the reminder, I'm sorry I didn't notice the push. The good news was that freebsd passed. I now approved the workflow.

@DrDaveD DrDaveD merged commit b0efb4a into vasi:master Sep 7, 2023
6 checks passed
@DrDaveD
Copy link
Collaborator

DrDaveD commented Sep 8, 2023

This isn't fully working, see #112

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.

Notification of when the mount is ready
3 participants