- From 289a91ebd716c4f1296a7ed2b5430c3a6d5be31a Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Fri, 9 Jan 2026 14:30:09 +0100
- Subject: [PATCH 1/5] daemon: Add missing include file for
- |nfs41_delegation_return()|
- Add missing include file for |nfs41_delegation_return()|.
- Reported-by: Cedric Blancher <cedric.blancher@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/fsctl.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
- diff --git a/daemon/fsctl.c b/daemon/fsctl.c
- index 7d25a90..2044e9f 100644
- --- a/daemon/fsctl.c
- +++ b/daemon/fsctl.c
- @@ -1,5 +1,5 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2024-2025 Roland Mainz <roland.mainz@nrubsig.org>
- + * Copyright (C) 2024-2026 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Roland Mainz <roland.mainz@nrubsig.org>
- *
- @@ -22,6 +22,7 @@
- #include <stdio.h>
- #include "nfs41_ops.h"
- +#include "delegation.h"
- #include "name_cache.h"
- #include "upcall.h"
- #include "daemon_debug.h"
- --
- 2.51.0
- From 56d7e76133edcd497d0ba98938b9ed0a0084dbad Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Fri, 9 Jan 2026 16:40:43 +0100
- Subject: [PATCH 2/5] tests: lsparse should have options for start offset and
- number of bytes to scan
- lsparse should have options for start offset and number of bytes
- to scan.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/lssparse/lssparse.c | 32 ++++++++++++++++++++++++++++++--
- 1 file changed, 30 insertions(+), 2 deletions(-)
- diff --git a/tests/lssparse/lssparse.c b/tests/lssparse/lssparse.c
- index 5c56a4d..81cd1f2 100644
- --- a/tests/lssparse/lssparse.c
- +++ b/tests/lssparse/lssparse.c
- @@ -39,6 +39,7 @@
- #include <string.h>
- #include <fcntl.h>
- #include <unistd.h>
- +#include <limits.h>
- #include <errno.h>
- #define EXIT_USAGE (2) /* Traditional UNIX exit code for usage */
- @@ -47,8 +48,12 @@ static
- void
- usage(const char *progname)
- {
- - (void) fprintf(stderr, "Usage: %s [-h] [-xdH] <sparse_file>\n"
- + (void) fprintf(stderr,
- + "Usage: %s [-h] [-s startoffset] [-n len] [xdH] "
- + "<sparse_file>\n"
- " -h: Display this help message\n"
- + " -s: Start offset in file\n"
- + " -n: Number of file bytes to scan\n"
- " -x: Print offsets in hexadecimal (base 16)\n"
- " -d: Print offsets in decimal (base 10)\n"
- " -H: Print hole information\n",
- @@ -65,6 +70,9 @@ main(int argc, char *argv[])
- {
- /* Arguments */
- const char *progname = argv[0];
- + off_t start_offset = 0LL;
- + off_t end_offset = LLONG_MIN;
- + off_t max_scan_len = -1LL;
- printbase pb = pb_hex;
- bool print_holes = false;
- const char *filename;
- @@ -82,12 +90,18 @@ main(int argc, char *argv[])
- off_t data_len;
- off_t hole_len;
- - while ((opt = getopt(argc, argv, "hxdH")) != -1) {
- + while ((opt = getopt(argc, argv, "hs:n:xdH")) != -1) {
- switch (opt) {
- case '?':
- case 'h':
- usage(progname);
- return (EXIT_USAGE);
- + case 's':
- + start_offset = atoll(optarg);
- + break;
- + case 'n':
- + max_scan_len = atoll(optarg);
- + break;
- case 'x':
- pb = pb_hex;
- break;
- @@ -127,6 +141,15 @@ main(int argc, char *argv[])
- }
- (void) lseek(fd, 0, SEEK_SET);
- + if (start_offset > 0LL) {
- + offset = start_offset;
- + (void) printf("# ... starting at offset %lld\n",
- + (long long)offset);
- + }
- +
- + if (max_scan_len > 0LL) {
- + end_offset = start_offset + max_scan_len;
- + }
- /*
- * Loop over hole&&data sections
- @@ -223,6 +246,11 @@ main(int argc, char *argv[])
- }
- offset = hole_end;
- +
- + if ((max_scan_len != -1LL) && (offset >= end_offset)) {
- + (void) printf("# ... stopping at offset %lld\n",
- + (long long)offset);
- + }
- }
- if ((data_start == -1) && (errno == ENXIO) && (offset == 0)) {
- --
- 2.51.0
- From 61785b02157abef3c19e52b083d0ee06a26b78e2 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Fri, 9 Jan 2026 16:45:33 +0100
- Subject: [PATCH 3/5] tests: Fix Solaris/Illumos cstyle issues in lssparse.c
- Fix Solaris/Illumos cstyle issues in lssparse.c.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/lssparse/lssparse.c | 49 +++++++++++++++++++++------------------
- 1 file changed, 26 insertions(+), 23 deletions(-)
- diff --git a/tests/lssparse/lssparse.c b/tests/lssparse/lssparse.c
- index 81cd1f2..920d972 100644
- --- a/tests/lssparse/lssparse.c
- +++ b/tests/lssparse/lssparse.c
- @@ -42,7 +42,7 @@
- #include <limits.h>
- #include <errno.h>
- -#define EXIT_USAGE (2) /* Traditional UNIX exit code for usage */
- +#define EXIT_USAGE (2) /* Traditional UNIX exit code for usage */
- static
- void
- @@ -61,8 +61,8 @@ usage(const char *progname)
- }
- typedef enum _printbase {
- - pb_hex = 1,
- - pb_dec = 2
- + pb_hex = 1,
- + pb_dec = 2
- } printbase;
- int
- @@ -222,30 +222,33 @@ main(int argc, char *argv[])
- if (errno == ENXIO) {
- /* No more holes ? */
- hole_end = file_size;
- - } else {
- - (void) fprintf(stderr,
- - "%s: "
- - "lseek(..., SEEK_DATA, ...) failed with [%s]\n",
- - progname,
- - strerror(errno));
- - retval = EXIT_FAILURE;
- - goto done;
- + } else {
- + (void) fprintf(stderr,
- + "%s: "
- + "lseek(..., SEEK_DATA, ...) "
- + "failed with [%s]\n",
- + progname,
- + strerror(errno));
- + retval = EXIT_FAILURE;
- + goto done;
- + }
- }
- - }
- - hole_len = hole_end - hole_start;
- + hole_len = hole_end - hole_start;
- - if (print_holes && (hole_len > 0LL)) {
- - (void) printf((pb == pb_hex)?
- - "Hole range[%ld]: offset=0x%llx,\tlength=0x%llx\n":
- - "Hole range[%ld]: offset=%lld,\tlength=%lld\n",
- - (long)i,
- - (long long)hole_start,
- - (long long)hole_len);
- - i++;
- - }
- + if (print_holes && (hole_len > 0LL)) {
- + (void) printf((pb == pb_hex)?
- + "Hole range[%ld]: "
- + "offset=0x%llx,\tlength=0x%llx\n":
- + "Hole range[%ld]: "
- + "offset=%lld,\tlength=%lld\n",
- + (long)i,
- + (long long)hole_start,
- + (long long)hole_len);
- + i++;
- + }
- - offset = hole_end;
- + offset = hole_end;
- if ((max_scan_len != -1LL) && (offset >= end_offset)) {
- (void) printf("# ... stopping at offset %lld\n",
- --
- 2.51.0
- From 10e087ce4624dcde84cf00811bf51344621943c1 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Fri, 9 Jan 2026 17:27:38 +0100
- Subject: [PATCH 4/5] README.md,docs: Remove comment about
- |FSCTL_QUERY_ALLOCATED_RANGES| bug which has long been resolved
- Remove comment about |FSCTL_QUERY_ALLOCATED_RANGES| bug which has long been resolved.
- Reported-by: Lionel Cons <lionelcons1972@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- README.md | 4 +---
- docs/README.xml | 2 +-
- 2 files changed, 2 insertions(+), 4 deletions(-)
- diff --git a/README.md b/README.md
- index 5e9f717..fcbb185 100644
- --- a/README.md
- +++ b/README.md
- @@ -131,9 +131,7 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11 & Windows Server
- `$ /usr/bin/cp --sparse=auto src dest #`
- - `/cygdrive/c/Windows/system32/fsutil sparse queryrange myfile.dat`
- - can be used to enumerate ranges where data are allocated (BUG:
- - Win10+Win11 fsutil only support 64 data ranges, the filesystem
- - itself supports an unlimited number of data ranges)
- + can be used to enumerate ranges where data are allocated
- - `/cygdrive/c/Windows/system32/xcopy /sparse` can be used to copy
- sparse files+sparse named streams. Requires on Win11 \>= 22H2
- diff --git a/docs/README.xml b/docs/README.xml
- index 541cef7..b21e85f 100644
- --- a/docs/README.xml
- +++ b/docs/README.xml
- @@ -133,7 +133,7 @@
- <para>Cygwin sparse file support requires >= Cygwin 3.6 to support POSIX-1.2024 <literal>|lseek(...,SEEK_HOLE/SEEK_DATA,...)|</literal>, which is needed for coreutils <filename>/usr/bin/fallocate</filename> and <command>$ /usr/bin/cp --sparse=auto src dest #</command></para>
- </listitem>
- <listitem>
- - <para><filename>/cygdrive/c/Windows/system32/fsutil sparse queryrange myfile.dat</filename> can be used to enumerate ranges where data are allocated (BUG: Win10+Win11 fsutil only support 64 data ranges, the filesystem itself supports an unlimited number of data ranges)</para>
- + <para><filename>/cygdrive/c/Windows/system32/fsutil sparse queryrange myfile.dat</filename> can be used to enumerate ranges where data are allocated</para>
- </listitem>
- <listitem>
- <para><filename>/cygdrive/c/Windows/system32/xcopy /sparse</filename> can be used to copy sparse files+sparse named streams. Requires on Win11 >= 22H2 because it relies on <literal>|CopyFile2()|</literal> flag <literal>|COPY_FILE_ENABLE_SPARSE_COPY|</literal>.</para>
- --
- 2.51.0
- From ab947a04f8b03c2b9b1846fe6b1c6cddfb2b8209 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Fri, 9 Jan 2026 19:11:22 +0100
- Subject: [PATCH 5/5] daemon,nfs41_build_features.h: Add TEMPORARY workaround
- for FreeBSD 15.0 bug which prevents file/dir creation
- MIME-Version: 1.0
- Content-Type: text/plain; charset=UTF-8
- Content-Transfer-Encoding: 8bit
- Add a TEMPORARY workaround for the FreeBSD 15.0 bug which prevents file/dir
- creation when using the FreeBSD nfsd.
- See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292283 ("[Bug 292283]
- (JAVA) NFSv4.1 client trying to set FATTR4_SYSTEM or FATTR4_HIDDEN gets
- EPERM for file and dir creation attemps").
- This WORKAROUND is intended to be TEMPORARY and should be removed
- as soon as a FreeBSD 15.x release with a fix for FreeBSD bug #292283
- becomes available.
- Reported-by: Aurélien Couderc <aurelien.couderc2002@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/open.c | 47 +++++++++++++++++++++++++++++++++++++++++-
- nfs41_build_features.h | 13 ++++++++++++
- 2 files changed, 59 insertions(+), 1 deletion(-)
- diff --git a/daemon/open.c b/daemon/open.c
- index 585245c..17c89b6 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -824,6 +824,37 @@ out:
- }
- #endif /* NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES */
- +#ifdef WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283
- +void set_hiddensystem_attrs(ULONG file_attrs, nfs41_open_state *state)
- +{
- + int status;
- + stateid_arg stateid;
- +
- + if ((file_attrs & (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)) == 0)
- + return;
- +
- + nfs41_file_info createattrs = {
- + .attrmask.count = 2,
- + .attrmask.arr[0] = FATTR4_WORD0_HIDDEN,
- + .attrmask.arr[1] = FATTR4_WORD1_SYSTEM,
- + .hidden = ((file_attrs & FILE_ATTRIBUTE_HIDDEN) ? 1 : 0),
- + .system = ((file_attrs & FILE_ATTRIBUTE_SYSTEM) ? 1 : 0),
- + };
- +
- + nfs41_open_stateid_arg(state, &stateid);
- + status = nfs41_setattr(state->session,
- + &state->file, &stateid, &createattrs);
- +
- + if (status && (status != NFS4ERR_ATTRNOTSUPP)) {
- + eprintf("set_hiddensystem_attrs(state->file.name.name='%s'): "
- + "nfs41_setattr() "
- + "failed with error '%s'.\n",
- + state->file.name.name,
- + nfs_error_string(status));
- + }
- +}
- +#endif /* WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283 */
- +
- static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- {
- int status = 0;
- @@ -1164,6 +1195,9 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- upcall->currentthread_token,
- state);
- #endif /* NFS41_DRIVER_SETGID_NEWGRP_SUPPORT */
- +#ifdef WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283
- + set_hiddensystem_attrs(args->file_attrs, state);
- +#endif /* WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283 */
- nfs_to_basic_info(state->file.name.name,
- state->file.fh.superblock,
- @@ -1224,12 +1258,19 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
- args->mode = info.mode;
- }
- createattrs.attrmask.count = 2;
- +#ifdef WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283
- + createattrs.attrmask.arr[0] = FATTR4_WORD0_ARCHIVE;
- + createattrs.attrmask.arr[1] = FATTR4_WORD1_MODE;
- + createattrs.mode = args->mode;
- + createattrs.archive = args->file_attrs & FILE_ATTRIBUTE_ARCHIVE ? 1 : 0;
- +#else
- createattrs.attrmask.arr[0] = FATTR4_WORD0_HIDDEN | FATTR4_WORD0_ARCHIVE;
- createattrs.attrmask.arr[1] = FATTR4_WORD1_MODE | FATTR4_WORD1_SYSTEM;
- createattrs.mode = args->mode;
- createattrs.hidden = args->file_attrs & FILE_ATTRIBUTE_HIDDEN ? 1 : 0;
- createattrs.system = args->file_attrs & FILE_ATTRIBUTE_SYSTEM ? 1 : 0;
- createattrs.archive = args->file_attrs & FILE_ATTRIBUTE_ARCHIVE ? 1 : 0;
- +#endif /* WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283 */
- #ifdef NFS41_DRIVER_ALLOW_CREATEFILE_ACLS
- if (create_nfs4_acl.aces) {
- createattrs.acl = &create_nfs4_acl;
- @@ -1322,7 +1363,11 @@ supersede_retry:
- state);
- }
- #endif /* NFS41_DRIVER_SETGID_NEWGRP_SUPPORT */
- -
- +#ifdef WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283
- + if (create == OPEN4_CREATE) {
- + set_hiddensystem_attrs(args->file_attrs, state);
- + }
- +#endif /* WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283 */
- nfs_to_basic_info(state->file.name.name,
- state->file.fh.superblock,
- &info,
- diff --git a/nfs41_build_features.h b/nfs41_build_features.h
- index 227008f..4ebe0d2 100644
- --- a/nfs41_build_features.h
- +++ b/nfs41_build_features.h
- @@ -279,4 +279,17 @@
- */
- #define NFS41_WINSTREAMS_SUPPORT 1
- +/*
- + * |WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283| - workaround
- + * for FreeBSD bug#292283 which causes file/dir creation to fail with |EPERM|
- + * if |FATTR4_SYSTEM| or |FATTR4_HIDDEN| attributes are provided to a FreeBSD
- + * 15.0 NFS server
- + *
- + * This workaround will be REMOVED as soon as FreeBSD 15.1 or a fixed kernel
- + * for FreeBSD 15.0 is available.
- + *
- + *
- + */
- +#define WORKAROUND_FOR_FREEBSD15_0_CREATIONFAILSWITHEPERM_BUG292283 1
- +
- #endif /* !_NFS41_DRIVER_BUILDFEATURES_ */
- --
- 2.51.0
msnfs41client: Patch for FreeBSD15.0-file/dir-creation-EPERM-bug-workaround, lssparse update, docs, tests+misc, 2026-01-09
Posted by Anonymous on Fri 9th Jan 2026 18:27
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
rovema.kpaste.net RSS