From b1b0c4b6f58d278360243705cc1e67522ef23423 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Wed, 28 Apr 2010 08:59:12 +0000 Subject: * Set FD_CLOEXEC on fuse device. This prevents deadlocks that happen in some circumstances (bugzilla.kernel.org #12864). --- ChangeLog | 10 ++++++++-- configure.ac | 2 +- sshfs.1 | 5 ++++- sshfs.c | 18 ++++++++++++------ 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bbaad6..3495ac0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -2008-07-15 Miklos Szeredi +2010-03-16 Miklos Szeredi + + * Set FD_CLOEXEC on fuse device. This prevents deadlocks that + happen in some circumstances (bugzilla.kernel.org #12864). + Reported by Tim Connors + +2009-07-15 Miklos Szeredi * Check mountpoint and fuse options before starting an ssh session (debian bug #535333). This is only supported if compiled @@ -10,7 +16,7 @@ * Allow mounting a single non-directory from the server -2008-07-15 Sebastian Dransfeld +2009-07-15 Sebastian Dransfeld * Add option 'delay_connect': This will always create the sshfs mount, even if the connection to the server can't be established. diff --git a/configure.ac b/configure.ac index ac69a38..1cf48b3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(sshfs-fuse, 2.2) +AC_INIT(sshfs-fuse, 2.3) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) diff --git a/sshfs.1 b/sshfs.1 index de6be51..d103ad3 100644 --- a/sshfs.1 +++ b/sshfs.1 @@ -18,6 +18,9 @@ Userspace) kernel module. The practical effect of this is that the end user can seamlessly interact with remote files being securely served over SSH just as if they were local files on his/her computer. On the remote computer the SFTP subsystem of SSH is used. +.PP +If \fIhost\fP is a numeric IPv6 address, it needs to be enclosed in +square brackets. .SH OPTIONS .SS "general options:" .TP @@ -241,7 +244,7 @@ new encoding of the file names (default: ISO-8859-2) .PD .SH "AUTHORS" .LP -SSHFS has been written by Miklos Seredi . +SSHFS has been written by Miklos Szeredi . .LP This man page was written by Bartosz Fenski for the Debian GNU/Linux distribution (but it may be used by others). diff --git a/sshfs.c b/sshfs.c index d5cc0e7..61f2b92 100644 --- a/sshfs.c +++ b/sshfs.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -3341,6 +3342,10 @@ int main(int argc, char *argv[]) if (!ch) exit(1); + res = fcntl(fuse_chan_fd(ch), F_SETFD, FD_CLOEXEC); + if (res == -1) + perror("WARNING: failed to set FD_CLOESEC on fuse device"); + fuse = fuse_new(ch, &args, cache_init(&sshfs_oper), sizeof(struct fuse_operations), NULL); if (fuse == NULL) { @@ -3348,19 +3353,20 @@ int main(int argc, char *argv[]) exit(1); } - res = fuse_daemonize(foreground); - if (res != -1) - res = fuse_set_signal_handlers(fuse_get_session(fuse)); - + res = ssh_connect(); if (res == -1) { fuse_unmount(mountpoint, ch); fuse_destroy(fuse); exit(1); } - res = ssh_connect(); + res = fuse_daemonize(foreground); + if (res != -1) + res = fuse_set_signal_handlers(fuse_get_session(fuse)); + if (res == -1) { - fuse_teardown(fuse, mountpoint); + fuse_unmount(mountpoint, ch); + fuse_destroy(fuse); exit(1); } -- cgit v1.2.3