|
From: Remy B. <rem...@po...> - 2006-05-31 19:43:02
|
Hello everyone, I have been playing with FUSE and sshfs for a while, and I would like to use it to replace my current NFS setup. There is one feature that I am missing, namely automatic unmounting on inactivity. I have been looking at encfs, which provides exactly this feature, and wanted to port it to sshfs. Then I thought, this could be a feature of the FUSE lib, and could probably be implemented more elegantly there. The approach used in encfs is to spawn a separate thread that monitors activity and unmounts the fs if there has been no activity for the specified timeout *and* there are not open files. To monitor activity, a timestamp is updated for every operation, and the thread checks the age of the last update. Looking at the FUSE lib, the most sensible place I found to monitor activity is in fuse_ll_process() (in fuse_lowlever.c), just before dispatching the operation. I could update a timestamp there. However, the point where I am stuck now is: how do I know if there are files open on the fs? encfs keeps track of open files in a list, but I am not sure that this can be done reliably in the FUSE lib. Hence my questions: - Does it make sense to implement this feature in the FUSE lib, or should this be done in each individual fs? - Is there a reliable way to know if there are any files open *from within the FUSE lib*? I would be happy to hack this together myself and provide a patch, but at this point I need some guidance from FUSE insiders. Thanks and best regards. -- Remy Blank Remove underscore and suffix in reply address for a timely response. |