- From d59b13cd6e26a6827bff3451a936b3fc78ffb871 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 13 Dec 2023 16:52:10 +0100
- Subject: [PATCH 1/4] features: Rename NFS41...FEATURE NAMESERVICE_CYGWIN to
- IDMAPPER_CYGWIN
- nfs41_build_features.h: Rename
- NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN to
- NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN to avoid confusion.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/idmap.c | 10 +++++-----
- daemon/idmap.h | 5 +++--
- daemon/idmap_cygwin.c | 8 ++++----
- daemon/nfs41_daemon.c | 26 +++++++++++++++++++++-----
- sys/nfs41_build_features.h | 6 +++---
- 5 files changed, 36 insertions(+), 19 deletions(-)
- diff --git a/daemon/idmap.c b/daemon/idmap.c
- index 6ce461b..169de15 100644
- --- a/daemon/idmap.c
- +++ b/daemon/idmap.c
- @@ -670,7 +670,7 @@ static int idmap_lookup_user(
- if (difftime(time(NULL), user->last_updated) < (double)context->config.cache_ttl)
- goto out;
- }
- -#ifndef NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN
- +#ifndef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
- /* send the query to the ldap server */
- status = idmap_query_attrs(context, lookup,
- attributes, optional, values, NUM_ATTRIBUTES);
- @@ -794,7 +794,7 @@ static int idmap_lookup_user(
- (unsigned long)user->uid,
- (unsigned long)user->gid);
- }
- -#endif /* !NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN */
- +#endif /* !NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- if (context->config.cache_ttl) {
- /* insert the entry into the cache */
- cache_insert(&context->users, lookup, &user->entry);
- @@ -824,7 +824,7 @@ static int idmap_lookup_group(
- if (difftime(time(NULL), group->last_updated) < (double)context->config.cache_ttl)
- goto out;
- }
- -#ifndef NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN
- +#ifndef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
- /* send the query to the ldap server */
- status = idmap_query_attrs(context, lookup,
- attributes, 0, values, NUM_ATTRIBUTES);
- @@ -895,7 +895,7 @@ static int idmap_lookup_group(
- group->name,
- (unsigned long)group->gid);
- }
- -#endif /* !NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN */
- +#endif /* !NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- if (context->config.cache_ttl) {
- /* insert the entry into the cache */
- cache_insert(&context->groups, lookup, &group->entry);
- @@ -931,7 +931,7 @@ int nfs41_idmap_create(
- goto out_err_free;
- }
- -#ifndef NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN
- +#ifndef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
- /* initialize ldap and configure options */
- context->ldap = ldap_init(context->config.hostname, context->config.port);
- if (context->ldap == NULL) {
- diff --git a/daemon/idmap.h b/daemon/idmap.h
- index c515084..622bf38 100644
- --- a/daemon/idmap.h
- +++ b/daemon/idmap.h
- @@ -3,6 +3,7 @@
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -65,9 +66,9 @@ int nfs41_idmap_gid_to_group(
- size_t len);
- /* idmap_cygwin.c */
- -#ifdef NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN
- +#ifdef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
- int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid, gid_t *res_gid);
- int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid);
- -#endif /* NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN */
- +#endif /* NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- #endif /* !IDMAP_H */
- diff --git a/daemon/idmap_cygwin.c b/daemon/idmap_cygwin.c
- index f8bb74e..41c2c67 100644
- --- a/daemon/idmap_cygwin.c
- +++ b/daemon/idmap_cygwin.c
- @@ -30,9 +30,9 @@
- #include "nfs41_const.h"
- #include "list.h"
- #include "daemon_debug.h"
- -#ifdef NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN
- +#ifdef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
- #include "cpvparser1.h"
- -#endif /* NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN */
- +#endif /* NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- #define CYGWINIDLVL 2 /* dprintf level for idmap logging */
- @@ -43,7 +43,7 @@
- "/cygdrive/c/cygwin64/lib/msnfs41client/cygwin_idmapper.ksh")
- -#ifdef NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN
- +#ifdef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
- int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid, gid_t *res_gid)
- {
- char cmdbuff[1024];
- @@ -259,4 +259,4 @@ fail:
- return res;
- }
- -#endif /* NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN */
- +#endif /* NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index 6eaa0e8..906a951 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -3,6 +3,7 @@
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -270,9 +271,9 @@ static bool_t parse_cmdlineargs(int argc, TCHAR *argv[], nfsd_args *out)
- }
- (void)fprintf(stdout, "parse_cmdlineargs: debug_level %d ldap is %d "
- -#ifdef NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN
- +#ifdef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
- "idmap_cygwin is 1 "
- -#endif /* NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN */
- +#endif /* NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- "\n",
- out->debug_level, out->ldap_enable);
- return TRUE;
- @@ -415,7 +416,22 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- #ifdef _DEBUG
- /* dump memory leaks to stderr on exit; this requires the debug heap,
- /* available only when built in debug mode under visual studio -cbodley */
- - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
- +
- + int crtsetdbgflags = 0;
- + crtsetdbgflags |= _CRTDBG_ALLOC_MEM_DF; /* use debug heap */
- + crtsetdbgflags |= _CRTDBG_LEAK_CHECK_DF; /* report leaks on exit */
- +/* Disabled for now, git clone ... gcc.git does not work with it */
- +#ifdef DISABLED_FOR_NOW
- + /*
- + * _CRTDBG_DELAY_FREE_MEM_DF - Delay freeing of memory, but fill
- + * memory blocks passed to |free()| with 0xdd. We rely on that to
- + * see 0xdddddddddddddddd-pointers for use-after-free and catch
- + * them in stress testing instead of having to deal with a core
- + * dump
- + */
- + crtsetdbgflags |= _CRTDBG_DELAY_FREE_MEM_DF;
- +#endif
- + (void)_CrtSetDbgFlag(crtsetdbgflags);
- _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
- /*
- @@ -449,11 +465,11 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- eprintf("Failed to enter HIGH_PRIORITY_CLASS mode\n");
- }
- -#ifdef NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN
- +#ifdef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
- /* force enable for cygwin getent passwd/group testing */
- cmd_args.ldap_enable = TRUE;
- DASSERT(0/* test asserts*/, 0);
- -#endif /* NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN */
- +#endif /* NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- nfs41_server_list_init();
- diff --git a/sys/nfs41_build_features.h b/sys/nfs41_build_features.h
- index 93ee7a9..19f81f9 100644
- --- a/sys/nfs41_build_features.h
- +++ b/sys/nfs41_build_features.h
- @@ -42,9 +42,9 @@
- // #define NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID 1
- /*
- - * NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN - use Cygwin /usr/bin/getent
- - * as "name service"
- + * NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN - use Cygwin shell script
- + * as to do the idmapping between NFS client and NFS server
- */
- -// #define NFS41_DRIVER_FEATURE_NAMESERVICE_CYGWIN 1
- +// #define NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN 1
- #endif /* !_NFS41_DRIVER_BUILDFEATURES_ */
- --
- 2.42.1
- From 1d4b36ea449c5f437846432fb069c5467202887f Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 13 Dec 2023 16:56:24 +0100
- Subject: [PATCH 2/4] Enable Cygwin idmapper, SID and NfsV3Attribute support by
- default
- Enable build features
- NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES,
- NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID and
- NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN by default.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41_build_features.h | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
- diff --git a/sys/nfs41_build_features.h b/sys/nfs41_build_features.h
- index 19f81f9..5827905 100644
- --- a/sys/nfs41_build_features.h
- +++ b/sys/nfs41_build_features.h
- @@ -32,19 +32,19 @@
- /*
- * NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES - return local uid/gid values
- */
- -// #define NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES 1
- +#define NFS41_DRIVER_FEATURE_LOCAL_UIDGID_IN_NFSV3ATTRIBUTES 1
- /*
- * NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID - give NFS
- * files which do not map to a local account a SID in the
- * Unix_User+x/Unix_Group+x range
- */
- -// #define NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID 1
- +#define NFS41_DRIVER_FEATURE_MAP_UNMAPPED_USER_TO_UNIXUSER_SID 1
- /*
- * NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN - use Cygwin shell script
- * as to do the idmapping between NFS client and NFS server
- */
- -// #define NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN 1
- +#define NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN 1
- #endif /* !_NFS41_DRIVER_BUILDFEATURES_ */
- --
- 2.42.1
- From 6b427058f9c135c878aa101270449eef4f87795b Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 13 Dec 2023 18:19:11 +0100
- Subject: [PATCH 3/4] cygwin: Sources should go into /usr/src/, not /src/
- Sources in the binary tarball should go into /usr/src/, not /src
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/Makefile | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
- diff --git a/cygwin/Makefile b/cygwin/Makefile
- index 28c03e9..9b4ff11 100644
- --- a/cygwin/Makefile
- +++ b/cygwin/Makefile
- @@ -62,7 +62,7 @@ installdest: $(VS_BUILD_DIR)/nfsd.exe \
- # /usr/lib is a bind mount to C:/cygwin64/lib, so copy library data to /cygdrive/c/cygwin64/lib
- mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/lib
- mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/lib/msnfs41client
- - mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/src/msnfs41client
- + mkdir -p $(DESTDIR)/cygdrive/c/cygwin64/usr/src/msnfs41client
- cp -r $(VS_BUILD_DIR)/nfsd.exe $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsd_debug.exe
- cp -r $(VS_BUILD_DIR)/nfsd.pdb $(DESTDIR)/cygdrive/c/cygwin64/sbin/nfsd_debug.pdb
- cp -r $(VS_BUILD_DIR)/nfs_mount.* $(DESTDIR)/cygdrive/c/cygwin64/sbin/.
- @@ -79,9 +79,9 @@ installdest: $(VS_BUILD_DIR)/nfsd.exe \
- (cd "$(DESTDIR)/cygdrive/c/cygwin64/sbin/" && ln -sf ../lib/msnfs41client/msnfs41client .)
- cp $(PROJECT_BASEDIR_DIR)/cygwin_idmapper.ksh $(DESTDIR)/cygdrive/c/cygwin64/lib/msnfs41client/.
- @ printf "# Package sources and diffs\n"
- - git bundle create "$(DESTDIR)/cygdrive/c/cygwin64/src/msnfs41client/msnfs41client_git.bundle" HEAD
- - git diff -w >"$(DESTDIR)/cygdrive/c/cygwin64/src/msnfs41client/msnfs41client_diff_w.diff"
- - git diff >"$(DESTDIR)/cygdrive/c/cygwin64/src/msnfs41client/msnfs41client_diff.diff"
- + git bundle create "$(DESTDIR)/cygdrive/c/cygwin64/usr/src/msnfs41client/msnfs41client_git.bundle" HEAD
- + git diff -w >"$(DESTDIR)/cygdrive/c/cygwin64/usr/src/msnfs41client/msnfs41client_diff_w.diff"
- + git diff >"$(DESTDIR)/cygdrive/c/cygwin64/usr/src/msnfs41client/msnfs41client_diff.diff"
- @ printf "# Package utilties\n"
- cp $(CYGWIN_MAKEFILE_DIR)/utils/mount_sshnfs/mount_sshnfs.ksh $(DESTDIR)/cygdrive/c/cygwin64/sbin/mount_sshnfs
- chmod a+x $(DESTDIR)/cygdrive/c/cygwin64/sbin/mount_sshnfs
- --
- 2.42.1
- From e570cca9d618557e1f1d13a2e13d2290ba3dcb6b Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 13 Dec 2023 18:22:44 +0100
- Subject: [PATCH 4/4] Add new build option NFS41_DRIVER_STABILITY_HACKS - and
- use it
- Add new build option NFS41_DRIVER_STABILITY_HACKS to
- sys/nfs41_build_features.h, for horrible workarounds&hacks
- to improve "stability" at the expense of sanity - and use it.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/daemon_debug.h | 22 ++++++++++++++++++++++
- daemon/getattr.c | 31 ++++++++++++++++++++++++++++++-
- daemon/nfs41_daemon.c | 1 +
- daemon/nfs41_ops.c | 4 ++++
- daemon/open.c | 20 +++++++++++++++++++-
- daemon/upcall.c | 2 ++
- sys/nfs41_build_features.h | 6 ++++++
- 7 files changed, 84 insertions(+), 2 deletions(-)
- diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
- index 24a2683..07898fe 100644
- --- a/daemon/daemon_debug.h
- +++ b/daemon/daemon_debug.h
- @@ -34,6 +34,14 @@
- #define DEFAULT_DEBUG_LEVEL 1
- +/* 0xdd..dd is the filler by the debug memory allocator */
- +#define DEBUG_IS_VALID_NON_NULL_PTR(ptr) \
- + ( \
- + (((char *)(ptr)) != ((char *)0xddddddddddddddddLL)) && \
- + (((char *)(ptr)) != ((char *)0xffffffffffffffffLL)) && \
- + ((ptr) != NULL) \
- + )
- +
- #define EASSERT(exp) \
- if (!(exp)) { \
- eprintf("ASSERTION '%s' in '%s'/%ld failed.\n", \
- @@ -43,6 +51,20 @@
- dprintf((level), "ASSERTION '%s' in '%s'/%ld failed.\n", \
- ""#exp"", __FILE__, (long)__LINE__); }
- +#define DASSERT_IS_VALID_NON_NULL_PTR(exp, level) \
- + if (!DEBUG_IS_VALID_NON_NULL_PTR(exp)) { \
- + dprintf((level), "ASSERTION " \
- + "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=%p) " \
- + "in '%s'/%ld failed.\n", \
- + ""#exp"", (void *)(exp), __FILE__, (long)__LINE__); }
- +
- +#define EASSERT_IS_VALID_NON_NULL_PTR(exp) \
- + if (!DEBUG_IS_VALID_NON_NULL_PTR(exp)) { \
- + eprintf("ASSERTION " \
- + "!DEBUG_IS_VALID_NON_NULL_PTR('%s'=%p) " \
- + "in '%s'/%ld failed.\n", \
- + ""#exp"", (void *)(exp), __FILE__, (long)__LINE__); }
- +
- /* daemon_debug.h */
- void set_debug_level(int level);
- void dprintf(int level, LPCSTR format, ...);
- diff --git a/daemon/getattr.c b/daemon/getattr.c
- index 7c5f241..b83085a 100644
- --- a/daemon/getattr.c
- +++ b/daemon/getattr.c
- @@ -23,6 +23,7 @@
- #include <stdio.h>
- #include <strsafe.h>
- +#include "nfs41_build_features.h"
- #include "nfs41_ops.h"
- #include "name_cache.h"
- #include "upcall.h"
- @@ -59,8 +60,19 @@ int nfs41_cached_getattr(
- static int parse_getattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
- {
- int status;
- +#ifdef NFS41_DRIVER_STABILITY_HACKS
- + EASSERT(length > 4);
- + if (length <= 4) {
- + status = ERROR_INVALID_PARAMETER;
- + goto out;
- + }
- + EASSERT_IS_VALID_NON_NULL_PTR(upcall->state_ref);
- + if (!DEBUG_IS_VALID_NON_NULL_PTR(upcall->state_ref)) {
- + status = ERROR_INVALID_PARAMETER;
- + goto out;
- + }
- +#endif /* NFS41_DRIVER_STABILITY_HACKS */
- getattr_upcall_args *args = &upcall->args.getattr;
- -
- status = safe_read(&buffer, &length, &args->query_class, sizeof(args->query_class));
- if (status) goto out;
- status = safe_read(&buffer, &length, &args->buf_len, sizeof(args->buf_len));
- @@ -80,6 +92,23 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
- nfs41_open_state *state = upcall->state_ref;
- nfs41_file_info info = { 0 };
- +#ifdef NFS41_DRIVER_STABILITY_HACKS
- + if (!DEBUG_IS_VALID_NON_NULL_PTR(state->session)) {
- + eprintf("handle_getattr: Invalid session ptr=%p\n",
- + (void *)state->session);
- + status = ERROR_INVALID_PARAMETER;
- + goto out;
- + }
- +
- + if (!DEBUG_IS_VALID_NON_NULL_PTR(state->file.fh.superblock)) {
- + eprintf("handle_getattr: Invalid state->file.fh.superblock ptr=%p\n",
- + (void *)state->file.fh.superblock);
- + /* gisburn: fixme: maybe this should be |ERROR_INTERNAL_ERROR| ? */
- + status = ERROR_INVALID_PARAMETER;
- + goto out;
- + }
- +#endif /* NFS41_DRIVER_STABILITY_HACKS */
- +
- status = nfs41_cached_getattr(state->session, &state->file, &info);
- if (status) {
- eprintf("nfs41_cached_getattr() failed with %d\n", status);
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index 906a951..e6c47ef 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -28,6 +28,7 @@
- #include <devioctl.h>
- #include <lmcons.h> /* UNLEN for GetUserName() */
- #include <iphlpapi.h> /* for GetNetworkParam() */
- +#include "nfs41_build_features.h"
- #include "nfs41_driver.h" /* for NFS41_USER_DEVICE_NAME_A */
- #include "nfs41_np.h" /* for NFS41NP_SHARED_MEMORY */
- diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
- index bcca070..7d89c06 100644
- --- a/daemon/nfs41_ops.c
- +++ b/daemon/nfs41_ops.c
- @@ -25,6 +25,7 @@
- #include <stdlib.h>
- #include <time.h>
- +#include "nfs41_build_features.h"
- #include "nfs41_ops.h"
- #include "nfs41_compound.h"
- #include "nfs41_xdr.h"
- @@ -400,6 +401,9 @@ int nfs41_open(
- bool_t already_delegated = delegation->type == OPEN_DELEGATE_READ
- || delegation->type == OPEN_DELEGATE_WRITE;
- + EASSERT_IS_VALID_NON_NULL_PTR(parent);
- + EASSERT_IS_VALID_NON_NULL_PTR(parent->fh.superblock);
- +
- /* depending on the claim type, OPEN expects CURRENT_FH set
- * to either the parent directory, or to the file itself */
- switch (claim->claim) {
- diff --git a/daemon/open.c b/daemon/open.c
- index a2d92a4..defdb6c 100644
- --- a/daemon/open.c
- +++ b/daemon/open.c
- @@ -24,8 +24,8 @@
- #include <ctype.h>
- #include <strsafe.h>
- -#include "nfs41_ops.h"
- #include "nfs41_build_features.h"
- +#include "nfs41_ops.h"
- #include "nfs41_daemon.h"
- #include "delegation.h"
- #include "from_kernel.h"
- @@ -99,6 +99,24 @@ static void open_state_free(
- void nfs41_open_state_ref(
- IN nfs41_open_state *state)
- {
- +#ifdef NFS41_DRIVER_STABILITY_HACKS
- + /*
- + * gisburn: fixme: sometimes this happens under high parallel
- + * usage with multiple mounts - but why ?
- + * 0:038> kp
- + * Child-SP RetAddr Call Site
- + * 0000006d`431fde10 00007ff7`32f7d905 nfsd!nfs41_open_state_ref(struct __nfs41_open_state * state = 0x00000000`00000000)+0x31
- + * 0000006d`431fdf30 00007ff7`32f4d284 nfsd!upcall_parse(unsigned char * buffer = 0x0000006d`431fe180 "???", unsigned int length = 8, struct __nfs41_upcall * upcall = 0x0000006d`431ff1e0)+0x2e5
- + * 0000006d`431fe0b0 00007ffc`1ca24c7c nfsd!thread_main(void * args = 0x00007ff7`32fb6080)+0x144
- + * 0000006d`431ffe00 00007ffc`4d4b7344 ucrtbased!thread_start<unsigned int (void * parameter = 0x0000025d`a9c6def0)+0x9c
- + * 0000006d`431ffe60 00007ffc`4efc26b1 KERNEL32!BaseThreadInitThunk+0x14
- + * 0000006d`431ffe90 00000000`00000000 ntdll!RtlUserThreadStart+0x21
- + */
- + EASSERT_IS_VALID_NON_NULL_PTR(state);
- + if (!DEBUG_IS_VALID_NON_NULL_PTR(state))
- + return;
- +#endif /* NFS41_DRIVER_STABILITY_HACKS */
- +
- const LONG count = InterlockedIncrement(&state->ref_count);
- dprintf(2, "nfs41_open_state_ref(%s) count %d\n", state->path.path, count);
- diff --git a/daemon/upcall.c b/daemon/upcall.c
- index bd13c61..d8b6b39 100644
- --- a/daemon/upcall.c
- +++ b/daemon/upcall.c
- @@ -23,6 +23,7 @@
- #include <stdio.h>
- #include <time.h>
- +#include "nfs41_build_features.h"
- #include "upcall.h"
- #include "daemon_debug.h"
- #include "util.h"
- @@ -121,6 +122,7 @@ int upcall_parse(
- /* parse the operation's arguments */
- op = g_upcall_op_table[upcall->opcode];
- if (op && op->parse) {
- + EASSERT(length > 0);
- status = op->parse(buffer, length, upcall);
- if (status) {
- eprintf("parsing of upcall '%s' failed with %d.\n",
- diff --git a/sys/nfs41_build_features.h b/sys/nfs41_build_features.h
- index 5827905..04e5d8f 100644
- --- a/sys/nfs41_build_features.h
- +++ b/sys/nfs41_build_features.h
- @@ -47,4 +47,10 @@
- */
- #define NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN 1
- +/*
- + * NFS41_DRIVER_STABILITY_HACKS - use horrible
- + * hacks to improve stabilty
- + */
- +#define NFS41_DRIVER_STABILITY_HACKS 1
- +
- #endif /* !_NFS41_DRIVER_BUILDFEATURES_ */
- --
- 2.42.1
msnfs41client: Patch to enable Cygwin idmaper, SIDs, uid/gid in Nfs3Attr EA by default, 2023-12-13
Posted by Anonymous on Wed 13th Dec 2023 17:41
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.