Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Wait for FUSE device to be mounted at startup #12

Closed
chrisd8088 opened this issue Apr 5, 2019 · 0 comments
Closed

Wait for FUSE device to be mounted at startup #12

chrisd8088 opened this issue Apr 5, 2019 · 0 comments
Assignees

Comments

@chrisd8088
Copy link

chrisd8088 commented Apr 5, 2019

In our current trial implementation of GVFS.Platform.Linux/LinuxFileSystemVirtualizer, we don't wait after calling the ProjFS.Linux StartVirtualizationInstance() method for our FUSE mount to actually be ready.

This may result in problems where the GVFS provider code proceeds, expecting the mount to be complete, while the asynchronous libfuse/libprojfs threads are still coordinating with the FUSE kernel module to bring up the mount.

We know from experience with the libprojfs test suite that waiting until the mount point's device ID changes is necessary, so we likely should implement the same logic from wait_mount.c in LinuxFileSystemVirtualizer.TryStart():

  1. Read the current device ID of the Enlistment.WorkingDirectoryRoot (i.e., the src/ directory) using stat(2).
  2. Invoke virtualizationInstance.StartVirtualizationInstance() as is done now.
  3. On successful return, poll at short intervals using stat(2) until the device ID changes.
    If the device ID doesn't change after some reasonable timeout period (e.g., 30 seconds?), execute virtualizationInstance.StopVirtualizationInstance() and return an error.

One implementation note involves the complexity of calling stat(2), which is non-trivial; see the current use in MirrorProvider.Linux/LinuxFileSystemVirtualizer and also in GVFS/GVFS.Platform.Linux/LinuxFileSystem. Before we introduce another clone of this code, we should refactor it down to a common set of __xstat64() and __lxstat64() wrappers, perhaps provided by ProjFS.Linux, which can then be used in both LinuxFileSystem and LinuxFileSystemVirtualizer, and elsewhere as needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants