On Sat 24/10/2026 12:46, Ian McWilliam wrote: > Hi Bjorn, > > > The 4.25.x series show errors for me when my win 10 home machine tries > to write a file. The request to find free disk space fails. > > Oct 24 12:19:47 xena smbd[88768]: [2026/10/24 12:19:47.020351, 0] > ../../source3/smbd/dfree.c:154(sys_disk_free) > Oct 24 12:19:47 xena smbd[88768]: sys_disk_free: VFS disk_free failed. > Error was : Invalid argument > > This doesn’t happen for my macOS hosts or Ubuntu hosts. > > I haven’t had the time to track down the source of the issue yet, but trying > to follow the Samba’s people rewrite of the > VFS layer in to 2021 shows it to be a nested maze of macros…. I’ll try and > pick up the debugging again next week.
I am unable to reproduce this on my Windows laptop. I suspect it may be related to VFS modules such as fruit or streams_xattr, neither of which I use anymore. Thanks for the analysis you have already done. Following the call chain you outlined helped narrow this down to a change in how the default VFS implementation obtains filesystem statistics. [0] changed vfswrap_disk_free() from pathname-based statvfs() to descriptor-based fstatvfs(). streams_xattr and some fruit stream implementations use synthetic descriptors obtained from vfs_fake_fd(). These are actually pipe descriptors, not descriptors for the underlying file. OpenBSD’s fstatfs() calls getvnode(), which explicitly returns EINVAL for a non-vnode descriptor [1], which would produce the error you are seeing. The previous pathname-based implementation avoided this because it queried the base file rather than the stream’s synthetic descriptor. Hypothesis is to use the existing metadata_fsp() helper to select the base-file handle for alternate streams. This would be needed in both vfswrap_disk_free() and vfswrap_fstatvfs(). For ordinary files and directories, metadata_fsp() returns the original handle. New diff enclosed below, which contains a patch for source3/modules/vfs_default.c. Could you test this and report back? [0] https://github.com/samba-team/samba/commit/dd95b1a503fdf42fb1ce3c71477d6e67915ba897 [1] https://github.com/openbsd/src/blob/master/sys/kern/vfs_syscalls.c#L3205-L3226 diff --git Makefile Makefile index 3f44577efcc..c9a5b3c17dc 100644 --- Makefile +++ Makefile @@ -1,4 +1,4 @@ -VERSION = 4.25.0 +VERSION = 4.25.1 DISTNAME = samba-${VERSION} EPOCH = 0 diff --git distinfo distinfo index 6a9d15ef89f..3a2a012dd89 100644 --- distinfo +++ distinfo @@ -1,2 +1,2 @@ -SHA256 (samba-4.25.0.tar.gz) = Liy3KWgzs1uPen+3YEXgxXrcDCzQMmSzffXVjkDyhDc= -SIZE (samba-4.25.0.tar.gz) = 43571277 +SHA256 (samba-4.25.1.tar.gz) = fzZ1Rbymmqlol2KPgvDwTUtms7yzbLl4ubuVLEtMQo0= +SIZE (samba-4.25.1.tar.gz) = 43590836 diff --git patches/patch-lib_util_statvfs_c patches/patch-lib_util_statvfs_c deleted file mode 100644 index 80690c8f900..00000000000 --- patches/patch-lib_util_statvfs_c +++ /dev/null @@ -1,15 +0,0 @@ -Fix a type mismatch by passing OpenBSD's native struct statfs—which contains -non-standard fields like f_iosize and f_flags—instead of POSIX struct statvfs. - -Index: lib/util/statvfs.c ---- lib/util/statvfs.c.orig -+++ lib/util/statvfs.c -@@ -79,7 +79,7 @@ static int darwin_fs_capabilities(const char * path) - - #if defined(BSD_STYLE_STATVFS) - --static void bsd_init_statvfs(const struct statvfs *src, -+static void bsd_init_statvfs(const struct statfs *src, - struct vfs_statvfs_struct *dst) - { - dst->OptimalTransferSize = src->f_iosize; diff --git patches/patch-source3_modules_vfs_default_c patches/patch-source3_modules_vfs_default_c new file mode 100644 index 00000000000..26f37af4e4b --- /dev/null +++ patches/patch-source3_modules_vfs_default_c @@ -0,0 +1,25 @@ +Some stream modules use pipe-backed fake descriptors. Query the base file's +filesystem rather than passing a fake stream descriptor to fstatfs/fstatvfs. +Ordinary file and directory handles are unchanged by metadata_fsp(). + +Index: source3/modules/vfs_default.c +--- source3/modules/vfs_default.c.orig ++++ source3/modules/vfs_default.c +@@ -126,7 +126,7 @@ static uint64_t vfswrap_disk_free(vfs_handle_struct *h + struct vfs_statvfs_struct statvfsbuf; + int fd, ret; + +- fd = fsp_get_pathref_fd(fsp); ++ fd = fsp_get_pathref_fd(metadata_fsp(fsp)); + + ret = sys_fstatvfs(fd, &statvfsbuf); + if (ret != 0) { +@@ -197,7 +197,7 @@ static int vfswrap_fstatvfs(struct vfs_handle_struct * + + START_PROFILE_X(SNUM(handle->conn), syscall_fstatvfs); + +- fd = fsp_get_pathref_fd(fsp); ++ fd = fsp_get_pathref_fd(metadata_fsp(fsp)); + + ret = sys_fstatvfs(fd, statbuf); +
