Commit Graph

1775 Commits

Author SHA1 Message Date
Misono Tomohiro
1caba629ff passthrough_ll: Use cache_readdir for directory open (#492)
Upstreamed from:
  https://www.redhat.com/archives/virtio-fs/2020-January/msg00106.html

Since keep_cache(FOPEN_KEEP_CACHE) has no effect for directory as
described in fuse_common.h, use cache_readdir(FOPEN_CACHE_DIR) for
diretory open when cache=always mode.

Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
2020-01-24 15:53:32 +00:00
Dr. David Alan Gilbert
aa1185e153 passthrough_ll: pass correct errno to fuse_reply_err()
fuse_reply_err() expects the error code, not its negative.

Upstreamed from https://www.redhat.com/archives/virtio-fs/2020-January/msg00000.html. Original commit message:

lo_copy_file_range() passes -errno to fuse_reply_err() and then fuse_reply_err()
changes it to errno again, so that subsequent fuse_send_reply_iov_nofree() catches
the wrong errno.(i.e. reports "fuse: bad error value: ...").

Make fuse_send_reply_iov_nofree() accept the correct -errno by passing errno
directly in lo_copy_file_range().

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@linux.alibaba.com>

Co-authored-by: Xiao Yang <ice_yangxiao@163.com>
2020-01-06 20:32:51 +00:00
Nikolaus Rath
6f81ca264a Fixed up ChangeLog.rst
Last two changes were not part of the released version.
2020-01-02 11:08:33 +00:00
Bill Zissimopoulos
50fe9f7c81 Fixed memory leak in fuse_session_new() 2020-01-02 11:08:03 +00:00
Bill Zissimopoulos
e3dcc2d550 Fixed an issue with the linker version script. (#483)
Fixes #467.
2020-01-02 11:06:18 +00:00
Changli Gao
7b993f7450 Style: Fix an indention in comments (#480) 2019-12-31 10:01:26 +00:00
Nikolaus Rath
2cfce39909 Bump FUSE_MINOR_VERSION
This was forgotten over several releases.
2019-12-31 09:59:43 +00:00
Bill Zissimopoulos
abdd45f83c Make ioctl prototype conditional on FUSE_USE_VERSION. (#482)
Define FUSE_USE_VERSION < 35 to get old ioctl prototype
with int commands; define FUSE_USE_VERSION >= 35 to get
new ioctl prototype with unsigned int commands.

Fixes #463.
2019-12-31 09:58:57 +00:00
Nikolaus Rath
b5060b0642 Released 3.9.0 2019-12-14 10:39:13 +00:00
Dr. David Alan Gilbert
014960bc77 Kill off some proto_major < 6 checks (#476)
fuse_init already refuses to start if we're on major < 7 ,
so we can kill off checks for old major versions.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2019-11-29 09:14:28 +00:00
Albert Chen
ada08d50a6 Added support for FUSE_EXPLICIT_INVAL_DATA to enable (#474) 2019-11-27 09:36:30 +00:00
Tomasz Kulasek
4520a97286 fix memleak in cuse_lowlevel_setup (#472)
Local variable args is not freed on cuse_lowlevel_setup success.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
2019-11-20 11:43:52 +00:00
Nikolaus Rath
bb52fccb59 Invoke cleanup() with right arguments.
This currently causes hangs if the test fails, cf issue #459.
2019-11-20 11:38:33 +00:00
Nikolaus Rath
4afe7ca1e8 Released 3.8.0 2019-11-03 09:53:39 +00:00
Yuri Per
d735af94fa Implement lseek operation (#457) 2019-11-03 09:44:31 +00:00
Alan Somers
b9c584370a Use the -o intr mount option on FreeBSD (#462)
FUSE file systems normally indicate their interruptibility by returning
ENOSYS to the first FUSE_INTERRUPT operation.  But that causes two
problems for file systems that aren't interruptible:

1) A process may block on a signal, even if another thread could've
handled the signal.  The kernel must know whether the FUSE thread is
interruptible before deciding which thread should receive a signal.

2) The protocol allows a FUSE daemon to simply ignore FUSE_INTERRUPT
operations.  From the kernel's point of view, that is indistinguishable
from a FUSE_INTERRUPT operation arriving after the original operation
had already completed.  Thus, the kernel can't interpret an ignored
FUSE_INTERRUPT as an indication that the daemon is non-interruptible.

With the -o nointr mount option, no FUSE_INTERRUPT operations will ever
be sent.  Most FUSE file systems should require no modifications to take
advantage of this mount option.
2019-11-03 09:44:12 +00:00
Stefan Hajnoczi
fa0981fe80 passthrough_ll: drop lo_dirp->fd field (#464)
fdopendir(3) takes ownership of the file descriptor.  The presence of
the lo_dirp->fd field could lead to someone incorrectly adding a
close(d->fd) cleanup call in the future.

Do not store the file descriptor in struct lo_dirp since it is unused.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2019-11-03 09:43:43 +00:00
Emily Herbert
74596e2929 Update README.md (#465) 2019-10-24 14:46:19 -07:00
Nikolaus Rath
62c1941cc8 Released 3.7.0 2019-09-27 20:01:33 +01:00
tenzap
57bf44355f Whitelist UFSD (#451) 2019-09-15 08:56:56 -07:00
Stefan Hajnoczi
a0d713619d passthrough_ll: use fuse_log() instead of err()/errx()
Send everything through fuse_log() instead of writing directly to
stderr.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-09-10 14:25:15 +01:00
Stefan Hajnoczi
0889da0a87 passthrough_ll: use fuse_log()
Make use of fuse_log() instead of printing directly to stderr.  This
demonstrates unified logging and also caught the fact that I forgot to
add fuse_log APIs to lib/fuse_versionscript.  So it's basically a test
case :).

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-09-10 14:25:15 +01:00
Stefan Hajnoczi
d368dad2c8 log: move fuse_log() to the public header file
Applications may wish to call fuse_log() for unified logging.  This way
they don't need to define their own wrappers to invoke the log message
handler function installed by fuse_set_log_func().

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-09-10 14:25:15 +01:00
Dr. David Alan Gilbert
7c1e09dbc2 passthrough_ll: fix fallocate variant ifdefs (#449)
If fallocate isn't available we incorrectly check for the value of
HAVE_POSIX_FALLOCATE rather than it being defined.
We also fail to initialise 'err' in the case where neither are defined.

Fixes: 5fc562c90d ("Add fallocate and use it instead of ...")

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2019-09-09 10:14:02 +01:00
Stefan Hajnoczi
317181e8ea Introduce callback for logging
Introduce an API for custom log handler functions.  This allows libfuse
applications to send messages to syslog(3) or other logging systems.
See include/fuse_log.h for details.

Convert libfuse from fprintf(stderr, ...) to log_fuse(level, ...).  Most
messages are error messages with FUSE_LOG_ERR log level.  There are also
some debug messages which now use the FUSE_LOG_DEBUG log level.

Note that lib/mount_util.c is used by both libfuse and fusermount3.
Since fusermount3 does not link against libfuse, we cannot call
fuse_log() from lib/mount_util.c.  This file will continue to use
fprintf(stderr, ...) until someone figures out how to split it up.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-09-04 15:59:18 +01:00
Stefan Hajnoczi
f39c71dcf9 Avoid gcc 9.1 strncpy(3) warnings (#447)
Recent GCC releases have warnings related to common strncpy(3) bugs.
These warnings can be avoided by explicitly NUL-terminating the buffer
or using memcpy(3) when the intention is to copy just the characters
without the NUL terminator.

This commit fixes the following warnings:

  [1/27] Compiling C object 'test/9f86d08@@test_syscalls@exe/test_syscalls.c.o'.
  In function ‘test_socket’,
      inlined from ‘main’ at ../test/test_syscalls.c:1899:9:
  ../test/test_syscalls.c:1760:2: warning: ‘strncpy’ output may be truncated copying 108 bytes from a string of length 1023 [-Wstringop-truncation]
   1760 |  strncpy(su.sun_path, testsock, sizeof(su.sun_path));
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  [2/27] Compiling C object 'lib/76b5a35@@fuse3@sha/fuse.c.o'.
  ../lib/fuse.c: In function ‘add_name’:
  ../lib/fuse.c:968:2: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
    968 |  strncpy(s, name, len);
        |  ^~~~~~~~~~~~~~~~~~~~~
  ../lib/fuse.c:944:15: note: length computed here
    944 |  size_t len = strlen(name);
        |               ^~~~~~~~~~~~
  [3/27] Compiling C object 'lib/76b5a35@@fuse3@sha/fuse_lowlevel.c.o'.
  ../lib/fuse_lowlevel.c: In function ‘fuse_add_direntry’:
  ../lib/fuse_lowlevel.c:288:2: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
    288 |  strncpy(dirent->name, name, namelen);
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../lib/fuse_lowlevel.c:276:12: note: length computed here
    276 |  namelen = strlen(name);
        |            ^~~~~~~~~~~~
  ../lib/fuse_lowlevel.c: In function ‘fuse_add_direntry_plus’:
  ../lib/fuse_lowlevel.c:381:2: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
    381 |  strncpy(dirent->name, name, namelen);
        |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../lib/fuse_lowlevel.c:366:12: note: length computed here
    366 |  namelen = strlen(name);
        |            ^~~~~~~~~~~~

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-08-29 20:28:29 +01:00
Nikolaus Rath
ab26ad4dfa Shorten comment. 2019-08-23 20:58:54 +01:00
Nikolaus Rath
3c31bead28 Improve description of READDIRPLUS_AUTO. 2019-08-23 20:58:23 +01:00
AsumFace
1d8e8ca94a Clarify bitfield padding issue (#445)
* Clarify bitfield padding issue

* Add a more elaborate note to fuse_file_info
2019-08-23 20:58:06 +01:00
Giuseppe Scrivano
f0e08cc700 fuse-lowlevel: set pipe size to max (#438)
on failure to set the pipe size, set it to the maximum allowed by the
kernel.

If the first request required more than the maximum allowed, the
can_grow flag would be reset thus preventing any further resize.

Grow the pipe to the maximum allowed to increase the likelihood of
using splice for successive requests instead of falling back to
read/write.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-07-23 12:52:16 -07:00
Kirill Smelkov
249942f641 Sync fuse_kernel.h with Linux 5.2 (#433) 2019-07-09 13:54:09 -07:00
Nikolaus Rath
82e10e576e Released 3.6.2 2019-07-09 05:36:50 -07:00
Nikolaus Rath
65075085b5 Do not run passthrough test when caching is active.
Readdir caching means that direct modifications to the source
directory will not be seen immediately, so the test becomes flaky.

Fixes: #416.
2019-07-09 05:29:49 -07:00
Nikolaus Rath
a0b9cb9d76 Install init script in /etc/ instead of $sysconfdir
sysconfdir defaults to /usr/local/etc which is almost always the wrong
choice.

Fixes: #427
2019-07-09 05:15:09 -07:00
Nikolaus Rath
4cfbc27d4e
test_cuse: fix runtime error
We are no longer using the capfd mechanism.
2019-07-05 11:03:31 +01:00
Nikolaus Rath
1343f59c27 Fix output checking in test cases
py.test's capture plugin does not work reliably when used by
other fixtures. Therefore, implement our own version.
2019-07-04 21:20:41 +01:00
DrDaveD
be8db96603 Add build option to skip steps requiring root permissions 2019-07-04 09:02:30 +01:00
Michael Forney
f0c52798b7 Fix build with IGNORE_MTAB (#425)
chdir_to_parent and check_is_mount are used by should_auto_mount, added
in fuse-3.3.0, regardless of whether IGNORE_MTAB is defined.
2019-06-15 11:16:45 +01:00
Nikolaus Rath
38c947503d Released 3.6.1 2019-06-13 15:25:07 +01:00
Nikolaus Rath
be1c469530 Released 3.6.0 2019-06-13 13:01:10 +01:00
scosu
027d0d17c8 fuse_lowlevel: Add max_pages support (#384)
Starting with kernel version 4.20 fuse supports a new property
'max_pages' which is the maximum number of pages that can be used per
request. This can be set via an argument during initialization.
This new property allows writes to be larger than 128k.

This patch sets the property if the matching capability is set
(FUSE_MAX_PAGES). It will also set max_write to 1MiB. Filesystems have
the possibility to decrease this size by setting max_write to a smaller
size. The max_pages and bufsize fields are adjusted accordingly.

Cc: Constantine Shulyupin <const@MakeLinux.com>
Signed-off-by: Markus Pargmann <scosu@quobyte.com>
2019-06-13 12:59:10 +01:00
Michael Forney
63c11456d4 Avoid pointer arithmetic with void *
The pointer operand to the binary `+` operator must be to a complete
object type. Since we are working with byte sizes, use `char *` instead.
2019-06-06 13:31:41 +01:00
Michael Forney
a6024d4bf8 Don't return expression in function returning void
This is a constraint violation in ISO C[0].

[0] http://port70.net/~nsz/c/c11/n1570.html#6.8.6.4p1
2019-06-06 13:31:41 +01:00
Michael Forney
a9752e5f74 Don't omit second operand to ? operator
This is a GNU C extension.
2019-06-06 13:31:41 +01:00
Alan Somers
f6691d0a20 Remove incorrect comment about fuse_entry_param.generation (#420)
A comment said that fuse_entry_param.generation must be non-zero.
However, I can't find anything in the kernel that requires that, and
real-world file systems don't seem to follow that advice, either.
2019-05-24 08:54:42 +01:00
Alan Somers
1f842c996e passthrough: fix unix-domain sockets on FreeBSD (#413)
FreeBSD doesn't allow creating sockets using mknod(2). Instead, one has to use socket(2)
and bind(2).  Add appropriate logic to the examples and add a test case.
2019-05-15 21:35:57 +01:00
Nikolaus Rath
7a5e1a9a9a Fix includes of non-system headers.
Fixes: #415.
2019-05-12 11:00:15 +01:00
Nikolaus Rath
055f272517 Added new example filesystem
passthrough_hp puts emphasis and performance and correctness, rather
than simplicity.
2019-05-09 14:16:37 -05:00
DrDaveD
625ed81b82 add defines for missing SECBITs on older kernels (#409) 2019-05-05 14:15:13 -04:00
Nikolaus Rath
0c59e2b509 Fixed type of ioctl command parameter. 2019-05-05 14:15:13 -04:00