aboutsummaryrefslogtreecommitdiffstats
path: root/lib/helper.c
AgeCommit message (Collapse)AuthorLines
2016-06-20libfuse/fuse_daemonize: wait until daemon child process is ready (#55)Hendrik Brueckner-0/+14
Mounting a FUSE file system remotely using SSH in combination with pseudo-terminal allocation (-t), results in "Transport endpoint is not connected" errors when trying to access the file system contents. For example: # ssh -t root@localhost "cmsfs-fuse /dev/disk/by-path/ccw-0.0.0190 /CMSFS" Connection to localhost closed. # ls /CMSFS ls: cannot access '/CMSFS': Transport endpoint is not connected The cmsfs-fuse main program (which can also be any other FUSE file system) calls into the fuse_main() libfuse library function. The fuse_main() function later calls fuse_daemonize() to fork the daemon process to handle the FUSE file system I/O. The fuse_daemonize() function calls fork() as usual. The child proceeds with setsid() and then redirecting its file descriptors to /dev/null etc. The parent process, simply exits. The child's functions and the parent's exit creates a subtle race. This is seen with an SSH connection. The SSH command above calls cmsfs-fuse on an allocated pseudo-terminal device (-t option). If the parent exits, SSH receives the command completion and closes the connection, that means, it closes the master side of the pseudo-terminal. This causes a HUP signal being sent to the process group on the pseudo-terminal. At this point in time, the child might not have completed the setsid() call and, hence, becomes terminated. Note that fuse daemon sets up its signal handlers after fuse_daemonize() has completed. Even if the child has the chance to disassociate from its parent process group to become it's own process group with setsid(), the child still has the pseudo-terminal opened as stdin, stdout, and stderr. So the pseudo-terminal still behave as controlling terminal and might cause a SIGHUP at closing the the master side. To solve the problem, the parent has to wait until the child (the fuse daemon process) has completed its processing, that means, has become its own process group with setsid() and closed any file descriptors pointing to the pseudo-terminal. Closes: #27 Reported-by: Ofer Baruch <oferba@il.ibm.com> Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
2015-09-29Merge branch 'clone_fd'Miklos Szeredi-2/+1
2015-08-12Canonicalised whitespace and added ChangeLog entryChristopher Harrison-1/+1
2015-07-30Added fuse_pkgversion functionChristopher Harrison-0/+4
Returns the full PACKAGE_VERSION string, per autoconf
2015-05-18libfuse: refcount fuse_chan objectsMiklos Szeredi-2/+1
New functions: fuse_chan_get(), fuse_chan_put(). Removed function: fuse_chan_destroy().
2013-07-26Print help on stdout instead of stderrMiklos Szeredi-16/+12
2013-06-21libfuse: remove session and chan abstractionsMiklos Szeredi-1/+1
There's actually just one type of channel and session, so we don't need the generic callback functions.
2013-06-21libfuse: replace fuse_session_next_chanMiklos Szeredi-1/+1
Replace fuse_session_next_chan() with fuse_session_chan(), as multiple channels per session were never actually supported and probably never will.
2013-06-20libfuse: fix multiple close of device fdMiklos Szeredi-4/+6
- fuse_kern_unmount closes handle (e.g. 19) - a thread in my process opens a file - the OS assigns newly freed handle (i.e. 19) - fuse_kern_chan_destroy closes the same handle (i.e. 19) - a thread in my process opens another file - the OS assigns newly freed handle (i.e. 19) - * MAYHEM * Reported by Dan Greenfield
2013-02-22remove real fuse_main() symbolMiklos Szeredi-8/+0
2013-02-19fuse_daemonize(): chdir to "/" even if not running in the backgroundMiklos Szeredi-0/+2
for consistency. Reported by Vladimir Rutsky
2013-02-08libfuse: remove deprecated fuse_setup(), fuse_teardown()Miklos Szeredi-2/+2
2012-07-19Remove compat functionsMiklos Szeredi-141/+16
2012-07-19Remove old symbol versionsMiklos Szeredi-11/+0
2011-09-23Replace daemon() function with fork()Anatol Pomozov-5/+29
daemon() is a BSD-ism. Although it is available on many platforms it is not a standard function. Some platforms (e.g. MacOSX) deprecated it. It is safer just to use fork() function that is a part of POSIX.
2011-03-30Fix a potential null pointer dereference issueLaszlo Papp-1/+2
2010-08-27Add NetBSD supportMiklos Szeredi-2/+2
The bulk of it is just about adding ifdef __NetBSD__ where there is already an ifdef __FreeBSD__ Add a arch=netbsd to deal with NetBSD specifics. I suggests that arch=bsd could be renamed to arch=freebsd NetBSD specific linking with -lperfuse NetBSD patches to lib/mount.c. It turned to be less itrusive to patch mount;c than mount_bsd.c. I suggest mount_bsd.c could be renamed to mount_freebsd.c Patch from Emmanuel Dreyfus
2009-06-18CUSE patches from Tejun HeoMiklos Szeredi-8/+8
2008-06-10Fix missing <sys/param.h> include for PATH_MAXMiklos Szeredi-0/+1
2008-02-08Add support for atomic open(O_TRUNC)Miklos Szeredi-22/+22
2007-12-12change indentingMiklos Szeredi-281/+287
2007-12-12Disable old symbol versions if __UCLIBC__ is definedMiklos Szeredi-9/+10
2007-10-16Clarify licence version to be "LGPLv2" for the libraryMiklos Szeredi-1/+1
2007-08-08fixesMiklos Szeredi-1/+13
2007-06-20Add fs subtype support to libfuse and fusermountMiklos Szeredi-11/+18
2007-04-25update copyright datesMiklos Szeredi-1/+1
2007-04-25*** empty log message ***Miklos Szeredi-7/+0
2006-12-04build fixesMiklos Szeredi-0/+1
2006-11-11fixesMiklos Szeredi-4/+4
2006-06-06fixMiklos Szeredi-3/+9
2006-06-03fix emergency unmount in helper.cCsaba Henk-1/+1
2006-03-17fixMiklos Szeredi-25/+88
2006-03-01pass device file descriptor to fuse_unmountCsaba Henk-4/+2
2006-01-20fixMiklos Szeredi-8/+30
2006-01-07fixMiklos Szeredi-39/+43
2006-01-07fixMiklos Szeredi-56/+50
2006-01-06fixMiklos Szeredi-188/+112
2006-01-06fixMiklos Szeredi-0/+7
2005-12-16fixMiklos Szeredi-4/+3
2005-12-14fixMiklos Szeredi-1/+5
2005-12-10fixMiklos Szeredi-1/+4
2005-12-09added option parsingMiklos Szeredi-186/+134
2005-11-17fixMiklos Szeredi-27/+32
2005-11-16merge FreeBSD stuffMiklos Szeredi-1/+1
2005-11-11fixMiklos Szeredi-0/+19
2005-11-10fixMiklos Szeredi-6/+2
2005-11-08fixMiklos Szeredi-1/+0
2005-10-11spelling fixMiklos Szeredi-1/+1
2005-08-15fixMiklos Szeredi-5/+1
2005-08-03fixMiklos Szeredi-9/+10