Feature request: allow app developer to determine if UnifyFS filesystem is mounted
System information
Affects all systems.
Describe the problem you're observing
UnifyFS can be compiled with or without support for automatically mounting the filesystem during the MPI_Init() call. However, once UnifyFS is built, there is no way to know if this feature is present. As such, an application developer who didn't personally build UnifyFS doesn't know whether or not to call unifyfs_mount().
Right now, unifyfs_mount() simply returns a generic failure code if it's called when the filesystem has already been mounted. A possible solution to this issue would be to change unifyfs_mount() to return a specific error code indicating that the filesystem is already mounted. Application developers could then call unifyfs_mount() and know that if they receive that error code, they don't need to abort their programs.
Just one clarification - with recent change to build a separate library for the auto-MPI-mount, the user should know which behavior to expect because they have to choose to link with either the regular libunifyfs or the libunifyfs_mpi library.
Regardless, we still need to address the core issue. I can imagine a couple different behaviors.
- if the mountpoint is the same as used in the auto-MPI-mount, just return success (zero) from
unifyfs_mount() - define a specific error code that means "already mounted" and return that
I hadn't considered the situation where the call to unifyfs_mount() specified a different mount point than the auto-mount. Perhaps we need a separate function that will return the name of the mountpoint? (Between defaults, config files and environment variables, it's easy to get confused about where the filesystem is supposed to be mounted.)
Also, if unifyfs_mount() were to just return success when called with an already mounted mount point, what happens when it's time to unmount the filesystem? Presumably unifyfs_unmount() will be called explicitly by the application as well as from within the MPI_Finalize() call. Should unifyfs_unmount() just return success if the filesystem has already been unmounted?
Yeah, I think if we allow the second unifyfs_mount() to succeed, then the second unifyfs_unmount()should also succeed. It might be coded that way already.