From 08d3bcb2bfe9a72cd4737751d9183fa741329cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Wed, 4 May 2016 10:15:35 +0200 Subject: [PATCH] Ported patches to libfuse from the OpenIndiana variant A few patches had been found useful to the OpenIndiana variant of libfuse (2.7.6). Port them to libfuse-lite and restrict them to Solaris/OpenIndiana. --- libfuse-lite/fuse.c | 11 ++++++++--- libfuse-lite/mount.c | 7 +++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/libfuse-lite/fuse.c b/libfuse-lite/fuse.c index 4c6c7133..903a05f7 100644 --- a/libfuse-lite/fuse.c +++ b/libfuse-lite/fuse.c @@ -1281,8 +1281,15 @@ static void reply_entry(fuse_req_t req, const struct fuse_entry_param *e, { if (!err) { struct fuse *f = req_fuse(req); +#ifdef __SOLARIS__ + /* Skip forget for negative result */ + if ((fuse_reply_entry(req, e) == -ENOENT) + && (e->ino != 0)) + forget_node(f, e->ino, 1); +#else /* __SOLARIS__ */ if (fuse_reply_entry(req, e) == -ENOENT) forget_node(f, e->ino, 1); +#endif } else reply_err(req, err); } @@ -2081,9 +2088,7 @@ static void fuse_lib_opendir(fuse_req_t req, fuse_ino_t ino, } } else { reply_err(req, err); -#ifndef __SOLARIS__ pthread_mutex_destroy(&dh->lock); -#endif /* ! __SOLARIS__ */ free(dh); } free(path); @@ -2901,7 +2906,7 @@ static void fuse_lib_help(void) " -o direct_io use direct I/O\n" " -o kernel_cache cache files in kernel\n" #ifdef __SOLARIS__ -" -o [no]auto_cache enable caching based on modification times\n" +" -o [no]auto_cache enable caching based on modification times (off)\n" #endif /* __SOLARIS__ */ " -o umask=M set file permissions (octal)\n" " -o uid=N set file owner\n" diff --git a/libfuse-lite/mount.c b/libfuse-lite/mount.c index 263c20a6..64adee7d 100644 --- a/libfuse-lite/mount.c +++ b/libfuse-lite/mount.c @@ -380,10 +380,13 @@ void fuse_kern_unmount(const char *mountpoint, int fd) then the filesystem is already unmounted */ if (res == 1 && (pfd.revents & POLLERR)) return; + /* + * Need to close file descriptor, otherwise synchronous umount + * would recurse into filesystem, and deadlock. + */ + close(fd); } #ifndef __SOLARIS__ - close(fd); - fusermount(1, 0, 1, "", mountpoint); #else /* __SOLARIS__ */ if (geteuid() == 0) {