From f573c35a8f829ac4624f4ef9fbe0d0178a734fa3 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Tue, 24 Jun 2014 15:02:39 -0400 Subject: [PATCH] Fix bad interaction between llfuse and daemonization in arv-mount. Following PEP 3143, daemon.DaemonContext drops all open file descriptors by default. This causes arv-mount to fail, because llfuse.init() opens /dev/fuse, and llfuse.main() uses that file descriptor. We now daemonize before doing real work to prevent this unintentional breakage. This effectively reverts 83c873af. An alternative approach would've been to call DaemonContext with a preserve_files argument. I decided against that because I couldn't find a reliable way to determine which file descriptors llfuse needs. If we really need the daemon to report errors, and debugging with --foreground isn't sufficient, I think we should implement proper logging to a file or syslog. No issue #. --- services/fuse/bin/arv-mount | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/services/fuse/bin/arv-mount b/services/fuse/bin/arv-mount index b4afffab06..db8e852b4c 100755 --- a/services/fuse/bin/arv-mount +++ b/services/fuse/bin/arv-mount @@ -1,11 +1,13 @@ #!/usr/bin/env python -from arvados_fuse import * -import arvados -import subprocess import argparse +import arvados import daemon +import os import signal +import subprocess + +from arvados_fuse import * if __name__ == '__main__': # Handle command line parameters @@ -91,12 +93,9 @@ collections on the server.""") exit(rc) else: - if args.foreground: - # Initialize the fuse connection - llfuse.init(operations, args.mountpoint, opts) - llfuse.main() - else: - # Initialize the fuse connection - llfuse.init(operations, args.mountpoint, opts) - with daemon.DaemonContext(): - llfuse.main() + os.chdir(args.mountpoint) + if not args.foreground: + daemon_ctx = daemon.DaemonContext(working_directory='.') + daemon_ctx.open() + llfuse.init(operations, '.', opts) + llfuse.main() -- 2.39.5