- From d1021d510c17037ad940e18b4bd4dea62f3b3479 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 16 Jul 2025 19:19:03 +0200
- Subject: [PATCH 1/4] daemon,include,sys: |FileFsAttributeInformation| should
- always get correct filesystem information
- |FileFsAttributeInformation| should always get correct filesystem information
- from the userland daemon+NFS server. This is neccesary in case of referrals,
- as the referred filesystem might have different properties and capabilities
- (i.e. NFSv4.2 filesystem mounted, and the referral is NFSv4.1, or different
- maximum name lengths etc.).
- On the ToDo list is still a per NFSv4 FSID kernel cache for filesystem
- information to avoid updowncalls into the userland daemon if the matching
- FSID was already queried.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/nfs41.h | 6 +++---
- daemon/nfs41_superblock.c | 16 +++++++++++++---
- daemon/upcall.h | 4 ++--
- include/nfs41_driver.h | 11 +++++++++++
- sys/nfs41sys_driver.h | 17 +++--------------
- sys/nfs41sys_ea.c | 4 ++--
- sys/nfs41sys_mount.c | 5 +++--
- sys/nfs41sys_openclose.c | 2 +-
- sys/nfs41sys_util.c | 2 +-
- sys/nfs41sys_volinfo.c | 37 -------------------------------------
- 10 files changed, 39 insertions(+), 65 deletions(-)
- diff --git a/daemon/nfs41.h b/daemon/nfs41.h
- index e3443e7..5eb628c 100644
- --- a/daemon/nfs41.h
- +++ b/daemon/nfs41.h
- @@ -508,10 +508,10 @@ static __inline void nfs41_superblock_supported_attrs_exclcreat(
- bitmap_intersect(attrs, &superblock->suppattr_exclcreat);
- }
- -struct _FILE_FS_ATTRIBUTE_INFORMATION;
- +struct _NFS41_FILE_FS_ATTRIBUTE_INFORMATION;
- void nfs41_superblock_fs_attributes(
- - IN const nfs41_superblock *superblock,
- - OUT struct _FILE_FS_ATTRIBUTE_INFORMATION *FsAttrs);
- + IN const nfs41_superblock *restrict superblock,
- + OUT struct _NFS41_FILE_FS_ATTRIBUTE_INFORMATION *restrict FsAttrs);
- void nfs41_superblock_space_changed(
- IN nfs41_superblock *superblock);
- diff --git a/daemon/nfs41_superblock.c b/daemon/nfs41_superblock.c
- index 8b88bc0..671b8ce 100644
- --- a/daemon/nfs41_superblock.c
- +++ b/daemon/nfs41_superblock.c
- @@ -24,10 +24,12 @@
- #include <Windows.h>
- #include <stdio.h>
- +#include "nfs41_build_features.h"
- #include "daemon_debug.h"
- #include "nfs41.h"
- #include "nfs41_ops.h"
- #include "from_kernel.h"
- +#include "nfs41_driver.h"
- #include "util.h"
- @@ -176,8 +178,8 @@ out:
- }
- void nfs41_superblock_fs_attributes(
- - IN const nfs41_superblock *superblock,
- - OUT PFILE_FS_ATTRIBUTE_INFORMATION FsAttrs)
- + IN const nfs41_superblock *restrict superblock,
- + OUT NFS41_FILE_FS_ATTRIBUTE_INFORMATION *restrict FsAttrs)
- {
- /*
- * |FileSystemAttributes| - general filesystem attributes
- @@ -212,7 +214,15 @@ void nfs41_superblock_fs_attributes(
- FsAttrs->MaximumComponentNameLength = NFS41_MAX_COMPONENT_LEN;
- /* let the driver fill in FileSystemName */
- - FsAttrs->FileSystemNameLength = 0;
- +#if ((NFS41_DRIVER_DEBUG_FS_NAME) == 1)
- + (void)wcscpy(FsAttrs->FileSystemName, L"NFS");
- + FsAttrs->FileSystemNameLength = 3*sizeof(wchar_t);
- +#elif ((NFS41_DRIVER_DEBUG_FS_NAME) == 2)
- + (void)wcscpy(FsAttrs->FileSystemName, L"DEBUG-NFS41");
- + FsAttrs->FileSystemNameLength = 11*sizeof(wchar_t);
- +#else
- +#error NFS41_DRIVER_DEBUG_FS_NAME not defined
- +#endif
- DPRINTF(SBLVL, ("FileFsAttributeInformation: "
- "link_support=%u, "
- diff --git a/daemon/upcall.h b/daemon/upcall.h
- index 05a9f40..2df7725 100644
- --- a/daemon/upcall.h
- +++ b/daemon/upcall.h
- @@ -41,7 +41,7 @@ typedef struct __mount_upcall_args {
- DWORD use_nfspubfh;
- DWORD nfsvers;
- DWORD lease_time;
- - FILE_FS_ATTRIBUTE_INFORMATION FsAttrs;
- + NFS41_FILE_FS_ATTRIBUTE_INFORMATION FsAttrs;
- } mount_upcall_args;
- typedef struct __open_upcall_args {
- @@ -181,7 +181,7 @@ typedef struct __volume_upcall_args {
- };
- #pragma warning( pop )
- FILE_FS_SIZE_INFORMATION size;
- - FILE_FS_ATTRIBUTE_INFORMATION attribute;
- + NFS41_FILE_FS_ATTRIBUTE_INFORMATION attribute;
- FILE_FS_FULL_SIZE_INFORMATION fullsize;
- FILE_FS_SECTOR_SIZE_INFORMATION sector_size;
- } info;
- diff --git a/include/nfs41_driver.h b/include/nfs41_driver.h
- index e11ebf5..31dd4c8 100644
- --- a/include/nfs41_driver.h
- +++ b/include/nfs41_driver.h
- @@ -89,6 +89,17 @@ typedef enum _nfs41_opcodes {
- NFS41_SYSOP_INVALID_OPCODE1
- } nfs41_opcodes;
- +/*
- + * Same as |FILE_FS_ATTRIBUTE_INFORMATION| but with inline buffer
- + * for 32 characters
- + */
- +typedef struct _NFS41_FILE_FS_ATTRIBUTE_INFORMATION {
- + ULONG FileSystemAttributes;
- + LONG MaximumComponentNameLength;
- + ULONG FileSystemNameLength;
- + WCHAR FileSystemName[32];
- +} NFS41_FILE_FS_ATTRIBUTE_INFORMATION;
- +
- /*
- * Symlink target path types returned by the |NFS41_SYSOP_OPEN|
- * downcall
- diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
- index a40406d..3057e25 100644
- --- a/sys/nfs41sys_driver.h
- +++ b/sys/nfs41sys_driver.h
- @@ -190,7 +190,7 @@ typedef struct _updowncall_entry {
- struct {
- PUNICODE_STRING srv_name; /* hostname, or hostname@port */
- PUNICODE_STRING root;
- - PFILE_FS_ATTRIBUTE_INFORMATION FsAttrs;
- + NFS41_FILE_FS_ATTRIBUTE_INFORMATION *FsAttrs;
- DWORD sec_flavor;
- DWORD rsize;
- DWORD wsize;
- @@ -399,22 +399,11 @@ typedef struct _NFS41_NETROOT_EXTENSION {
- (((pNetRoot) == NULL) ? NULL : \
- (PNFS41_NETROOT_EXTENSION)((pNetRoot)->Context))
- -/* FileSystemName as reported by FileFsAttributeInfo query */
- -#if ((NFS41_DRIVER_DEBUG_FS_NAME) == 1)
- -#define FS_NAME L"NFS"
- -#elif ((NFS41_DRIVER_DEBUG_FS_NAME) == 2)
- -#define FS_NAME L"DEBUG-NFS41"
- -#else
- -#error NFS41_DRIVER_DEBUG_FS_NAME not defined
- -#endif
- -#define FS_NAME_LEN (sizeof(FS_NAME) - sizeof(WCHAR))
- -#define FS_ATTR_LEN (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + FS_NAME_LEN)
- -
- typedef struct _NFS41_V_NET_ROOT_EXTENSION {
- NODE_TYPE_CODE NodeTypeCode;
- NODE_BYTE_SIZE NodeByteSize;
- HANDLE session;
- - FILE_FS_ATTRIBUTE_INFORMATION FsAttrs;
- + NFS41_FILE_FS_ATTRIBUTE_INFORMATION FsAttrs;
- DWORD sec_flavor;
- DWORD timeout;
- NFS41_MOUNT_CREATEMODE dir_createmode;
- @@ -727,7 +716,7 @@ NTSTATUS nfs41_mount(
- DWORD sec_flavor,
- PHANDLE session,
- DWORD *version,
- - PFILE_FS_ATTRIBUTE_INFORMATION FsAttrs);
- + NFS41_FILE_FS_ATTRIBUTE_INFORMATION *FsAttrs);
- void nfs41_MountConfig_InitDefaults(
- OUT PNFS41_MOUNT_CONFIG Config);
- NTSTATUS nfs41_MountConfig_ParseOptions(
- diff --git a/sys/nfs41sys_ea.c b/sys/nfs41sys_ea.c
- index f8eac28..04447e8 100644
- --- a/sys/nfs41sys_ea.c
- +++ b/sys/nfs41sys_ea.c
- @@ -284,7 +284,7 @@ NTSTATUS check_nfs41_setea_args(
- NTSTATUS status;
- __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
- NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
- - __notnull PFILE_FS_ATTRIBUTE_INFORMATION FsAttrs =
- + __notnull NFS41_FILE_FS_ATTRIBUTE_INFORMATION *FsAttrs =
- &pVNetRootContext->FsAttrs;
- __notnull PFILE_FULL_EA_INFORMATION ea =
- (PFILE_FULL_EA_INFORMATION)RxContext->Info.Buffer;
- @@ -423,7 +423,7 @@ NTSTATUS check_nfs41_queryea_args(
- NTSTATUS status;
- __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
- NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
- - __notnull PFILE_FS_ATTRIBUTE_INFORMATION FsAttrs =
- + __notnull NFS41_FILE_FS_ATTRIBUTE_INFORMATION *FsAttrs =
- &pVNetRootContext->FsAttrs;
- PFILE_GET_EA_INFORMATION ea = (PFILE_GET_EA_INFORMATION)
- RxContext->CurrentIrpSp->Parameters.QueryEa.EaList;
- diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
- index f1d57da..181faca 100644
- --- a/sys/nfs41sys_mount.c
- +++ b/sys/nfs41sys_mount.c
- @@ -162,7 +162,8 @@ void unmarshal_nfs41_mount(
- *buf += sizeof(DWORD);
- RtlCopyMemory(&cur->u.Mount.lease_time, *buf, sizeof(DWORD));
- *buf += sizeof(DWORD);
- - RtlCopyMemory(cur->u.Mount.FsAttrs, *buf, sizeof(FILE_FS_ATTRIBUTE_INFORMATION));
- + RtlCopyMemory(cur->u.Mount.FsAttrs, *buf,
- + sizeof(NFS41_FILE_FS_ATTRIBUTE_INFORMATION));
- #ifdef DEBUG_MARSHAL_DETAIL
- DbgP("unmarshal_nfs41_mount: session=0x%p version=%d lease_time "
- "%d\n",
- @@ -241,7 +242,7 @@ NTSTATUS nfs41_mount(
- DWORD sec_flavor,
- PHANDLE session,
- DWORD *version,
- - PFILE_FS_ATTRIBUTE_INFORMATION FsAttrs)
- + NFS41_FILE_FS_ATTRIBUTE_INFORMATION *FsAttrs)
- {
- NTSTATUS status = STATUS_INSUFFICIENT_RESOURCES;
- nfs41_updowncall_entry *entry = NULL;
- diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
- index a5b5284..406c1bf 100644
- --- a/sys/nfs41sys_openclose.c
- +++ b/sys/nfs41sys_openclose.c
- @@ -474,7 +474,7 @@ NTSTATUS check_nfs41_create_args(
- __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen;
- __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
- NFS41GetVNetRootExtension(SrvOpen->pVNetRoot);
- - __notnull PFILE_FS_ATTRIBUTE_INFORMATION FsAttrs =
- + __notnull NFS41_FILE_FS_ATTRIBUTE_INFORMATION *FsAttrs =
- &pVNetRootContext->FsAttrs;
- __notnull PNFS41_NETROOT_EXTENSION pNetRootContext =
- NFS41GetNetRootExtension(SrvOpen->pVNetRoot->pNetRoot);
- diff --git a/sys/nfs41sys_util.c b/sys/nfs41sys_util.c
- index e0e4e8f..b1a7589 100644
- --- a/sys/nfs41sys_util.c
- +++ b/sys/nfs41sys_util.c
- @@ -73,7 +73,7 @@ BOOLEAN isFilenameTooLong(
- PUNICODE_STRING name,
- PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext)
- {
- - PFILE_FS_ATTRIBUTE_INFORMATION attrs = &pVNetRootContext->FsAttrs;
- + NFS41_FILE_FS_ATTRIBUTE_INFORMATION *attrs = &pVNetRootContext->FsAttrs;
- LONG len = attrs->MaximumComponentNameLength, count = 1, i;
- PWCH p = name->Buffer;
- for (i = 0; i < name->Length / 2; i++) {
- diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
- index d78a3da..1b1e470 100644
- --- a/sys/nfs41sys_volinfo.c
- +++ b/sys/nfs41sys_volinfo.c
- @@ -176,31 +176,6 @@ NTSTATUS nfs41_QueryVolumeInformation(
- }
- case FileFsAttributeInformation:
- - if (RxContext->Info.LengthRemaining < FS_ATTR_LEN) {
- - RxContext->InformationToReturn = FS_ATTR_LEN;
- - status = STATUS_BUFFER_TOO_SMALL;
- - goto out;
- - }
- -
- - /* on attribute queries for the root directory,
- - * use cached volume attributes from mount */
- - if (is_root_directory(RxContext)) {
- - PFILE_FS_ATTRIBUTE_INFORMATION attrs =
- - (PFILE_FS_ATTRIBUTE_INFORMATION)RxContext->Info.Buffer;
- - DECLARE_CONST_UNICODE_STRING(FsName, FS_NAME);
- -
- - RtlCopyMemory(attrs, &pVNetRootContext->FsAttrs,
- - sizeof(pVNetRootContext->FsAttrs));
- -
- - /* fill in the FileSystemName */
- - RtlCopyMemory(attrs->FileSystemName, FsName.Buffer,
- - FsName.MaximumLength); /* 'MaximumLength' to include null */
- - attrs->FileSystemNameLength = FsName.Length;
- -
- - RxContext->Info.LengthRemaining -= FS_ATTR_LEN;
- - goto out;
- - }
- - /* else fall through and send the upcall */
- case FileFsSizeInformation:
- case FileFsFullSizeInformation:
- case FileFsSectorSizeInformation:
- @@ -232,18 +207,6 @@ NTSTATUS nfs41_QueryVolumeInformation(
- RxContext->InformationToReturn = entry->buf_len;
- status = STATUS_BUFFER_TOO_SMALL;
- } else if (entry->status == STATUS_SUCCESS) {
- - if (InfoClass == FileFsAttributeInformation) {
- - /* fill in the FileSystemName */
- - PFILE_FS_ATTRIBUTE_INFORMATION attrs =
- - (PFILE_FS_ATTRIBUTE_INFORMATION)RxContext->Info.Buffer;
- - DECLARE_CONST_UNICODE_STRING(FsName, FS_NAME);
- -
- - RtlCopyMemory(attrs->FileSystemName, FsName.Buffer,
- - FsName.MaximumLength); /* 'MaximumLength' to include null */
- - attrs->FileSystemNameLength = FsName.Length;
- -
- - entry->buf_len = FS_ATTR_LEN;
- - }
- #ifdef ENABLE_TIMINGS
- InterlockedIncrement(&volume.sops);
- InterlockedAdd64(&volume.size, entry->u.Volume.buf_len);
- --
- 2.45.1
- From 71638104825eeac6988bda823fa5b0ce1c41aab1 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 16 Jul 2025 19:34:49 +0200
- Subject: [PATCH 2/4] daemon: Increase |UPCALL_BUF_SIZE| to properly fit two
- paths for rename
- Increase |UPCALL_BUF_SIZE| to properly fit two paths for rename.
- Reported-by: Josh Hurst <joshhurst@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/nfs41_const.h | 8 +++++---
- daemon/setattr.c | 8 ++++++++
- 2 files changed, 13 insertions(+), 3 deletions(-)
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index 02e7954..8dfb99e 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -56,10 +56,12 @@
- /*
- * UPCALL_BUF_SIZE - buffer size for |DeviceIoControl()|
- - * This must fit at least twice the maximum path length
- - * (for rename) plus header
- + *
- + * Size requirements:
- + * - This must fit at least twice (for rename) the maximum path length
- + * (see |NFS41_MAX_PATH_LEN| below) plus header
- */
- -#define UPCALL_BUF_SIZE ((2*4096)+1024)
- +#define UPCALL_BUF_SIZE (16384)
- /*
- * NFS41_MAX_COMPONENT_LEN - MaximumComponentNameLength
- diff --git a/daemon/setattr.c b/daemon/setattr.c
- index dcd5c4a..e4926a4 100644
- --- a/daemon/setattr.c
- +++ b/daemon/setattr.c
- @@ -33,6 +33,14 @@
- #include "util.h"
- #include "daemon_debug.h"
- +/*
- + * |UPCALL_BUF_SIZE| must fit at least twice (for rename) the
- + * maximum path length plus header
- + */
- +#if UPCALL_BUF_SIZE < ((NFS41_MAX_PATH_LEN*2)+2048)
- +#error UPCALL_BUF_SIZE too small for rename ((NFS41_MAX_PATH_LEN*2)+2048)
- +#endif
- +
- /* NFS41_SYSOP_FILE_SET */
- static int parse_setattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
- --
- 2.45.1
- From 4440cde951371afa023052194e01072ddaa3510b Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 16 Jul 2025 21:39:11 +0200
- Subject: [PATCH 3/4] daemon: Increase worker thread default stack size to 4MB
- Increase worker thread default stack size to 4MB.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/delegation.c | 7 ++++++-
- daemon/nfs41_const.h | 2 ++
- daemon/nfs41_daemon.c | 8 ++++++--
- daemon/nfs41_session.c | 2 +-
- daemon/pnfs_io.c | 2 +-
- 5 files changed, 16 insertions(+), 5 deletions(-)
- diff --git a/daemon/delegation.c b/daemon/delegation.c
- index 2cef326..378c690 100644
- --- a/daemon/delegation.c
- +++ b/daemon/delegation.c
- @@ -754,7 +754,12 @@ int nfs41_delegation_recall(
- args->truncate = truncate;
- /* the callback thread can't make rpc calls, so spawn a separate thread */
- - if (_beginthreadex(NULL, 0, delegation_recall_thread, args, 0, NULL) == 0) {
- + if (_beginthreadex(NULL,
- + NFSD_THREAD_STACK_SIZE,
- + delegation_recall_thread,
- + args,
- + 0,
- + NULL) == 0) {
- status = NFS4ERR_SERVERFAULT;
- eprintf("nfs41_delegation_recall() failed to start thread\n");
- goto out_args;
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index 8dfb99e..108d6ed 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -36,6 +36,8 @@
- #define NFS4_EASIZE 2048
- #define NFS4_EANAME_SIZE 128
- +#define NFSD_THREAD_STACK_SIZE (4*1024*1024)
- +
- /* Maximum number of AUP GIDs for |AUTH_UNIX| */
- #define RPC_AUTHUNIX_AUP_MAX_NUM_GIDS 16
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index f8d62d5..12d18b0 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -878,8 +878,12 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- DPRINTF(1, ("Starting %d worker threads...\n",
- (int)nfs41_dg.num_worker_threads));
- for (i = 0; i < nfs41_dg.num_worker_threads; i++) {
- - tids[i].handle = (HANDLE)_beginthreadex(NULL, 0, nfsd_thread_main,
- - &nfs41_dg, 0, &tids[i].tid);
- + tids[i].handle = (HANDLE)_beginthreadex(NULL,
- + NFSD_THREAD_STACK_SIZE,
- + nfsd_thread_main,
- + &nfs41_dg,
- + 0,
- + &tids[i].tid);
- if (tids[i].handle == INVALID_HANDLE_VALUE) {
- status = GetLastError();
- eprintf("_beginthreadex failed %d\n", status);
- diff --git a/daemon/nfs41_session.c b/daemon/nfs41_session.c
- index 57dc186..b199138 100644
- --- a/daemon/nfs41_session.c
- +++ b/daemon/nfs41_session.c
- @@ -420,7 +420,7 @@ int nfs41_session_set_lease(
- goto out;
- }
- session->renew.thread_handle = (HANDLE)_beginthreadex(NULL,
- - 0, renew_session_thread, session, 0, &thread_id);
- + NFSD_THREAD_STACK_SIZE, renew_session_thread, session, 0, &thread_id);
- if (!valid_handle(session->renew.thread_handle)) {
- status = GetLastError();
- eprintf("nfs41_session_set_lease: _beginthreadex() failed %d\n",
- diff --git a/daemon/pnfs_io.c b/daemon/pnfs_io.c
- index 54eb479..51225f3 100644
- --- a/daemon/pnfs_io.c
- +++ b/daemon/pnfs_io.c
- @@ -409,7 +409,7 @@ static enum pnfs_status pattern_fork(
- }
- for (i = 0; i < pattern->count; i++) {
- - threads[i] = (HANDLE)_beginthreadex(NULL, 0,
- + threads[i] = (HANDLE)_beginthreadex(NULL, NFSD_THREAD_STACK_SIZE,
- thread_fn, &pattern->threads[i], 0, NULL);
- if (threads[i] == NULL) {
- eprintf("_beginthreadex() failed with %d\n", GetLastError());
- --
- 2.45.1
- From 58b73d4526815f40cd497eed3865b673f55a0cb2 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 16 Jul 2025 22:15:21 +0200
- Subject: [PATCH 4/4] daemon: Increase maximum number of ACE entries in an ACL
- to 128
- Increase maximum number of ACE entries in an ACL to 128, to handle
- enterprise users which use many ACEs.
- Reported-by: Lionel Cons <lionelcons1972@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/lookup.c | 4 ++--
- daemon/nfs41_const.h | 19 +++++++++++++++++--
- daemon/nfs41_ops.c | 34 +++++++++++++++++-----------------
- daemon/nfs41_types.h | 2 +-
- daemon/nfs41_xdr.c | 14 ++++++++++----
- daemon/nfs42_ops.c | 6 +++---
- daemon/sid.c | 2 +-
- 7 files changed, 51 insertions(+), 30 deletions(-)
- diff --git a/daemon/lookup.c b/daemon/lookup.c
- index 45c8646..9d9cae4 100644
- --- a/daemon/lookup.c
- +++ b/daemon/lookup.c
- @@ -112,7 +112,7 @@ static void init_component_args(
- res->root.path = path;
- res->getrootfh.fh = &res->root.fh;
- res->getrootattr.info = &res->rootinfo;
- - res->getrootattr.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + res->getrootattr.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- res->referral = referral;
- for (i = 0; i < MAX_LOOKUP_COMPONENTS; i++) {
- @@ -121,7 +121,7 @@ static void init_component_args(
- args->lookup[i].name = &res->file[i].name;
- res->getfh[i].fh = &res->file[i].fh;
- res->getattr[i].info = &res->info[i];
- - res->getattr[i].obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + res->getattr[i].obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- }
- }
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index 108d6ed..524dd30 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -31,6 +31,15 @@
- #define NFS4_FHSIZE 128
- #define NFS4_VERIFIER_SIZE 8
- #define NFS4_OPAQUE_LIMIT 1024
- +/*
- + * |NFS4_OPAQUE_LIMIT_ATTR| for getattr/setattr
- + *
- + * Notes:
- + * - larger values consume more stack, a value of 8192 triggers a stack
- + * consumption which will not fit into the Win32 default stack size of 1MB
- + *
- + */
- +#define NFS4_OPAQUE_LIMIT_ATTR (8192)
- #define NFS4_SESSIONID_SIZE 16
- #define NFS4_STATEID_OTHER 12
- #define NFS4_EASIZE 2048
- @@ -50,8 +59,13 @@
- */
- #define NFS4_FATTR4_OWNER_LIMIT (256)
- -/* Maximum number of ACLs per file/dir */
- -#define NFS41_ACL_MAX_ACE_ENTRIES (32)
- +/*
- + * |NFS41_ACL_MAX_ACE_ENTRIES| - Maximum number of ACLs per file/dir
- + *
- + * This value is limited by |UPCALL_BUF_SIZE| and |NFS4_OPAQUE_LIMIT_ATTR|,
- + * a bigger value requirs adjustments of both variables
- + */
- +#define NFS41_ACL_MAX_ACE_ENTRIES (128)
- #define NFS41_MAX_SERVER_CACHE 1024
- #define NFS41_MAX_RPC_REQS 128
- @@ -62,6 +76,7 @@
- * Size requirements:
- * - This must fit at least twice (for rename) the maximum path length
- * (see |NFS41_MAX_PATH_LEN| below) plus header
- + * - This must fit at least |NFS41_ACL_MAX_ACE_ENTRIES| ACE entries
- */
- #define UPCALL_BUF_SIZE (16384)
- diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
- index 0d1f0c5..8cb5aad 100644
- --- a/daemon/nfs41_ops.c
- +++ b/daemon/nfs41_ops.c
- @@ -557,7 +557,7 @@ int nfs41_open(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = info;
- if (current_fh_is_dir) {
- @@ -570,7 +570,7 @@ int nfs41_open(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &pgetattr_res);
- getattr_args.attr_request = &attr_request;
- - pgetattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + pgetattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- pgetattr_res.info = &dir_info;
- status = compound_encode_send_decode(session, &compound, try_recovery);
- @@ -658,14 +658,14 @@ int nfs41_create(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = info;
- compound_add_op(&compound, OP_RESTOREFH, NULL, &restorefh_res);
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &pgetattr_res);
- getattr_args.attr_request = &attr_request;
- - pgetattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + pgetattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- pgetattr_res.info = &dir_info;
- status = compound_encode_send_decode(session, &compound, TRUE);
- @@ -734,7 +734,7 @@ int nfs41_close(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = &info;
- status = compound_encode_send_decode(session, &compound, TRUE);
- @@ -816,7 +816,7 @@ int nfs41_write(
- * the attribute cache, so we do the GETATTR here */
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = pinfo;
- }
- @@ -959,7 +959,7 @@ int nfs41_commit(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = pinfo;
- }
- @@ -1181,7 +1181,7 @@ int nfs41_getattr(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = info;
- status = compound_encode_send_decode(session, &compound, TRUE);
- @@ -1233,7 +1233,7 @@ int nfs41_superblock_getattr(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = info;
- compound_add_op(&compound, OP_OPENATTR, &openattr_args, &openattr_res);
- @@ -1310,7 +1310,7 @@ int nfs41_remove(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = &info;
- status = compound_encode_send_decode(session, &compound, TRUE);
- @@ -1389,13 +1389,13 @@ int nfs41_rename(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &dst_getattr_res);
- getattr_args.attr_request = &attr_request;
- - dst_getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + dst_getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- dst_getattr_res.info = &dst_info;
- compound_add_op(&compound, OP_RESTOREFH, NULL, &restorefh_res);
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &src_getattr_res);
- - src_getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + src_getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- src_getattr_res.info = &src_info;
- status = compound_encode_send_decode(session, &compound, TRUE);
- @@ -1502,7 +1502,7 @@ int nfs41_setattr(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = info;
- status = compound_encode_send_decode(session, &compound, TRUE);
- @@ -1583,7 +1583,7 @@ int nfs41_link(
- /* GETATTR(dst_dir) */
- compound_add_op(&compound, OP_GETATTR, &getattr_args[0], &getattr_res[0]);
- getattr_args[0].attr_request = &info.attrmask;
- - getattr_res[0].obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res[0].obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res[0].info = &info;
- /* LOOKUP(target) */
- @@ -1593,7 +1593,7 @@ int nfs41_link(
- /* GETATTR(target) */
- compound_add_op(&compound, OP_GETATTR, &getattr_args[1], &getattr_res[1]);
- getattr_args[1].attr_request = &cinfo->attrmask;
- - getattr_res[1].obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res[1].obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res[1].info = cinfo;
- /* GETFH(target) */
- @@ -1901,7 +1901,7 @@ enum nfsstat4 nfs41_fs_locations(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- info.fs_locations = locations;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = &info;
- status = compound_encode_send_decode(session, &compound, TRUE);
- @@ -2189,7 +2189,7 @@ enum nfsstat4 pnfs_rpc_layoutcommit(
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = info;
- status = compound_encode_send_decode(session, &compound, TRUE);
- diff --git a/daemon/nfs41_types.h b/daemon/nfs41_types.h
- index 8501674..fe54f3a 100644
- --- a/daemon/nfs41_types.h
- +++ b/daemon/nfs41_types.h
- @@ -153,7 +153,7 @@ typedef struct __open_delegation4 {
- typedef struct __fattr4 {
- bitmap4 attrmask;
- uint32_t attr_vals_len;
- - unsigned char attr_vals[NFS4_OPAQUE_LIMIT];
- + unsigned char attr_vals[NFS4_OPAQUE_LIMIT_ATTR];
- } fattr4;
- typedef struct __change_info4 {
- diff --git a/daemon/nfs41_xdr.c b/daemon/nfs41_xdr.c
- index 4b7eacb..4a4d8b1 100644
- --- a/daemon/nfs41_xdr.c
- +++ b/daemon/nfs41_xdr.c
- @@ -154,7 +154,10 @@ bool_t xdr_fattr4(
- if (!xdr_bitmap4(xdr, &fattr->attrmask))
- return FALSE;
- - return xdr_bytes(xdr, (char **)&attr_vals, &fattr->attr_vals_len, NFS4_OPAQUE_LIMIT);
- + return xdr_bytes(xdr,
- + (char **)&attr_vals,
- + &fattr->attr_vals_len,
- + NFS4_OPAQUE_LIMIT_ATTR);
- }
- /* nfs41_fh */
- @@ -1375,7 +1378,7 @@ static bool_t encode_createattrs4(
- fattr4 attrs;
- /* encode attribute values from createattrs->info into attrs.attr_vals */
- - attrs.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + attrs.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- if (!encode_file_attrs(&attrs, createattrs))
- return FALSE;
- @@ -2652,7 +2655,10 @@ static bool_t encode_file_attrs(
- uint32_t i;
- XDR localxdr;
- - xdrmem_create(&localxdr, (char *)attrs->attr_vals, NFS4_OPAQUE_LIMIT, XDR_ENCODE);
- + xdrmem_create(&localxdr,
- + (char *)attrs->attr_vals,
- + NFS4_OPAQUE_LIMIT_ATTR,
- + XDR_ENCODE);
- attrs->attr_vals_len = 0;
- bitmap4_clear(&attrs->attrmask);
- @@ -2758,7 +2764,7 @@ static bool_t encode_op_setattr(
- return FALSE;
- /* encode attribute values from args->info into attrs.attr_vals */
- - attrs.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + attrs.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- if (!encode_file_attrs(&attrs, args->info))
- return FALSE;
- diff --git a/daemon/nfs42_ops.c b/daemon/nfs42_ops.c
- index dc5a769..4c6a35c 100644
- --- a/daemon/nfs42_ops.c
- +++ b/daemon/nfs42_ops.c
- @@ -92,7 +92,7 @@ int nfs42_allocate(
- */
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = pinfo;
- status = compound_encode_send_decode(session, &compound, TRUE);
- @@ -171,7 +171,7 @@ int nfs42_deallocate(
- */
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = pinfo;
- status = compound_encode_send_decode(session, &compound, TRUE);
- @@ -374,7 +374,7 @@ int nfs42_clone(
- */
- compound_add_op(&compound, OP_GETATTR, &getattr_args, &getattr_res);
- getattr_args.attr_request = &attr_request;
- - getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT;
- + getattr_res.obj_attributes.attr_vals_len = NFS4_OPAQUE_LIMIT_ATTR;
- getattr_res.info = pinfo;
- status = compound_encode_send_decode(session, &compound, TRUE);
- diff --git a/daemon/sid.c b/daemon/sid.c
- index 9e0e356..afd2ee3 100644
- --- a/daemon/sid.c
- +++ b/daemon/sid.c
- @@ -226,7 +226,7 @@ bool unixgroup_sid2gid(PSID psid, gid_t *pgid)
- * owner_group, other, nobody, world, ... } entries multiplied by two to
- * make sure two concurrent icacls queries cannot trash the whole cache
- */
- -#define SIDCACHE_SIZE 128
- +#define SIDCACHE_SIZE 384
- #define SIDCACHE_TTL 600
- /* Safety/performance checks */
- --
- 2.45.1
msnfs41client: Patches for |FileFsAttributeInformation|, increased worker stack size, fixed rename with long paths, maxACEperACL increase to 128, 2025-07-16
Posted by Anonymous on Wed 16th Jul 2025 21:54
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.