aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorLines
2023-01-02update mount.c, in order to pass through -n.Ciaran-0/+1
autofs uses automount, which calls fuse, during an sshfs call. fuse complains about -n being an unknown option (ref. https://github.com/libfuse/libfuse/issues/715) this one line edit provides the command to be accepted, and pass through, allowing autofs-automount to operate on the mount, even though it is already in the mtab, given the nature of autofs/automount.
2022-12-01Make it work even if max_idle_threads is set to 0Zhansong Gao-1/+1
It may happen that none of the worker threads are running if max_idle_threads is set to 0 although few people will do this. Adding a limit of keeping at least one worker thread will make our code more rigorous. Signed-off-by: Zhansong Gao <zhsgao@hotmail.com>
2022-11-15libfuse custom communication interfacey-0/+24
libfuse can now be used without having a mount interface.
2022-09-11Fix the fuse_parse_cmdline@FUSE_3.0 ABI compat symbolBernd Schubert-1/+1
There was a simple typo and sym1 didn't match the function name with the older __asm__(".symver " sym1 "," sym2) way to define ABI compatibility. Witht the newer "__attribute__ ((symver (sym2)))" sym1 is not used at all and in manual testing the issue didn't come up therefore.
2022-09-08Released 3.12.0Nikolaus Rath-52/+23
2022-09-08Add option to specify init script locationFina Wilke-13/+15
Also allows to disable the installation if desired
2022-09-08Use destroy_req instead of free to destroy fuse_reqFrank Dinoff-1/+3
If we get the interrupt before the fuse op, the fuse_req is deleted without decrementing the refcount on the cloned file descriptor. This leads to a leak of the cloned /dev/fuse file descriptor.
2022-09-04Add summary of changes regarding 'max_threads' to ChangeLog.rstBernd Schubert-0/+55
Update the change log file with the summary of API changes related to the 'max_threads' changes.
2022-09-04fuse_session_loop_mt: Accept a NULL config - use defaultsBernd Schubert-8/+25
If an application does not want to bother with the session and wants to keep defaults, it can now just pass a NULL as config parameter.
2022-09-04fuse-loop/fuse_do_work: Avoid lots of thread creations/destructionsBernd Schubert-14/+117
On benchmarking metadata operations with a single threaded bonnie++ and "max_idle_threads" limited to 1, 'top' was showing suspicious 160% cpu usage. Profiling the system with flame graphs showed that an astonishing amount of CPU time was spent in thread creation and destruction. After verifying the code it turned out that fuse_do_work() was creating a new thread every time all existing idle threads were already busy. And then just a few lines later after processing the current request it noticed that it had created too many threads and destructed the current thread. I.e. there was a thread creation/destruction ping-pong. Code is changed to only create new threads if the max number of threads is not reached. Furthermore, thread destruction is disabled, as creation/destruction is expensive in general. With this change cpu usage of passthrough_hp went from ~160% to ~80% (with different values of max_idle_threads). And bonnie values got approximately faster by 90%. This is a with single threaded bonnie++ bonnie++ -x 4 -q -s0 -d <path> -n 30:1:1:10 -r 0 Without this patch, using the default max_idle_threads=10 and just a single bonnie++ the thread creation/destruction code path is not triggered. Just one libfuse and one application thread is just a corner case - the requirement for the issue was just n-application-threads >= max_idle_threads. Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2022-09-04API update for fuse_loop_config additionsBernd Schubert-48/+278
struct fuse_loop_config was passed as a plain struct, without any version identifer. This had two implications 1) Any addition of new parameters required a FUSE_SYMVER for fuse_session_loop_mt() and fuse_loop_mt() as otherwise a read beyond end-of previous struct size might have happened. 2) Filesystems also might have been recompiled and the developer might not have noticed the struct extensions and unexpected for the developer (or people recomliling the code) uninitialized parameters would have been passed. Code is updated to have struct fuse_loop_config as an opaque/private data type for file systems that want version 312 (FUSE_MAKE_VERSION(3, 12)). The deprecated fuse_loop_config_v1 is visible, but should not be used outside of internal conversion functions File systems that want version >= 32 < 312 get the previous struct (through ifdefs) and the #define of fuse_loop_mt and fuse_session_loop_mt ensures that these recompiled file systems call into the previous API, which then converts the struct. This is similar to existing compiled applications when just libfuse updated, but binaries it is solved with the FUSE_SYMVER ABI compact declarations. Signed-off-by: Bernd Schubert <bschubert@ddn.com>
2022-07-02Revert "Increase meson min version and avoid get_pkgconfig_variable warning ↵Nikolaus Rath-2/+2
(#682)" This reverts commit 8db2ba06fef10f38f90b0f3213dd39ec07678e2f. This Meson version is not yet generally available, so we do not want to depend on it..
2022-07-02Remove member m from fuse_fs (#684)Nozomi Miyamori-6/+0
fuse_fs.m is no longer used. Modules are now managed by fuse_modules. fix: free dangling pointer of module #683
2022-06-20Increase meson min version and avoid get_pkgconfig_variable warning (#682)Bernd Schubert-2/+2
meson was complaining: Build targets in project: 27 NOTICE: Future-deprecated features used: * 0.56.0: {'Dependency.get_pkgconfig_variable'} So change to .get_variable(pkgconfig : 'type' and also increase the meson minimal version to be able to handle it. Co-authored-by: Bernd Schubert <bschubert@ddn.com>
2022-05-06Fix a test strncpy compilation warning with recent gccBernd Schubert-2/+4
meson configure -D buildtype=debugoptimized meson configure -D b_sanitize=address,undefined Results in '-fsanitize=address,undefined ... -O2 -g' that made compilation to give errors with recent gcc versions. bernd@t1700bs build-ubuntu>ninja -v [1/2] ccache gcc -Itest/test_syscalls.p -Itest -I../test -Iinclude -I../include -Ilib -I../lib -I. -I.. -fdiagnostics-color=always -fsanitize=address,undefined -fno-omit-frame-pointer -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -O2 -g -D_REENTRANT -DHAVE_CONFIG_H -Wno-sign-compare -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -fno-strict-aliasing -Wno-unused-result -DHAVE_SYMVER_ATTRIBUTE -MD -MQ test/test_syscalls.p/test_syscalls.c.o -MF test/test_syscalls.p/test_syscalls.c.o.d -o test/test_syscalls.p/test_syscalls.c.o -c ../test/test_syscalls.c FAILED: test/test_syscalls.p/test_syscalls.c.o ccache gcc -Itest/test_syscalls.p -Itest -I../test -Iinclude -I../include -Ilib -I../lib -I. -I.. -fdiagnostics-color=always -fsanitize=address,undefined -fno-omit-frame-pointer -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -O2 -g -D_REENTRANT -DHAVE_CONFIG_H -Wno-sign-compare -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -fno-strict-aliasing -Wno-unused-result -DHAVE_SYMVER_ATTRIBUTE -MD -MQ test/test_syscalls.p/test_syscalls.c.o -MF test/test_syscalls.p/test_syscalls.c.o.d -o test/test_syscalls.p/test_syscalls.c.o -c ../test/test_syscalls.c In file included from /usr/include/string.h:519, from ../test/test_syscalls.c:7: In function ‘strncpy’, inlined from ‘test_socket’ at ../test/test_syscalls.c:1885:2, inlined from ‘main’ at ../test/test_syscalls.c:2030:9: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:10: error: ‘__builtin_strncpy’ output may be truncated copying 107 bytes from a string of length 1023 [-Werror=stringop-truncation] 95 | return __builtin___strncpy_chk (__dest, __src, __len, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 96 | __glibc_objsize (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~~~ I disagree a bit on the gcc sanity here, as the code was behaving correctly and even already checked the string length. But sice the string length is already verified, that length can be used for the final strncpy.
2022-05-02Released 3.11.0Nikolaus Rath-6/+16
2022-04-20patch: document ignored fill parameter of readdirAndré Schröder-0/+7
2022-04-17Add missing kernel flags up to 1ULL << 33Bernd Schubert-0/+8
Just a further sync with the in-kernel flags.
2022-04-17Set FUSE_INIT_EXT in fuse_init_out::flagsBernd Schubert-2/+5
It is better to tell the kernel that libfuse knows about the 64 bit flag extension.
2022-04-08Passthrough_ll should display cmd line optionsDharmendra singh-0/+18
Make passthrough_ll to display all its cmdline options instead of keeping them hidden. (I am not sure if these are intentionally kept hidden)
2022-04-08Modify structures in libfuse to handle flags beyond 32 bits.Dharmendra Singh-38/+51
In fuse kernel, 'commit 53db28933e95 ("fuse: extend init flags")' made the changes to handle flags going beyond 32 bits but i think changes were not done in libfuse to handle the same. This patch prepares the ground in libfuse for incoming FUSE kernel patches (Atomic open + lookup) where flags went beyond 32 bits. It makes struct same as in fuse kernel resulting in name change of few fields.
2022-03-31passthrough_hp: Disable splice with the --nosplice optionBernd Schubert-7/+13
passthrough_hp was not updated when splice got enabled by default in libfuse3. I.e. the --nosplice option and condition on it was a noop.
2022-03-31passthrough_hp: Fix inode ref in sfs_unlinkBernd Schubert-0/+26
sfs_unlink may call do_lookup(), which increases the inode ref count, but since that function does not return attributes that lookup ref count won't get automatically decreased.
2022-03-22Merge pull request #649 from fdinoff/fix_clone_fdNikolaus Rath-3/+9
Fix fd leak with clone_fd
2022-03-21Fix fd leak with clone_fdFrank Dinoff-3/+9
do_interrupt would destroy_req on the request without decrementing the channel's refcount. With clone_fd this could leak file descriptors if the worker thread holding the cloned fd was destroyed. (Only max_idle_threads are kept).
2022-03-14Merge pull request #635 from amir73il/fopen_noflushNikolaus Rath-2/+94
Add support for FOPEN_NOFLUSH flag
2022-03-14Merge branch 'master' into fopen_noflushNikolaus Rath-7/+9
2022-02-11Removed duplicates code. (#642)David Galeano-2/+0
The cap for FUSE_CAP_WRITEBACK_CACHE was printed twice.
2022-02-09Fixed returning an error condition to ioctl(2) (#641)Jean-Pierre André-0/+4
When returning a negative error code by ->ioctl() to the high level interface, no error is propagated to the low level, and the reply message to the kernel is shown as successful. A negative result is however returned to kernel, so the kernel can detect the bad condition, but this appears to not be the case since kernel 5.15. The proposed fix is more in line with the usual processing of errors in fuse, taking into account that ioctl(2) always returns a non-negative value in the absence of errors. Co-authored-by: Jean-Pierre André <jpandre@users.sourceforge.net>
2022-01-23Fix ReST end-string nits (#638)Andrew Gaul-3/+3
This makes the file more readable with syntax highlighting.
2022-01-11Avoid ENOENT response when recently invalidated fuse_ino_t is received from ↵Ken Schalk-2/+2
the kernel (#636)
2022-01-05Add test for FOPEN_NOFLUSH flagAmir Goldstein-1/+65
Simulate write() delay and verify that close(rofd) does not block waiting on pending writes. The support for the flag was added in kernel v5.16-rc1. Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2022-01-03Add no_rofd_flush mount optionAmir Goldstein-0/+14
To disable flush for read-only fd. Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2022-01-03Add support for FOPEN_NOFLUSH flagAmir Goldstein-1/+15
Allow requesting from kernel to avoid flush on close at file open time. If kernel does not support FOPEN_NOFLUSH flag, the request will be ignored. For passthrough_hp example, request to avoid flush on close when writeback cache is disabled and file is opened O_RDONLY. Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2021-12-12Document possible NULL paths when directories are removed (#633)Maximilian Heinzler-0/+6
When directories with open handles are removed, the releasedir and fsyncdir operations might be called with a NULL path. That is because there is no hiding behavior like for regular files and the nodes get removed immediately.
2021-11-20test/test_syscalls.c: allow EBADF in fcheck_stat() (#631)Luis Henriques-1/+2
Test test/test_examples.py::test_passthrough_hp[False] fails because, on kernels >= 5.14, fstat() will return -EBADF: 3 [check_unlinked_testfile] fcheck_stat() - fstat: Bad file descriptor 4 [check_unlinked_testfile] fcheck_stat() - fstat: Bad file descriptor 5 [check_unlinked_testfile] fcheck_stat() - fstat: Bad file descriptor 9 [check_unlinked_testfile] fcheck_stat() - fstat: Bad file descriptor ... This patch simply whitelists the EBADF errno code. Signed-off-by: Luís Henriques <lhenriques@suse.de> Co-authored-by: Luís Henriques <lhenriques@suse.de>
2021-09-06Released 3.10.5Nikolaus Rath-1/+11
2021-09-06Fix: fd and memory leak in mount.fuse.c (#614)lixiaokeng-1/+6
The command isn't freed and the fuse_fd isn't closed if execl failed. Fix it. Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
2021-08-25use same hashbang as in rest of repositorya1346054-1/+1
2021-08-25fix spellinga1346054-1/+1
2021-08-25remove executable file mode bit from source filesa1346054-0/+0
2021-08-04meson.build: fix wrong .symver detectionGiulio Benetti-9/+7
As pointed here [1] __has_attribute() is broken for many attributes and if it doesn't support the specific attribute it returns true, so we can't really rely on that for this check. This lead to Buildroot libfuse3 build failure [2] where that shows up with: ``` error: symver is only supported on ELF platforms ``` Indeed Microblaze doesn't support ELF since it doesn't include elfos.h, but __has_attribute(symver) returns true. So let's substitute the #ifdef __has_attribute() with a stronger test on a function foo() with __attribute__((symver ("test@TEST"))). [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766 [2]: http://autobuild.buildroot.net/results/d6c/d6cfaf2aafaeda3c12d127f6a2d2e175b25e654f/build-end.log Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
2021-06-24Travis-CI: Make sure lsan supppressions file can be read by root.Nikolaus Rath-5/+8
2021-06-23Do not run unlinked files test on passthrough_hp with old kernelsAmir Goldstein-3/+19
test_syscalls unlinked testfiles check fails on passthourhg_hp without the kernel commit "fuse: fix illegal access to inode with reused nodeid" queued for kernel 5.14 [1]. Make this check opt-in and do not run it with kernel version before 5.14. [1] https://lore.kernel.org/linux-fsdevel/CAJfpegtGKjeK8E5QsHKF0=re1J9wVHuGRVgg9NDJ_OOwQdCUNg@mail.gmail.com/ Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2021-06-16Fix: a potential crash on failure to setlocalelixiaokeng-4/+2
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>
2021-06-14passthrough_hp: excercise reusing inode numbersAmir Goldstein-7/+50
Before last unlink() release the reference on inode.fd to allow reuse of underlying fs inode number, mark the server inode "deleted" and bump it's generation counter. When same inode number is found on lookup(), the server inode object will be reused as well. Skip this when inode has an open file and when writeback cache is enabled. This will be used to verify inode reuse bug fix in the kernel. Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2021-06-14test/test_syscalls.c: check unlinked testfiles at the end of the testAmir Goldstein-16/+129
On some tests on regular files, open an O_PATH fd of the testfile and record it along side the size and mode and inode. At the end of all tests, use recorded testfiles info to re-check the size mode and inode of the unlinked testfiles. With O_PATH fd, the server does not have to keep the inode alive so FUSE inode may be stale or bad. Therefore, ESTALE and EIO are valid results for fstat() on the old testfile fd's, but returning the wrong size or mode is an invalid result. Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2021-06-14test/test_syscalls.c: refactor fcheck_* helpersAmir Goldstein-68/+45
Avoid multiple fstat() calls and consolidate all fcheck_* helpers into fcheck_stat(). Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2021-06-14test/test_syscalls.c: use unique filename per testAmir Goldstein-13/+37
Generate unique filename per test (only for regular file for now). Make sure to unlink the unique filename after each test. realpath variable was renamed to basepath_r to fix build warning on conflicting symbols with realpath() function. Signed-off-by: Amir Goldstein <amir73il@gmail.com>
2021-06-09Released 3.10.4Nikolaus Rath-4/+14