History log of /freebsd-current/tests/sys/fs/fusefs/mockfs.hh
Revision Date Author Comments
# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 5f51c9c3 21-Feb-2023 Alan Somers <asomers@FreeBSD.org>

fusefs: add some more test cases for bad fuse servers

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38719


# 0c9df4af 21-Feb-2023 Alan Somers <asomers@FreeBSD.org>

fusefs: fix a buffer overflow in the tests

The actual overflow occured in the ReadAhead.readahead test.
Surprisingly it has never segfaulted or resulted in any bad behavior.

MFC after: 1 week
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38718


# 2f636248 29-Apr-2022 Alan Somers <asomers@FreeBSD.org>

fusefs: use the fsname mount option if set

The daemon can specify fsname=XXX in its mount options. If so, the file
system should report f_mntfromname as XXX during statfs. This will show
up in the output of commands like mount and df.

Submitted by: Ali Abdallah <ali.abdallah@suse.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35090


# 616eaa66 29-Apr-2022 Alan Somers <asomers@FreeBSD.org>

fusefs: add a test for the subtype= option

At mount time server can set, for example, "subtype=xfs", so that
mount(8) will later show the mountpoint's file system as "fusefs.xfs".
fusefs has had this feature ever since the original GSoC commit in 2012,
but there's never been a test for it.

MFC after: 2 weeks


# 155ac516 15-Apr-2022 Alan Somers <asomers@FreeBSD.org>

fusefs: validate servers' error values

Formerly fusefs would pass up the stack any error value returned by the
fuse server. However, some values aren't valid for userland, but have
special meanings within the kernel. One of these, EJUSTRETURN, could
cause a kernel page fault if the server returned it in response to
FUSE_LOOKUP. Fix by validating all errors returned by the server.

Also, fix a data lifetime bug in the FUSE_DESTROY test.

PR: 263220
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 weeks
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D34931


# 398c88c7 31-Dec-2021 Alan Somers <asomers@FreeBSD.org>

fusefs: implement VOP_ALLOCATE

Now posix_fallocate will be correctly forwarded to fuse file system
servers, for those that support it.

MFC after: 2 weeks
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D33389


# 91972cfc 28-Nov-2021 Alan Somers <asomers@FreeBSD.org>

fusefs: update atime on reads when using cached attributes

When using cached attributes, whether or not the data cache is enabled,
fusefs must update a file's atime whenever it reads from it, so long as
it wasn't mounted with -o noatime. Update it in-kernel, and flush it to
the server on close or during the next setattr operation.

The downside is that close() will now frequently trigger a FUSE_SETATTR
upcall. But if you care about performance, you should be using
-o noatime anyway.

MFC after: 2 weeks
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D33145


# f44a4487 25-Sep-2021 Alan Somers <asomers@FreeBSD.org>

fusefs: fix intermittency in the dev_fuse_poll test

The DevFusePoll::access/select test would occasionally segfault. The
cause was a file descriptor that was shared between two threads. The
first thread would kill the second and close the file descriptor. But
it was possible that the second would read the file descriptor before it
shut down. That did not cause problems for kqueue, poll, or blocking
operation, but it triggered segfaults in select's macros.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D32142


# 5403f2c1 17-Jun-2021 Alan Somers <asomers@FreeBSD.org>

fusefs: ensure that FUSE ops' headers' unique values are actually unique

Every FUSE operation has a unique value in its header. As the name
implies, these values are supposed to be unique among all outstanding
operations. And since FUSE_INTERRUPT is asynchronous and racy, it is
desirable that the unique values be unique among all operations that are
"close in time".

Ensure that they are actually unique by incrementing them whenever we
reuse a fuse_dispatcher object, for example during fsync, write, and
listextattr.

PR: 244686
MFC after: 2 weeks
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D30810


# 92bbfe1f 28-Dec-2020 Alan Somers <asomers@gmail.com>

fusefs: implement FUSE_COPY_FILE_RANGE.

This updates the FUSE protocol to 7.28, though most of the new features
are optional and are not yet implemented.

MFC after: 2 weeks
Relnotes: yes
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D27818


# 37df9d3b 28-Dec-2020 Alan Somers <asomers@FreeBSD.org>

fusefs: update FUSE protocol to 7.24 and implement FUSE_LSEEK

FUSE_LSEEK reports holes on fuse file systems, and is used for example
by bsdtar.

MFC after: 2 weeks
Relnotes: yes
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D27804


# f928dbcb 23-Dec-2020 Alan Somers <asomers@FreeBSD.org>

fusefs: fix the tests for a wider range of maxphys

maxphys is now a tunable, ever since r368124. The default value is also
larger than it used to be. That broke several fusefs tests that made
assumptions about maxphys.

* WriteCluster.clustering used the MAXPHYS compile-time constant.

* WriteBackAsync.direct_io_partially_overlaps_cached_block implicitly
depended on the default value of maxphys. Fix it by making the
dependency explicit.

* Write.write_large implicitly assumed that maxphys would be no more
than twice maxbcachebuf. Fix it by explicitly setting m_max_write.

* WriteCluster.clustering and several others failed because the MockFS
module did not work for max_write > 128KB (which most tests would set
when maxphys > 256KB). Limit max_write accordingly. This is the same
as fusefs-libs's behavior.

* Bmap's tests were originally written for MAXPHYS=128KB. With larger
values, the simulated file size was too small.

PR: 252096
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D27769


# 6c0c3620 11-Sep-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: Fix iosize for FUSE_WRITE in 7.8 compat mode

When communicating with a FUSE server that implements version 7.8 (or older)
of the FUSE protocol, the FUSE_WRITE request structure is 16 bytes shorter
than normal. The protocol version check wasn't applied universally, leading
to an extra 16 bytes being sent to such servers. The extra bytes were
allocated and bzero()d, so there was no information disclosure.

Reviewed by: emaste
MFC after: 3 days
MFC-With: r350665
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21557


# bf507497 14-Aug-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: Fix the size of fuse_getattr_in

In FUSE protocol 7.9, the size of the FUSE_GETATTR request has increased.
However, the fusefs driver is currently not sending the additional fields.
In our implementation, the additional fields are always zero, so I there
haven't been any test failures until now. But fusefs-lkl requires the
request's length to be correct.

Fix this bug, and also enhance the test suite to catch similar bugs.

PR: 239830
MFC after: 2 weeks
MFC-With: 350665
Sponsored by: The FreeBSD Foundation


# 1fa8ebfb 13-Aug-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: add SVN Keywords to the test files

Reported by: SVN pre-commit hooks
MFC after: 15 days
MFC-With: r350665
Sponsored by: The FreeBSD Foundation


# 5a0b9a27 19-Jul-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: fix warnings in the tests reported by GCC

Sponsored by: The FreeBSD Foundation


# ed74f781 18-Jul-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: add a intr/nointr mount option

FUSE file systems can optionally support interrupting outstanding
operations. However, the file system does not identify to the kernel at
mount time whether it's capable of doing that. Instead it signals its
noncapability by returning ENOSYS to the first FUSE_INTERRUPT operation it
receives. That's a problem for reliable signal delivery, because the kernel
must choose which thread should get a signal before it knows whether the
FUSE server can handle interrupts. The problem is even worse because the
FUSE protocol allows a file system to simply ignore all FUSE_INTERRUPT
operations.

Fix the signal delivery logic by making interruptibility an opt-in mount
option. This will require a corresponding change to libfuse, but not to
most file systems that link to libfuse.

Bump __FreeBSD_version due to the new mount option.

Sponsored by: The FreeBSD Foundation


# fef46454 25-Jun-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: implement the "time_gran" feature.

If a server supports a timestamp granularity other than 1ns, it can tell the
client this as of protocol 7.23. The client will use that granularity when
updating its cached timestamps during write. This way the timestamps won't
appear to change following flush.

Sponsored by: The FreeBSD Foundation


# 87ff949a 20-Jun-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: raise protocol level to 7.23

None of the new features are implemented yet. This commit just adds the new
protocol definitions and adds backwards-compatibility code for pre 7.23
servers.

Sponsored by: The FreeBSD Foundation


# 1f309e37 20-Jun-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: update tests after r349260

r349260 removed some Linuxisms from the FUSE protocol header file in favor
of standard C99 types. This change follows suit in the tests.

Sponsored by: The FreeBSD Foundation


# 7cbb8e8a 20-Jun-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: raise protocol level to 7.15

This protocol level adds two new features: the ability for the server to
store or retrieve data into/from the client's cache. But the messages
aren't defined soundly since they identify the file only by its inode,
without the generation number. So it's possible for them to modify the
wrong file's cache. Also, I don't know of any file systems in ports that
use these messages. So I'm not implementing them. I did add a (disabled)
test for the store message, however.

Sponsored by: The FreeBSD Foundation


# a1c9f4ad 20-Jun-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: implement VOP_BMAP

If the fuse daemon supports FUSE_BMAP, then use that for the block mapping.
Otherwise, use the same technique used by vop_stdbmap. Report large values
for runp and runb in order to maximize read clustering and minimize upcalls,
even if we don't know the true layout.

The major result of this change is that sequential reads to FUSE files will
now usually happen 128KB at a time instead of 64KB.

Sponsored by: The FreeBSD Foundation


# 402b609c 17-Jun-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: use cluster_read for more readahead

fusefs will now use cluster_read. This allows readahead of more than one
cache block. However, it won't yet actually cluster the reads because that
requires VOP_BMAP, which fusefs does not yet implement.

Sponsored by: The FreeBSD Foundation


# 8eecd9ce 14-Jun-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: enable write clustering

Enable write clustering in fusefs whenever cache mode is set to writeback
and the "async" mount option is used. With default values for MAXPHYS,
DFLTPHYS, and the fuse max_write mount parameter, that means sequential
writes will now be written 128KB at a time instead of 64KB.

Also, add a regression test for PR 238565, a panic during unmount that
probably affects UFS, ext2, and msdosfs as well as fusefs.

PR: 238565
Sponsored by: The FreeBSD Foundation


# eae1ae13 03-Jun-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: support asynchronous cache invalidation

Protocol 7.12 adds a way for the server to notify the client that it should
invalidate an inode's data cache and/or attributes. This commit implements
that mechanism. Unlike Linux's implementation, ours requires that the file
system also supports FUSE_EXPORT_SUPPORT (NFS-style lookups). Otherwise the
invalidation operation will return EINVAL.

Sponsored by: The FreeBSD Foundation


# c2d70d6e 31-May-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: support name cache invalidation

Protocol 7.12 adds a way for the server to notify the client that it should
invalidate an entry from its name cache. This commit implements that
mechanism.

Sponsored by: The FreeBSD Foundation


# a4856c96 29-May-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: raise protocol level to 7.12

This commit raises the protocol level and adds backwards-compatibility code
to handle structure size changes. It doesn't implement any new features.
The new features added in protocol 7.12 are:

* server-side umask processing (which FreeBSD won't do)
* asynchronous inode and directory entry invalidation (which I'll do next)

Sponsored by: The FreeBSD Foundation


# 29edc611 27-May-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: make the tests more cplusplusy

* Prefer std::unique_ptr to raw pointers
* Prefer pass-by-reference to pass-by-pointer
* Prefer static_cast to C-style cast, unless it's too much typing

Reported by: ngie
Sponsored by: The FreeBSD Foundation


# cc04566c 25-May-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: more build fixes

* Fix printf format strings on 32-bit OSes
* Fix -Wclass-memaccess violation on GCC-8 caused by using memset on an object
of non-trivial type.
* Fix memory leak in MockFS::init
* Fix -Wcast-align error on i386 in expect_readdir
* Fix some heterogenous comparison errors on 32-bit OSes.

Sponsored by: The FreeBSD Foundation


# 16bd2d47 16-May-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: Upgrade FUSE protocol to version 7.9.

This commit upgrades the FUSE API to protocol 7.9 and adds unit tests for
backwards compatibility with servers built for version 7.8. It doesn't
implement any of 7.9's new features yet.

Sponsored by: The FreeBSD Foundation


# 0a7c63e0 12-May-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: Report the number of available ops in kevent(2)

Just like /dev/devctl, /dev/fuse will now report the number of operations
available for immediate read in the kevent.data field during kevent(2).

Sponsored by: The FreeBSD Foundation


# 81a619c4 10-May-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: fix intermittency in the Destroy.ok test

The handler for FUSE_DESTROY must shut down the daemon.

Sponsored by: The FreeBSD Foundation


# f067b609 12-Apr-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: implement VOP_ADVLOCK

PR: 234581
Sponsored by: The FreeBSD Foundation


# 140bb492 05-Apr-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: correctly return EROFS from VOP_ACCESS

Sponsored by: The FreeBSD Foundation


# 91ff3a0d 21-Mar-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: add a test case for the allow_other mount option

Also, fix one of the default_permissions test cases. I forgot the
expectation for FUSE_ACCESS, because that doesn't work right now.

Sponsored by: The FreeBSD Foundation


# 9821f1d3 20-Mar-2019 Alan Somers <asomers@FreeBSD.org>

fusefs: adapt the tests to the fuse => fusefs rename

Sponsored by: The FreeBSD Foundation