opnsense-src/sys/fs/fuse
Alan Somers 4bb8e26c26 fusefs: fix two bugs regarding _PC_MIN_HOLE_SIZE
Background:

If a user does pathconf(_, _PC_MIN_HOLE_SIZE) on a fusefs file system,
the kernel must actually issue a FUSE_LSEEK operation in order to
determine whether the server supports it.  We cache that result, so we
only have to send FUSE_LSEEK the first time that _PC_MIN_HOLE_SIZE is
requested on any given mountpoint.

Problem 1:

Unlike fpathconf, pathconf operates on files that may not be open.  But
FUSE_LSEEK requires the file to be open.  As described in PR 278135,
FUSE_LSEEK cannot be sent for unopened files, causing _PC_MIN_HOLE_size
to wrongly report EINVAL.  We never noticed that before because the
fusefs test suite only uses fpathconf, not pathconf.  Fix this bug by
opening the file if necessary.

Problem 2:

On a completely sparse file, with no data blocks at all, FUSE_LSEEK with
SEEK_DATA would fail to ENXIO.  That's correct behavior, but
fuse_vnop_pathconf wrongly interpreted that as "FUSE_LSEEK not
supported".  Fix the interpretation.

PR:		278135
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D44618

(cherry picked from commit 6efba04df3f8c77b9b12f1df3e5124a7249b82fc)
2024-09-19 14:27:41 -06:00
..
fuse.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
fuse_device.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
fuse_file.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
fuse_file.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
fuse_internal.c fusefs: Fix warning formatting 2024-09-03 14:54:43 +00:00
fuse_internal.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
fuse_io.c Add vnode_pager_clean_{a,}sync(9) 2024-01-18 02:51:33 +02:00
fuse_io.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
fuse_ipc.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
fuse_ipc.h fusefs: sanitize FUSE_READLINK results for embedded NULs 2023-10-14 11:57:09 -06:00
fuse_kernel.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
fuse_main.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
fuse_node.c fusefs: correct a comment 2024-04-21 08:10:47 -06:00
fuse_node.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
fuse_vfsops.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
fuse_vnops.c fusefs: fix two bugs regarding _PC_MIN_HOLE_SIZE 2024-09-19 14:27:41 -06:00