Age | Commit message (Collapse) | Author |
|
Tagged release.
Test: MediaProviderTests
Bug: 216129364
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I1fcb0684f88e6160943f0d0d3ab797be13695e61
|
|
Add struct fuse_args
Introduce bpf_arg in fuse_reply_entry
Currently, the opcode filters are zeroed to preserve the libfuse
compatibility.
Bug: 202785178
Test: Along with other changes, file
/sys/fs/bpf/prog_fuse_media_fuse_media
appears.
Signed-off-by: Alessio Balsini <balsini@google.com>
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: I38cd80d702813f4e2b45d69af2ca451fca0984c6
|
|
|
|
setlocale() can fail, returning NULL, which will lead
to a crash in iconv_new(). Fix it like in iconv_help().
Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
|
|
From the feedback received on LKML, it would be better to have multiple
ioctls, than a single ioctl the behavior of which depends on the data
that is passed (e.g., with an enum).
Introduce the new FUSE_PASSTHROUGH_OPEN ioctl which only gets the fd of
the lower file system.
Bug: 175195837
Test: CtsScopedStorageDeviceOnlyTest with android-mainline kernel \
implementing the new FUSE_PASSTHROUGH_OPEN ioctl
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: Iecb677722ca9630ce89b8a8fb5f486216ecd89cc
|
|
Not used since https://github.com/libfuse/libfuse/commit/561d7054d856eea6c2d634093546d6af773dada9
|
|
When not using the readdir_plus mode, the d_type was not returned,
and the use_ino flag was not used for returning d_ino.
This patch fixes the returned values for d_ino and d_type by readdir(3)
The test for the returned value of d_ino has been adjusted to also
take the d_type into consideration and to check the returned values in
both basic readdir and readdir_plus modes. This is done by executing
the passthrough test twice.
Co-authored-by: Jean-Pierre André <jpandre@users.sourceforge.net>
|
|
- Test added for all passthrough examples.
- passthrough.c uses offset==0 mode. The others don't.
- passthrough.c changed to set FUSE_FILL_DIR_PLUS to make the test pass.
- This fixes #583.
|
|
The interface for FUSE passthrough is still under discussion upstream,
thus this change fixes the issue of being able to support multiple
interfaces for passthrough, depending on what the kernel provides.
This implementation tries to explore the different FUSE passthrough
interface implementation and updates an index to the one that has
been found working.
Bug: 167695973
Test: Manual read/write of passthrough files with extra printks
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I74e0e6c0691b37160a00af77fb18eda5342630f5
|
|
kfreebsd is a FreeBSD kernel and a GNU libc
The only macro defined in that case is __FreeBSD_kernel__
Fix #580
|
|
this affected `-o remember` in single-thread mode, it could prematurely
exit if a signal was received
# start an example filesystem from example/
./passthrough -f -s -o remember=5 ./mnt
# make the poll() call return with EINTR
pkill -PIPE passthrough
|
|
Add support for filesystem passthrough read/write of files.
When the FUSE_PASSTHROUGH capability is enabled, the FUSE daemon may
decide while handling the "open" or "create" operation, if the given
file can be accessed by that process in "passthrough" mode, meaning that
all the further read and write operations would be forwarded by the
kernel directly to the lower filesystem rather than to the FUSE daemon.
All requests that aren't read or write are still handled by the
userspace code.
This allows for an improved performance on reads and writes, especially
in the case of reads at random offsets, for which no (readahead)
caching mechanism would help, reducing the performance gap between FUSE
and native filesystem access.
Extend also the passthrough_hp example with the new passthrough feature.
Bug: 168023149
Test: atest ScopedStorageTest
Signed-off-by: Alessio Balsini <balsini@android.com>
Change-Id: I38aff0cf7198b7cd92eccc97547d47f4e1132b00
|
|
In commit d614415a ("buffer.c: check whether buf is
NULL in fuse_bufvec_advance func"), if fuse_bufvec_current
func returns NULL, it returns 1 directly. Actually,
we should return 0 when buf is NULL.
Fixes: d614415a ("buffer.c: check whether buf is NULL in fuse_bufvec_advance func")
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Haotian Li <lihaotian9@huawei.com>
|
|
In fuse_bufvec_advance func, calling fuse_bufvec_current func
may return NULL, so we should check whether buf is NULL before
using it.
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Haotian Liu <lihaotian9@huawei.com>
|
|
This seems to have been added before 2006 to fix a uclibc bug. It
doesn't seem to be the case anymore so just get rid of it.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|
This actually prevents sshfs linking to it as fuse_new becomes
unavailable.
According to the git history, this seems to predate 2006.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
|
This commit defines a new capability called `FUSE_CAP_CACHE_SYMLINKS`.
It is off by default but you can now enable it by setting this flag in
in the `want` field of the `fuse_conn_info` structure.
When enabled, the kernel will save symlinks in its page cache,
by making use of the feature introduced in kernel 4.20:
https://github.com/torvalds/linux/commit/5571f1e65486be025f73fa6aa30fb03725d362a2
|
|
|
|
|
|
Fixes: #538.
|
|
On uclibc and MacOS we don't use versioned symbols. Hence,
there's no definition for fuse_session_loop_mt on those cases
and the linker won't be able to resolve calls to fuse_session_loop_mt()
Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
|
|
setlocale() can fail, returning NULL, if the user has an invalid (or
missing) locale set in the LANG environment variable.
In my case, this happens when using VS Code's integrated terminal to
launch a fuse-based filesystem. A bug (fix upcoming) results in VS Code
setting an invalid locale.
iconv_help() currently passes the return value of setlocale(...)
directly to strdup() without checking if it is NULL, resulting in a
crash.
To reproduce, simply set LANG="something_invalid" and call
fuse_lib_help().
Stack trace when the process receives `SIGSEGV`:
(gdb) bt
#0 0x00007fabd0fcc4b5 in __strlen_avx2 () from /usr/lib/libc.so.6
#1 0x00007fabd0ef9233 in strdup () from /usr/lib/libc.so.6
#2 0x00007fabd13b8128 in iconv_help () at ../lib/modules/iconv.c:641
#3 0x00007fabd13b81a8 in iconv_opt_proc (data=0x55580a6ee850, arg=0x55580a6edfb0 "-h", key=0, outargs=0x7ffeeb1a8ec8) at ../lib/modules/iconv.c:658
#4 0x00007fabd13af7d5 in call_proc (ctx=0x7ffeeb1a8ea0, arg=0x55580a6edfb0 "-h", key=0, iso=0) at ../lib/fuse_opt.c:161
#5 0x00007fabd13afaf1 in process_opt (ctx=0x7ffeeb1a8ea0, opt=0x7fabd13c3d40 <iconv_opts>, sep=0, arg=0x55580a6edfb0 "-h", iso=0) at ../lib/fuse_opt.c:233
#6 0x00007fabd13afd5a in process_gopt (ctx=0x7ffeeb1a8ea0, arg=0x55580a6edfb0 "-h", iso=0) at ../lib/fuse_opt.c:285
#7 0x00007fabd13b0117 in process_one (ctx=0x7ffeeb1a8ea0, arg=0x55580a6edfb0 "-h") at ../lib/fuse_opt.c:368
#8 0x00007fabd13b0190 in opt_parse (ctx=0x7ffeeb1a8ea0) at ../lib/fuse_opt.c:379
#9 0x00007fabd13b03d3 in fuse_opt_parse (args=0x7ffeeb1a8f70, data=0x55580a6ee850, opts=0x7fabd13c3d40 <iconv_opts>, proc=0x7fabd13b8186 <iconv_opt_proc>)
at ../lib/fuse_opt.c:414
#10 0x00007fabd13b8226 in iconv_new (args=0x7ffeeb1a8f70, next=0x0) at ../lib/modules/iconv.c:680
#11 0x00007fabd13a5627 in print_module_help (name=0x7fabd13b9e1c "iconv", fac=0x7fabd13d48e0 <fuse_module_iconv_factory>) at ../lib/fuse.c:4692
#12 0x00007fabd13a56aa in fuse_lib_help (args=0x7ffeeb1a9238) at ../lib/fuse.c:4721
iconv_help() is modified to print an error when setlocale() fails.
It then carries on printing the iconv module's help.
Reading setlocale(3), it seems that the strdup() of the result was
not necessary.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@gmail.com>
|
|
Move assert for se before dereferencing it with se->debug.
Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Co-authored-by: Liao Pingfang <liao.pingfang@zte.com.cn>
|
|
(#519)
|
|
Assign NULL to "old" at the first free(), to avoid the possible 2nd free() for it.
Signed-off-by: Liao Pingfang <liao.pingfang@zte.com.cn>
Co-authored-by: Liao Pingfang <liao.pingfang@zte.com.cn>
|
|
If fuse_session_unmount is called before fuse_session_destroy, both
would try to close(se->fd). Avoid that by resetting it in
fuse_session_unmount.
|
|
The bluecross kernel introduced a change,
4fb542f2aa1414cea5686efcf72a411b7213c375 that breaks responses to
canonical paths.
The patch above tried to guarantee that the canonical path
returned from the FUSE daemon is null terminated. It does this by
replacing the last character in the path returned from the FUSE daemon
with '\0'.
Since the size of the response returned from the FUSE daemon is gotten
from strlen which doesn't take into account the null terminating
character. This means that the kernel fix above will break the file
path returned from userspace. Effectively replacing
/storage/emulated/0 with /storage/emulated/.
It is unclear how this breaks inotify on the root path but not inotify
on Download/ for instance since that too is replaced by
/storage/emulated/Downloa.
One thing I've noticed is that in the case of Download, being
replaced with Downloa, there is an error generated, since Downloa
doesn't exist, but in the case of /storage/emulated/0, there is no
error since /storage/emulated/ exists.
In any case, this cl returns a buffer size including the '\0' to the
kernel and seems right given that the actual size of the buffer
returned to the kernel is now correct.
Test: Manual tests with inotify and Documents UI detecting changes on
/sdcard on both taimen and crosshatch
Bug: 152035889
Change-Id: Ia4b9adec09dd501ec0c5327b9ea9577412cea6a2
|
|
Context: SPLICE_WRITE is not used with regular buffers
(i.e. when they are not file-descriptor backed buffers).
There is a bug which assumes file descriptors are used.
If the amount of data associated with those FD is lower
than twice the page size, SPLICE_WRITE is not utilized.
With regular buffers the aggregated size was always 0.
Because vmsplice (splice user pages to/from a pipe) is
called before splice in fuse_lowlevel.c, regular buffers
would also work with splice.
This patch prevents to fallback to non-splice enabled
copies when itheir is no FD involved.
|
|
FUSE_CANONICAL_PATH opcode, (2016) was added in some Android
kernels to support inotify. Add canonical path handlers in libfuse and
create a patch file to easily apply this patch on top of updates.
Test: inotify - /sdcard on Taimen
Test: atest FileObserver
Bug: 147482155
Change-Id: I97a2c4247aa3e4a70af697569b56662a0755f72b
|
|
|
|
Fixes #467.
|
|
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.
|
|
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>
|
|
|
|
Local variable args is not freed on cuse_lowlevel_setup success.
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
|
|
The latest release allows a custom logger
Bug: 135341433
Test: adb shell ls /sdcard with persist.sys.fuse
Change-Id: Iaa8a2bb7b6da3f364fba41b443527a998a26549f
|
|
|
|
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.
|
|
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>
|
|
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>
|
|
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>
|
|
ae757e65a9 am: 7eff99c4b7 am: 26f560b643
am: 3d406b8575
Change-Id: I49119cf3733b0495ced4b8bdb5148a8f3c61e0dd
|
|
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>
|
|
Make compile on Android
|
|
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>
|
|
The pointer operand to the binary `+` operator must be to a complete
object type. Since we are working with byte sizes, use `char *` instead.
|
|
This is a constraint violation in ISO C[0].
[0] http://port70.net/~nsz/c/c11/n1570.html#6.8.6.4p1
|
|
This is a GNU C extension.
|
|
|
|
|