FUSE: a userspace filesystem framework. consists of a kernel module (fuse.ko), a userspace library (libfuse.*) a mount utility (fusermount) Feature: allows secure, non-privileged mounts. opens up new possibilities for the use of filesystems: example: a secure network filesystem using the sftp protocol Mount types: fuse: the usual way to mount a FUSE filesystem. first arg of mount system call may contain an arbitrary string which is not interpreted by the kernel. fuseblk: filesystem is block device based. first arg of the mount system call is the name of the device. Permissions: default: does not check file access permissions filesystem can implement its access policy or use underlying file mechanism option: enable permission checking, restricting access based on file mode. option: overrides security measure restricting file access to the mounting user. Operation: 1. user mode program calls fuse_main() (in lib/helper.c) fuse_main() parses the arguments passed to the user mode program fuse_main() then calls fuse_mount() (in lib/mount.c). 2. fuse_mount() creates a UNIX domain socket pair, fuse_mount() then forks and executes fusermount (in util/fusermount.c) passing it one end of the socket 3. fusermount() makes sure that the fuse module is loaded. fusermount() then opens /dev/fuse and sends the file handle back to fuse_mount(). 4. fuse_mount() returns the filehandle for /dev/fuse to fuse_main(). 5. fuse_main() calls fuse_new() (in lib/fuse.c) to allocate a 'struct fuse' object that stores and maintains a cached image of the filesystem data. 6. fuse_main() calls either fuse_loop() (in lib/fuse.c) or fuse_loop_mt() (in lib/fuse_mt.c) which start to read the filesystem system calls from /dev/fuse, call the usermode functions stored in a 'struct fuse_operations' object before calling fuse_main(). The results of those calls are then written back to the /dev/fuse file where they can be forwarded back to the system calls. Interrupts: If a process issuing a FUSE filesystem request is interrupted, the following happens: 1) if the request is not yet sent to userspace AND the signal is fatal, the request is dequeued and returns immediately. 2) if the request is not yet sent to userspace AND the signal is not fatal, an 'interrupted' flag is set for the request. When the request has been successfully transferred to userspace and this flag is set, an INTERRUPT request is queued. 3) if the request is already sent to userspace, then an INTERRUPT request is queued. INTERRUPT requests take precedence over other requests, so the userspace filesystem receives queued INTERRUPTs before any others. The userspace filesystem may ignore the INTERRUPT requests entirely, or may honor them by sending a reply to the _original_ request, with the error set to EINTR (the call did not succeed because it was interrupted) It is also possible that there is a race between processing the original request and it's INTERRUPT request. There are two possibilities: 1) The INTERRUPT request is processed before the original request is processed 2) The INTERRUPT request is processed after the original request has been answered If the filesystem cannot find the original request, it should wait for some timeout and/or a number of new requests to arrive, after which it should reply to the INTERRUPT request with an EAGAIN error. In case 1) the INTERRUPT request will be requeued. In case 2) the INTERRUPT reply will be ignored.