Thanks for giving this a look @rmustacc. 

> Doesn't it strike others as odd when you have a userland program use a 
> kmutex_t, but then also referring to the userland bits like a normal 
> USYNC_THREAD, which is definitely a userland mutex thing.

Thanks for catching this; this is wrong. Rather than using `USYNC_THREAD`, I 
think I should be using `MUTEX_DEFAULT`.

> It also makes it much less clear which mutex_enter/mutex_exit are we using.

AFAIK, there's no `mutex_enter`/`mutex_exit` provided by `libc`. Instead, 
there's `mutex_lock`/`mutex_unlock`. With that said, there is a `mutex_init` 
provided by `libc`, and then a `kmutex_init` provided by `libfakekernel`.

And then we use a macro to allow consumers use `mutex_init` when it's actually 
using `kmutex_init` (via `libfakekernel/common/sys/mutex.h`:
```
/*
 * We're simulating the kernel mutex API here, and the
 * user-level has a different signature, so rename.
 */
#define mutex_init      kmutex_init
#define mutex_destroy   kmutex_destroy
```

> Why are we using it for a normal user land program?

Since this change is using `libfakekernel`'s taskq implementation, I thought I 
had to use its mutex implementation as well, due to how it remaps functions 
like `mutex_init` to the `kmutex` variant. I'm not opposed to using the `libc` 
mutex implementation, so long as we can still use the other functionality from 
`libfakekernel` that is required.

Let me know if you think I should try using the `libc` implementation. I think 
I hit some build errors when doing that originally, but I can try again if 
you'd like me to.

> Unrelated to the above confusion, do you have an analysis somewhere about why 
> we're marking specific file systems as requiring to be added to or removed 
> from the mount in progress tables?

@sebroy can you comment on this?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/536#issuecomment-363881668
------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/T22334a01fda83bfd-M1c903ae69b2692730b854f42
Powered by Topicbox: https://topicbox.com

Reply via email to