Age | Commit message (Collapse) | Author | Lines |
|
A previous commit added single thread behavior as long as se->got_init is
not set, especially as buffer allocation should be done after got_init
only. Technically it should not make a difference in current libfuse
design, as more worker threads are only allocated after the FUSE_INIT
handler is completely done. That might at some point change, though.
In general it is cleaner to set se->got_init, when the init handler
is done.
Done as separate commit, as this introduces a slight risk to break
something - backport to older version should be done carefully.
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
|
|
This is to prevent startup races. For example it is
hard for threads to know the buffer size the kernel usage.
In the past kernel buffer size always was max 1MB, but in
the mean time this might be more, depending on system tunings.
I thought I had fixed all races, but the report in issue #1296
proves otherwise.
Closes: https://github.com/libfuse/libfuse/issues/1296
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
In io-uring mode these requests are always re-used
and not allocated - we need to re-initialize them.
In order to set flags to zero a struct holding the flags
had to be added.
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
|
|
fuse_log() did not have that attribute and so compilers
didn't give warnings for plain printf().
Add the attribute and fix related warnings.
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
|
|
During testing of LACT using various sanitizers issue with libfuse.so
leaking memory and reading uninitialized memory was uncovered. While
this was due to ABI misusage on the side of fuser (Rust wrapper for
libfuse.so), we now allow creating a no-op session by passing ops as
NULL.
fuser and other libfuse users is using fuse_session_new() with
NULL struct fuse_lowlevel_ops *op and op_size=0. This resulted
in a warning, but otherwise succeeded. The resulting fuse_session
is just passed to fuse_session_mount() so that libfuse could
do the actual mount. Fuse kernel request handling is not done
through libfuse but their own layer.
Edit by Bernd:
- Update the commit message
- moved using null_ops to fuse_session_new_30() as that is
actually called by the external fuse_session_new().
- forbidding NULL struct fuse_lowlevel_ops *op and 0 op_size
in fuse_session_new_versioned()
- various other NULL ptr checks in fuse_session_new() that
now result in failure.
Signed-off-by: Alik Aslanyan <inline0@pm.me>
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
|
|
The FUSE protocol uses struct fuse_write_out to convey the return value of
copy_file_range, which is restricted to uint32_t. But the COPY_FILE_RANGE
interface supports a 64-bit size copies.
Currently the number of bytes copied is silently truncated to 32-bit, which
is unfortunate at best.
Implement the COPY_FILE_RANGE_64 interface which is identical to the old
one, except the number of bytes copied is returned in a 64-bit value.
The library interface remains the same.
If the kernel does not support the new interface or the server is running
as a 32-bit process, limit the copy size to size to UINT_MAX - 4096.
Edit by Bernd:
Keep ioctl_64bit and add use new bit is_copy_file_range_64 to keep
flags separated from each other - easier code readability IMO.
Reported-by: Florian Weimer <fweimer@redhat.com>
Closes: https://lore.kernel.org/all/lhuh5ynl8z5.fsf@oldenburg.str.redhat.com/
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
The application might have just written directly into the payload
to no need to copy it and in fact, using memcpy would be undefined
behavior.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
With io-uring the req owns the payload buffer, the application
can directly access it and copy data into it.
fuse_buf_copy_one() already has a check for dstmem == srcmem
and skips data copies.
fuse_reply_data
fuse_reply_data_uring
fuse_buf_copy
fuse_buf_copy_one
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Operation might continue without io-uring, so just free these
resources.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
This is already done a few lines below. And actually no reason
to hold the lock at all given the variables are atomics now.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Reported-by: lixianming <lixianming.19951001@bytedance.com>
Closes: https://github.com/libfuse/libfuse/pull/1317
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
|
|
Closes: https://github.com/libfuse/libfuse/issues/1310
Signed-off-by: CismonX <admin@cismon.net>
|
|
Signed-off-by: Gleb Popov <6yearold@gmail.com>
|
|
This seems to be a left over - the file system has to set
this variable in its ->init method, i.e. logging it
in startup is not giving any helpful output.
Closes: https://github.com/libfuse/libfuse/issues/1272
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Needed for ENOTSUP
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Start the ring threads before sending fuse_reply_ok() so
that io-uring startup issues can be non-fatal.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
fuse-io-uring would create a blocking mount with 0 queue entries,
we need a sanity check for it.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
-EOPNOTSUPP was in early RFC kernel patches, but merged version
does not have this handler anymore.
Closes: https://github.com/libfuse/libfuse/issues/1283
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
This is a long standing issue, a system could have unmounted
/path/to/mnt and then fuse-client/kernel would send FUSE_DESTROY,
which would then again try a umount.
Given that FUSE_DESTROY is async, that umount might arrive
any time later and might possibly unmount a wrong mount point.
A warning as in issue #1286 is just minor to that.
Code wise this uses atomics to free the char *, as FUSE_DESTROY
might race with a signal and a double free might be possible
without proctection. A lock might run into the same issue,
if the signal would arrive at the wrong time a double lock
would be possible.
Additionally, fuse_session_mount() is updated, to first
duplicatate the pointer and to then do the kernel mount -
reverting the kernel mount in case of strdup() failure
is much harder.
Closes: https://github.com/libfuse/libfuse/issues/1286
Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
|
|
This commit adds libfuse support for FUSE_STATX requests on
linux distributions.
Currently, statx is only supported on linux. To make the interface a
ergonomic as possible (eg using native 'struct statx' vs 'struct
fuse_statx'), this implementation gates the 'struct statx' changes
by #ifdef linux.
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
|
|
Signed-off-by: izxl007 <zeng.zheng@zte.com.cn>
|
|
Signed-off-by: Gleb Popov <6yearold@gmail.com>
|
|
Add comment noting that the uint64_t offset in fuse_lseek_in is derived
from kernel loff_t and should be treated as signed for negative offsets.
Signed-off-by: izxl007 <zeng.zheng@zte.com.cn>
|
|
This patch adds support for the FUSE INC_EPOCH notify. This new operation
simply increments the FUSE connection epoch value, allowing to invalidate
all the dentries next time they are revalidated.
Signed-off-by: Luis Henriques <luis@igalia.com>
|
|
Do not attempt to update /run/mount/utab if it doesn't exist.
Note: if this path ever changes, utab updates will break.
Fixes the following error when mounting iPhone using ifuse:
ifuse /mnt --container com.httpstorm.httpstorm
mount: mounting ifuse on /mnt failed: Invalid argument
On OpenWRT by default mount-utils is not installed and utab
does not exist. /bin/mount is a symlink to /bin/busybox and
does not support updating of utab. If mount-utils is installed:
/run/mount/ exists, but does not contain utab.
The mount-utils instance is under /usr/bin/mount, so a hard-coded
call to /bin/mount will still fail. Using /usr/bin/mount succeeds
but does not create utab.
[1] https://github.com/libfuse/libfuse/pull/1247
Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
|
|
We need to write an uint64_t to eventfd.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
The io_uring options are currently shown in both fuse_cmdline_help()
and fuse_lowlevel_help(), which creates unnecessary duplication. Since
io_uring is a low-level I/O feature, it makes more sense to only show
these options in fuse_lowlevel_help().
This change:
- Removes io_uring options from fuse_cmdline_help()
- Keeps them in fuse_lowlevel_help() where they belong
- Removes the FIXME comment that is no longer needed
This is purely a documentation improvement and does not affect any
functionality. Users will still see all available options when using
--help, just organized in a more logical way.
Signed-off-by: izxl007 <zeng.zheng@zte.com.cn>
|
|
BT_STACK_SZ and backtrace_buffer are not used when
HAVE_BACKTRACE is undefined. Wrap them in #ifdef
to avoid a build warning:
../lib/fuse_signals.c:31:14: warning: 'backtrace_buffer' defined but not used [-Wunused-variable]
31 | static void *backtrace_buffer[BT_STACK_SZ];
| ^~~~~~~~~~~~~~~~
Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
|
|
Signed-off-by: Gleb Popov <6yearold@gmail.com>
|
|
Signed-off-by: izxl007 <zeng.zheng@zte.com.cn>
|
|
Function fuse_set_thread_name() assumes that pthread_t is an unsigned long
and fails to compile in musl libc with the following:
../lib/util.c: In function 'fuse_set_thread_name':
../lib/util.c:48:28: error: passing argument 1 of 'pthread_setname_np' makes \
pointer from integer without a cast [-Wint-conversion]
Fix fuse_set_thread_name() by dropping the 'tid' parameter, as it is always
set to pthread_self().
Signed-off-by: Luis Henriques <luis@igalia.com>
|
|
fuse_apply_conn_info_opts() was applying to 'want_ext',
which would cause conflicts with 'want' if the application
applied its own flags to 'conn->want'.
Solution is:
- to move fuse_{set,unset,get}_feature_flag and
convert_to_conn_want_ext() to fuse_lowlevel.c and
to define them as part of the public API, although
convert_to_conn_want_ext() should not be used - it is
currently needed to be a public function due as it needs
to be defined for the tests.
Related to https://github.com/libfuse/libfuse/issues/1171 and
https://github.com/libfuse/libfuse/pull/1172.
Closes: https://github.com/libfuse/libfuse/issues/1171
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
there are too many issues with conn->want and conn->want_ext
conversion, for now just log a warning, but setting both
flags is now not fatal anymore.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
This adds the libfuse changes needed to support request timeouts.
A timeout may be set by the server in its init call. If a request is not
completed by the timeout, the connection will be aborted by the kernel.
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
|
|
Signed-off-by: izxl007 <zeng.zheng@zte.com.cn>
|
|
Refactor handler logic to make it more readable.
No functional changes.
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
|
|
Also update the comment description of fuse_uring.c
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
So far it was disabled as the series was not complete
yet.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
We want to especially test with and without io-uring being
enabled. Ideally without modifying all tests - that is
what the env variable can be used for.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
This might be useful to optimize code paths. For example, with
io-uring the request buffer is valid until the request is replied
to, while without io-uring the request buffer is only valid
in current thread context.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Not function yet, just preparation.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
It will never be modified, should be const.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
The actual function to write to /dev/fuse is offloaded
into _fuse_send_msg()
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Avoid splattering the code with ifdef
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|
|
Needed by follow up commits. container_of is actually
just moved/consolidated to util.h.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
|