- From 0f4d97192a351e0c925284be767ed09bd6745eb2 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Fri, 12 Jan 2024 14:04:51 +0100
- Subject: [PATCH 1/7] daemon: Remove owner/owner_group |EASSERT()| for new
- files
- Remove owner/owner_group |EASSERT()| for new files in |copy_attrs()|,
- this is no longer needed.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/name_cache.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index 656e8ab..d7036a8 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -350,7 +350,7 @@ static void copy_attrs(
- dst->type = src->type;
- dst->numlinks = src->numlinks;
- dst->mode = src->mode;
- - EASSERT(src->owner[0] != '\0');
- +
- if (src->owner[0] != '\0') {
- dst->owner = dst->owner_buf;
- (void)strcpy(dst->owner, src->owner);
- @@ -359,7 +359,7 @@ static void copy_attrs(
- /* this should only happen for newly created files/dirs */
- dst->owner = NULL;
- }
- - EASSERT(src->owner_group[0] != '\0');
- +
- if (src->owner_group[0] != '\0') {
- dst->owner_group = dst->owner_group_buf;
- (void)strcpy(dst->owner_group, src->owner_group);
- --
- 2.43.0
- From bdfa9c78bf904495948bbc942d4eba16f3d2e943 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Fri, 12 Jan 2024 16:46:04 +0100
- Subject: [PATCH 2/7] daemon: Increase |MAX_PUTFH_PER_COMPOUND| to |64|
- Increase the value of |MAX_PUTFH_PER_COMPOUND| from |16| to |64|
- for better performance.
- Notes:
- - the real value is negotiated between NFSv4.1 server and
- client, |MAX_PUTFH_PER_COMPOUND| is the maximum value we support on
- our side.
- - Linux nfsd uses |#define NFSD_MAX_OPS_PER_COMPOUND 50| in
- linux-6.7/fs/nfsd/nfsd.h, Solaris/Illumos nfsd uses up to
- |2048| (see also https://bugzilla.kernel.org/show_bug.cgi?id=216383#c0)
- and nfs4j JAVA NFSv4 server uses |8192|.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/name_cache.c | 17 ++++++++++++++++-
- daemon/nfs41.h | 10 +++++++---
- 2 files changed, 23 insertions(+), 4 deletions(-)
- diff --git a/daemon/name_cache.c b/daemon/name_cache.c
- index d7036a8..877b6b6 100644
- --- a/daemon/name_cache.c
- +++ b/daemon/name_cache.c
- @@ -1259,7 +1259,22 @@ out_unlock:
- /* nfs41_name_cache_resolve_fh() */
- -#define MAX_PUTFH_PER_COMPOUND 16
- +/*
- + * MAX_PUTFH_PER_COMPOUND
- + *
- + * The maximum is negotiated with with the NFSv4 server (follow
- + * |max_putfh_components()| below and |NFS41_MAX_OPS_PER_COMPOUND|
- + * in daemon/nfs41.h).
- + *
- + * Linux nfsd uses |#define NFSD_MAX_OPS_PER_COMPOUND 50| in
- + * linux-6.7/fs/nfsd/nfsd.h, Solaris/Illumos nfsd uses up to
- + * |2048| (see also https://bugzilla.kernel.org/show_bug.cgi?id=216383#c0)
- + * and nfs4j JAVA NFSv4 server uses |8192|.
- + *
- + * Since bigger values eat more stack we set this to
- + * |64| for now.
- + */
- +#define MAX_PUTFH_PER_COMPOUND 64
- static bool_t get_path_fhs(
- IN struct nfs41_name_cache *cache,
- diff --git a/daemon/nfs41.h b/daemon/nfs41.h
- index 245a625..c8216dd 100644
- --- a/daemon/nfs41.h
- +++ b/daemon/nfs41.h
- @@ -235,9 +235,13 @@ typedef struct __nfs41_slot_table {
- * trouble with |signed int| vs. |unisgned int|, and NFSv4.x
- * server implementations might want to allocate static buffers
- * based on what we return.
- - * Linux uses |#define NFSD_MAX_OPS_PER_COMPOUND 50| in
- - * linux-6.7/fs/nfsd/nfsd.h and Solaris uses a much higher value
- - * (see also https://bugzilla.kernel.org/show_bug.cgi?id=216383#c0).
- + *
- + * Linux nfsd uses |#define NFSD_MAX_OPS_PER_COMPOUND 50| in
- + * linux-6.7/fs/nfsd/nfsd.h, Solaris/Illumos nfsd uses up to
- + * |2048| (see also https://bugzilla.kernel.org/show_bug.cgi?id=216383#c0)
- + * and nfs4j JAVA NFSv4 server uses |8192|.
- + *
- + * See also |MAX_PUTFH_PER_COMPOUND| in daemon/name_cache.c
- */
- #define NFS41_MAX_OPS_PER_COMPOUND 16384
- typedef struct __nfs41_channel_attrs {
- --
- 2.43.0
- From c17ab40bc36e05f159f5efbf774c0dd09095e581 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Fri, 12 Jan 2024 17:01:48 +0100
- Subject: [PATCH 3/7] daemon: Disable "ASSERTION 'length > 0'" for UNMOUNT
- Disable 'length > 0' |EASSERT()| for UNMOUNT, as this upcall
- has no payload.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/upcall.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
- diff --git a/daemon/upcall.c b/daemon/upcall.c
- index 7fa98ef..c1b58bd 100644
- --- a/daemon/upcall.c
- +++ b/daemon/upcall.c
- @@ -25,6 +25,7 @@
- #include "nfs41_build_features.h"
- #include "upcall.h"
- +#include "nfs41_driver.h" /* only for |NFS41_UNMOUNT| */
- #include "daemon_debug.h"
- #include "util.h"
- @@ -122,7 +123,10 @@ int upcall_parse(
- /* parse the operation's arguments */
- op = g_upcall_op_table[upcall->opcode];
- if (op && op->parse) {
- - EASSERT(length > 0);
- + /* |NFS41_UNMOUNT| has 0 payload */
- + if (upcall->opcode != NFS41_UNMOUNT) {
- + EASSERT(length > 0);
- + }
- status = op->parse(buffer, length, upcall);
- if (status) {
- eprintf("parsing of upcall '%s' failed with %d.\n",
- --
- 2.43.0
- From b306de5bb93123aff74d144d2693b3013c12537b Mon Sep 17 00:00:00 2001
- From: Dan Shelton <dan.f.shelton@gmail.com>
- Date: Tue, 16 Jan 2024 12:27:50 +0100
- Subject: [PATCH 4/7] daemon,libtirpc: Disable buffer checks in VC19 build
- Disable buffer checks in VC19 build for daemon and libtirpc,
- as we have drmemory for that and it causes false positives in
- drmemory.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- build.vc19/libtirpc/libtirpc.vcxproj | 6 ++++++
- build.vc19/nfsd/nfsd.vcxproj | 6 ++++++
- 2 files changed, 12 insertions(+)
- diff --git a/build.vc19/libtirpc/libtirpc.vcxproj b/build.vc19/libtirpc/libtirpc.vcxproj
- index e4cb86b..6d3fda8 100644
- --- a/build.vc19/libtirpc/libtirpc.vcxproj
- +++ b/build.vc19/libtirpc/libtirpc.vcxproj
- @@ -91,6 +91,8 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- + <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- + <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- @@ -109,6 +111,8 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- + <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- + <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- @@ -129,6 +133,7 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- + <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- @@ -151,6 +156,7 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- + <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
- index 5e97236..df0311a 100644
- --- a/build.vc19/nfsd/nfsd.vcxproj
- +++ b/build.vc19/nfsd/nfsd.vcxproj
- @@ -91,6 +91,8 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;..\..\sys;..\..\dll;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- + <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- + <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- @@ -108,6 +110,8 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;..\..\sys;..\..\dll;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- + <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- + <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- @@ -127,6 +131,7 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;..\..\sys;..\..\dll;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- + <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- @@ -148,6 +153,7 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;..\..\sys;..\..\dll;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- + <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- --
- 2.43.0
- From d3cba4c81d7f661290b5df88b3049666c0583976 Mon Sep 17 00:00:00 2001
- From: Dan Shelton <dan.f.shelton@gmail.com>
- Date: Tue, 16 Jan 2024 12:30:01 +0100
- Subject: [PATCH 5/7] daemon,libtirpc: Enable string literal pooling for VC19
- builds
- Enable string literal pooling in daemon and libtirpc for VC19 builds.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- build.vc19/libtirpc/libtirpc.vcxproj | 4 ++++
- build.vc19/nfsd/nfsd.vcxproj | 4 ++++
- 2 files changed, 8 insertions(+)
- diff --git a/build.vc19/libtirpc/libtirpc.vcxproj b/build.vc19/libtirpc/libtirpc.vcxproj
- index 6d3fda8..bb79718 100644
- --- a/build.vc19/libtirpc/libtirpc.vcxproj
- +++ b/build.vc19/libtirpc/libtirpc.vcxproj
- @@ -91,6 +91,7 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- + <StringPooling>true</StringPooling>
- <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- @@ -111,6 +112,7 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- + <StringPooling>true</StringPooling>
- <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- @@ -133,6 +135,7 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- + <StringPooling>true</StringPooling>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- @@ -156,6 +159,7 @@
- <AdditionalIncludeDirectories>..\..\libtirpc\tirpc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- + <StringPooling>true</StringPooling>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- </ClCompile>
- <Link>
- diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
- index df0311a..42567f6 100644
- --- a/build.vc19/nfsd/nfsd.vcxproj
- +++ b/build.vc19/nfsd/nfsd.vcxproj
- @@ -93,6 +93,7 @@
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- + <StringPooling>true</StringPooling>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- @@ -112,6 +113,7 @@
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- + <StringPooling>true</StringPooling>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- @@ -132,6 +134,7 @@
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- + <StringPooling>true</StringPooling>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- @@ -154,6 +157,7 @@
- <LanguageStandard_C>stdc17</LanguageStandard_C>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- + <StringPooling>true</StringPooling>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- --
- 2.43.0
- From 5b778ffa276a9c1b501a82e6bd865e7fbaf8a582 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 16 Jan 2024 15:28:12 +0100
- Subject: [PATCH 6/7] daemon: Increase |MAX_LOOKUP_COMPONENTS| to |128|
- Increase |MAX_LOOKUP_COMPONENTS| from |8| to |128| to optimise
- performance for high latency links (satellite, ssh tunnel etc.).
- The real value is negotiated with the NFSv4.1 server at session
- creation time (e.g. (|min(session->fore_chan_attrs.ca_maxoperations|,
- MAX_LOOKUP_COMPONENTS)|), see |max_lookup_components()| in
- daemon/lookup.c
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/lookup.c | 27 +++++++++++++++++++++++----
- 1 file changed, 23 insertions(+), 4 deletions(-)
- diff --git a/daemon/lookup.c b/daemon/lookup.c
- index 7299152..d6509a7 100644
- --- a/daemon/lookup.c
- +++ b/daemon/lookup.c
- @@ -32,8 +32,23 @@
- #define LULVL 2 /* dprintf level for lookup logging */
- -
- -#define MAX_LOOKUP_COMPONENTS 8
- +/*
- + * MAX_LOOKUP_COMPONENTS - maximum number of compound requests
- + * per lookup
- + *
- + * We use |128| here to pack as much data into one compound
- + * to optimise for high latency links (satellite, ssh tunnel etc.)
- + *
- + * The real value is negotiated with the NFSv4.1 server
- + * at session creation time (e.g. (|min(
- + * session->fore_chan_attrs.ca_maxoperations|,
- + * MAX_LOOKUP_COMPONENTS)|), see |max_lookup_components()| below.
- + *
- + * Linux 5.10.0-22-rt uses |ca_maxoperations==16|
- + * simplenfs/nfs4j uses |ca_maxoperations==128|
- + *
- + */
- +#define MAX_LOOKUP_COMPONENTS 128
- /* map NFS4ERR_MOVED to an arbitrary windows error */
- #define ERROR_FILESYSTEM_ABSENT ERROR_DEVICE_REMOVED
- @@ -275,8 +290,12 @@ out:
- static uint32_t max_lookup_components(
- IN const nfs41_session *session)
- {
- - const uint32_t comps = (session->fore_chan_attrs.ca_maxoperations - 4) / 3;
- - return min(comps, MAX_LOOKUP_COMPONENTS);
- +#define ROUNDUPDIV(x, y) (((x)+((y)-1))/(y))
- + const uint32_t comps = min(
- + session->fore_chan_attrs.ca_maxoperations,
- + MAX_LOOKUP_COMPONENTS);
- +
- + return ROUNDUPDIV(comps-4, 3);
- }
- static uint32_t get_component_array(
- --
- 2.43.0
- From 3104b6b354678d9f40361e4a3d99042f97edd34e Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 16 Jan 2024 15:35:25 +0100
- Subject: [PATCH 7/7] daemon: Increase |UPCALL_BUF_SIZE| to fit rename with
- long paths
- Increase |UPCALL_BUF_SIZE| to |8192| to fit rename with long paths.
- Fixes gcc build on in a deep subdir (e.g.
- $ mkdir -p a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/0/1/2/3/4/5/6/7/8/9 #)
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/nfs41_const.h | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index c0ef4c8..5010816 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -40,7 +40,12 @@
- #define NFS41_MAX_SERVER_CACHE 1024
- #define NFS41_MAX_RPC_REQS 128
- -#define UPCALL_BUF_SIZE 4096
- +/*
- + * UPCALL_BUF_SIZE - buffer size for |DeviceIoControl()|
- + * This must fit at least twice the maximum path length
- + * (for rename) plus header
- + */
- +#define UPCALL_BUF_SIZE 8192
- /*
- * NFS41_MAX_COMPONENT_LEN - MaximumComponentNameLength
- --
- 2.43.0
msnfs41client: Patches for longer compounds, rename/mv on long paths, less debug messages etc., 2024-01-16
Posted by Anonymous on Tue 16th Jan 2024 15:18
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.