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

Automatically exit diod once last export has been clunked by the last client #84

Closed
Rudd-O opened this issue Dec 12, 2021 · 7 comments
Closed

Comments

@Rudd-O
Copy link

Rudd-O commented Dec 12, 2021

Hi! I am running automated testing of diod and I would like a mechanism to make diod exit gracefully once all clients have signaled unmount (via clunk) of all attached file systems. Is this possible? If so, how? If not, how hard would it be to add this?

@Rudd-O
Copy link
Author

Rudd-O commented Dec 12, 2021

I looked at the code and I can't find for the life of me on which data structures diod tracks what is mounted where.

An equivalent ask would be to ensure that some external program is called, or some log record is written, when a file system is attached or detached by a client. This would allow me to track what diod is doing and exit it cleanly when done.

@garlick
Copy link
Member

garlick commented Dec 12, 2021

Haven't done much with diod internals in a while, so I don't have a ready answer off the top of my head.

I think the data structure you are looking for is struct Npconn (in libnpfs).

The server can log each 9P message if you run it with -d 1 -L filename.

One way to get a diod process to run for the lifetime of one mount is to pass it a file descriptor representing one client instead of telling it to listen for connections. Use the --rfdno / --wfdno diod options. For example see tests/kern/runtest and tests/kern/kconjoin.c.

@Rudd-O
Copy link
Author

Rudd-O commented Dec 12, 2021

Thanks for your kind answer! I tracked down the issue and my client process was not closing its FDs, therefore remaining open, and keeping diod alive. You are awesome.

@Rudd-O Rudd-O closed this as completed Dec 12, 2021
@Rudd-O
Copy link
Author

Rudd-O commented Dec 12, 2021

(This would still be a nice feature request, if you'd like to reopen it.)

@garlick
Copy link
Member

garlick commented Dec 12, 2021

Glad you sorted it!

May I ask what the goal of your testing is and whether your work is open source? My intention is to redo the diod CI test suite at some point (#61, #26, etc) so maybe your work will be useful at that time?

@Rudd-O
Copy link
Author

Rudd-O commented Dec 13, 2021

My work is definitely open source, and here it is: https://github.com/Rudd-O/qubes-shared-folders . I am using diod as a transport between qubes, because none of the other alternatives fulfill the requirements of:

  1. zero configuration
  2. tiny codebase
  3. easily remotable
  4. easily automatable

Thanks for such an amazing project!

@garlick
Copy link
Member

garlick commented Dec 13, 2021

Looks quite neat! Thanks for that.

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