Commit Graph

668 Commits

Author SHA1 Message Date
Eric Wong 6bf2e6f07c libfuse: implement readdirplus for high-level API
Reuse the old "readdir" callback, but add a flags argument, that has
FUSE_READDIR_PLUS in case this is a "plus" version.  Filesystems can safely
ignore this flag, but if they want they can add optimizations based on it:
i.e. only retrieve the full attributes in PLUS mode.

The filler function is also given a flags argument and the filesystem can
set FUSE_FILL_DIR_PLUS if all the attributes in "stat" are valid.
2014-03-05 14:45:44 +01:00
Miklos Szeredi f55e489a9e libfuse: added fuse_lo-plus.c to the examples 2014-02-21 17:52:36 +01:00
Fabrice Bauzac d4e294b799 fuse: use dlsym() instead of relying on ld.so constructor functions 2014-02-04 18:22:23 +01:00
Miklos Szeredi 8bb62a632c libfuse: Add "async_dio" and "writeback_cache" options
Asynchronous direct I/O is supported by linux kernels 3.13 and
later, writeback caching is supported by 3.14 and later.
2014-01-29 14:13:36 +01:00
Miklos Szeredi e6bc904857 Merge remote-tracking branch 'origin/fuse_2_9_bugfix' 2013-08-26 12:11:42 +02:00
Daniel Thau 78bc1108d5 Add missing includes
This allows compiling fuse with musl.
2013-08-26 12:01:17 +02:00
Miklos Szeredi 9ffe64abe1 Print help on stdout instead of stderr 2013-07-26 16:20:28 +02:00
Miklos Szeredi 3c3f03b81f ulockmgr: strip ulockmgr support from this source package
Distribute ulockmgr separately.  It is not needed for the building of
libfuse, only fusexmp_fh.  Check ulockmgr library in ./configure and if not
disable remote-lock suport in fusexmp_fh.
2013-07-25 17:58:48 +02:00
Miklos Szeredi 0cb2db32e7 libfuse: fuse -> fuse3
Allow 2.X and 3.X to coexist.  Includes are now stored under
/usr/include/fuse3 and library is named libfuse3.*.  Invoke pkg-config with
"fuse3" as the first argument to build with version 3 of the library.
2013-07-25 16:54:42 +02:00
Miklos Szeredi e6e7a249c5 libfuse: remove "-D_FILE_OFFSET_BITS=64" from fuse.pc
add AC_SYS_LARGEFILE to your configure.ac instead.
2013-07-24 17:09:26 +02:00
Miklos Szeredi d44bf3a4ac Released 2.9.3 2013-07-01 10:48:51 +02:00
Miklos Szeredi ddfd2d44a6 libfuse: fix multiple close of device fd
- 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-07-01 10:06:37 +02:00
Miklos Szeredi 39065e40e0 libfuse: set FD_CLOEXEC also when receiving device fd from fusermount 2013-06-21 14:03:08 +02:00
Miklos Szeredi af57c73304 libfuse: fix multiple close of device fd
- 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-06-20 11:43:02 +02:00
Miklos Szeredi 4dec04c7ed Merge branch 'fuse_2_9_bugfix' 2013-03-19 17:33:46 +01:00
Miklos Szeredi 44088bc7fb libfuse: fix thread cancel race
Exiting a worker my race with cancelling that same worker.  This caused a
segmenation fault.

Reported and tested by Anatol Pomozov
2013-03-19 17:16:14 +01:00
Richard W.M. Jones d8f3ab77d9 libfuse: don't force -D_FILE_OFFSET_BITS=64 in pkgconfig file.
FUSE_CFLAGS defines -D_FILE_OFFSET_BITS=64.  There are three problems
with this:

(1) A larger program using libfuse might have modules compiled with
and without FUSE_CFLAGS, which, if LFS is not enabled and the platform
is 32 bit, would result in a fatal mix of 32 and 64 bit off_t.  (This
would, of course, be a bug, but I think there is a better way to
detect this -- see below)

(2) Programs may need to be adjusted to support LFS.  It's the
intention of the LFS standard that the _programmer_ enables LFS once
the program has been checked/adjusted.

(3) _FILE_OFFSET_BITS does not need to be defined at all on 64 bit
Linux.  64 bit off_t is the default there.

So I think it's better not to force -D_FILE_OFFSET_BITS=64, and
because of (3) I also think you shouldn't test for it.

However off_t must still be 64 bits, so how to enforce that?  C1X will
define static assertions[1], and these can be used to check the size
of off_t.

Not all compilers support static assertions yet, although several do.
Therefore I have surrounded the static assertion with a conservative
check that the compiler is GCC >= 4.6.  In the long run, this test can
be removed and you can just use 'static_assert'.
2013-02-20 18:31:48 +01:00
Richard W.M. Jones 4a6fb6768a libfuse: use O_CLOEXEC flag when opening /dev/fuse device 2013-02-20 15:59:08 +01:00
Miklos Szeredi 29e1d592d0 libfuse: 64bit fuse_ino_t
Change the type of fuse_ino_t from 'unsigned long' to 'uint64_t'.  This only
changes the size on 32bit architectures.
2013-02-20 15:59:08 +01:00
Miklos Szeredi c52c3256a5 fuse_daemonize(): chdir to "/" even if not running in the background
for consistency.

Reported by Vladimir Rutsky
2013-02-19 14:14:40 +01:00
Miklos Szeredi a38722be2b fuse_opt_parse(): fix memory leak
when storing a newly allocated string for format "%s", free the previous value
stored at that location.

Reported by Marco Schuster
2013-02-19 14:14:00 +01:00
Miklos Szeredi 4496de1971 libfuse: remove deprecated fuse_operations.utime_omit_ok 2013-02-08 08:03:02 +01:00
Miklos Szeredi 276905bf14 libfuse: remove deprecated fuse_operations.utime() 2013-02-08 08:03:02 +01:00
Miklos Szeredi 0e4c55c3fb libfuse: remove deprecated fuse_operations.getdir() 2013-02-08 08:03:02 +01:00
Miklos Szeredi aebc2ebeb1 libfuse: remove deprecated fuse_lowlevel_is_lib_option() 2013-02-08 08:03:02 +01:00
Miklos Szeredi 47a1ef9142 libfuse: remove deprecated fuse_exited() 2013-02-08 08:03:02 +01:00
Miklos Szeredi baef74043c libfuse: remove deprecated fuse_setup(), fuse_teardown() 2013-02-08 08:03:02 +01:00
Miklos Szeredi 88db3e94ef libfuse: remove deprecated fuse_read_cmd(), fuse_process_cmd() 2013-02-08 08:03:02 +01:00
Miklos Szeredi 1d63685572 libfuse: remove deprecated fuse_loop_mt_proc() 2013-02-08 08:03:01 +01:00
Miklos Szeredi 1c317e8773 libfuse: remove deprecated fuse_set_getcontext_func() 2013-02-08 08:03:01 +01:00
Miklos Szeredi afde05b920 libfuse: remove deprecated fuse_invalidate() 2013-02-08 08:03:01 +01:00
Miklos Szeredi 4168937d1e libfuse: remove deprecated fuse_is_lib_option() 2013-02-08 08:03:01 +01:00
Dalvik Khertel c52cafc81c libfuse: pass security context options to kernel
Mount can be used with an "-o context=" option in order to specify a
mountpoint-wide SELinux security context different from the default context
provided by the active SELinux policy.

This is useful in order to enable users to mount multiple sshfs targets under
distinct contexts, which is my main motivation for getting this patch mainlined.
2013-02-08 08:03:01 +01:00
Miklos Szeredi 1bea285a3a libfuse-fix-fs-cleanup
This fixes a segmentation fault if command-line option parsing fails during
initialization.

Reported by Eric Wong
2013-02-07 14:59:28 +01:00
Enke Chen 74f9acbd18 libfuse: add poll_events to fuse_file_info
Make requested poll events available to the filesystem.  If the requested
eventsare not available, then this field is zero.
2013-02-07 14:58:50 +01:00
Feng Shuo f448ac69d1 libfuse: add readdirplus support in fuse_lowlevel_ops
This patch implements readdirplus support in FUSE usersapce. It adds
a new fuse lowlevel operations fuse_lowleve_ops::readdir_plus,
corespoding mount options and helper functions to maintain buffer.

[From: Eric Wong <normalperson@yhbt.net>]

This makes our terminology consistent with NFS and
our kernel module, as well as reducing user/developer
confusion in the command-line.

Note: I'm keeping "fuse_add_direntry_plus" since that is
less standardized in its use than "readdirplus" for now.

Signed-off-by: Feng Shuo <steve.shuo.feng@gmail.com>
2013-02-07 14:58:50 +01:00
Miklos Szeredi 06b1100aca libfuse: add missing INIT flags
Add missing flags that userspace derived from the protocol version number.  This
makes the protocol more flexible.
2013-02-06 17:20:50 +01:00
Eric Wong fd7f25b627 libfuse: set close-on-exec flag on pipe file descriptors
The FUSE library may be used from any number of programs which
may also fork() + execve(), so set the close-on-exec flag to
avoid inadvertant leakage of pipe file descriptors.

While we're at it, attempt to use pipe2() since this is within a
(currently) Linux-only code path and pipe2() offers thread-safety.
2013-02-06 16:30:47 +01:00
Miklos Szeredi eca08beaf5 libfuse: fix fuse_get_context() in non fuse threads
fuse_interrupted(), fuse_get_context(), etc... crashed in non-fuse threads.

Instead return false, NULL or error depending on the function.

Reported by Michael Berlin
2013-02-05 13:36:06 +01:00
Miklos Szeredi d811864556 Merge branch 'fuse_2_9_bugfix' 2013-02-04 18:32:38 +01:00
Anatol Pomozov eb385fbe93 libfuse: rename ./configure.in to ./configure.ac
Next version of automake (1.14) removes support for the deprecated filename

http://lists.gnu.org/archive/html/autotools-announce/2013-01/msg00000.html
2013-02-04 18:30:15 +01:00
Anatol Pomozov 839550d319 libfuse: Use AC_CONFIG_HEADERS instead of AM_CONFIG_HEADER
AM_CONFIG_HEADER has been deprecated for years and autotools 1.13
removes this macros at all.
2013-02-04 18:30:15 +01:00
Miklos Szeredi f80f367815 libfuse: configure: detect new util-linux
Apparently new versions of util-linux umount return with an exit status of 1
even if the "--fake" option is recognised (despite being documented otherwise).
Check this condition and don't complain about util-linux version.
2013-02-04 18:30:14 +01:00
Madan Valluri d7bf78d913 libfuse: fix the 'remember' option
The lru list was not initialized for the "/" path.  This resulted in
remove_node_lru() crashing on LOOKUP-DOTDOT.

Patch by Madan Valluri.
--
 ChangeLog  |    4 ++++
 lib/fuse.c |    4 ++++
 2 files changed, 8 insertions(+)
2013-02-04 18:30:14 +01:00
Ratna_Bolla@dell.com 3a2bd4da6b libfuse: fix crash in unlock_path()
Patch by Ratna Manoj.

queue_element_unlock() should set ->first_locked and ->second_locked to false.

Discovered with 'fs_racer'.  The assert(wnode->treelock == TREELOCK_WRITE) in
unlock_path() was hit within minutes.

Miklos: simplified patch
2013-02-04 18:30:14 +01:00
Miklos Szeredi ad38195a88 Released 2.9.2 2012-10-01 19:56:49 +02:00
Miklos Szeredi 66956b6f7a Fix deadlock in libfuse
Running "svn update" on a fuse filesystem could deadlock because of a bug in the
way the paths are locked.

Reported by Kazuaki Anami
2012-10-01 17:55:55 +02:00
Miklos Szeredi 5568aa7cd5 Fix missing config.h in buffer.c
Due to an oversight, splice will never actually be used for i/o.  Someone forgot
to #include "config.h" in lib/buffer.c (in fact almost no files include that
header).  As a result, even though configure detects splice support and puts
HAVE_SPLICE in config.h, buffer.c is always compiled as if there is no splice
support.

Also add #include "config.h" to fuse.c and fuse_lowlevel.c.  These currently
include it indirectly through fuse_misc.h, but we don't want to depend on that.

Reported by Matthew Gabeler-Lee
2012-08-24 15:18:19 +02:00
Miklos Szeredi 07b4946b5b Merge branch 'fuse_2_9_bugfix' 2012-08-14 14:03:10 +02:00
Miklos Szeredi 1061a0a2d9 Fix "fuse internal error: node NNN not found"
Commit 4dc7e675bb (Don't unhash name in FORGET) broke the forget logic in a
subtle way, resulting in "fuse internal error: node NNN not found" and causing
the filesystem daemon to abort.

Fix by incrementing the node refcount if nlookup goes from zero to one.

Reported by Kyle Lippincott
2012-08-14 11:18:07 +02:00