pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for to use system's |FsRtlCopy*()| for x86+AMD64, weird getattr Changetime, wait for nfsd before mounts+misc, 2024-09-25
Posted by Anonymous on Wed 25th Sep 2024 16:30
raw | new post

  1. From 6c4c357c23585c1bb94110a0d2c2a22b846f82eb Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 25 Sep 2024 11:28:16 +0200
  4. Subject: [PATCH 1/4] build.vc19,sys: Only use our own FsRtlCopyRead2(),
  5.  FsRtlCopyWrite2() on ARM64
  6.  
  7. Only use our own FsRtlCopyRead2(), FsRtlCopyWrite2() on ARM64,
  8. as we still get asserts when building ms-nfs41-client with VC19
  9. on a ms-nfs41-client filesystem.
  10.  
  11. Reviewed-by: Dan Shelton <dan.f.shelton@gmail.com>
  12. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  13. ---
  14. build.vc19/nfs41_driver/nfs41_driver.vcxproj | 8 ++++----
  15.  sys/copysup.c                                | 4 ++++
  16.  2 files changed, 8 insertions(+), 4 deletions(-)
  17.  
  18. diff --git a/build.vc19/nfs41_driver/nfs41_driver.vcxproj b/build.vc19/nfs41_driver/nfs41_driver.vcxproj
  19. index 18fd852..14b711e 100644
  20. --- a/build.vc19/nfs41_driver/nfs41_driver.vcxproj
  21. +++ b/build.vc19/nfs41_driver/nfs41_driver.vcxproj
  22. @@ -172,7 +172,7 @@
  23.        <AdditionalOptions>/std:c17 /Zc:preprocessor- /kernel /wd4100 /wd4201 /wd5104</AdditionalOptions>
  24.      </ClCompile>
  25.      <Link>
  26. -      <AdditionalDependencies>$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
  27. +      <AdditionalDependencies>$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib;$(WindowsSdkDir)lib\win7\km\$(DDKPlatform)\copysup.lib</AdditionalDependencies>
  28.      </Link>
  29.    </ItemDefinitionGroup>
  30.    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
  31. @@ -186,7 +186,7 @@
  32.        <AdditionalOptions>/std:c17 /Zc:preprocessor- /kernel /wd4100 /wd4201 /wd5104</AdditionalOptions>
  33.      </ClCompile>
  34.      <Link>
  35. -      <AdditionalDependencies>$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
  36. +      <AdditionalDependencies>$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib;$(WindowsSdkDir)lib\win7\km\$(DDKPlatform)\copysup.lib</AdditionalDependencies>
  37.      </Link>
  38.    </ItemDefinitionGroup>
  39.    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
  40. @@ -228,7 +228,7 @@
  41.        <AdditionalOptions>/std:c17 /Zc:preprocessor- /kernel /wd4100 /wd4201 /wd5104</AdditionalOptions>
  42.      </ClCompile>
  43.      <Link>
  44. -      <AdditionalDependencies>$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
  45. +      <AdditionalDependencies>$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib;$(WindowsSdkDir)lib\win7\km\$(DDKPlatform)\copysup.lib</AdditionalDependencies>
  46.      </Link>
  47.    </ItemDefinitionGroup>
  48.    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
  49. @@ -242,7 +242,7 @@
  50.        <AdditionalOptions>/std:c17 /Zc:preprocessor- /kernel /wd4100 /wd4201 /wd5104</AdditionalOptions>
  51.      </ClCompile>
  52.      <Link>
  53. -      <AdditionalDependencies>$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib</AdditionalDependencies>
  54. +      <AdditionalDependencies>$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ntoskrnl.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\hal.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\BufferOverflowfastfailK.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\ksecdd.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rxce.lib;$(WindowsSdkDir)lib0.0.19041.0\km\$(DDKPlatform)\rdbsslib.lib;$(WindowsSdkDir)lib\win7\km\$(DDKPlatform)\copysup.lib</AdditionalDependencies>
  55.      </Link>
  56.    </ItemDefinitionGroup>
  57.    <ItemGroup>
  58. diff --git a/sys/copysup.c b/sys/copysup.c
  59. index a70f179..799caf9 100644
  60. --- a/sys/copysup.c
  61. +++ b/sys/copysup.c
  62. @@ -35,6 +35,8 @@
  63.  #include "nfs41_debug.h"
  64.  #include "nfs41_build_features.h"
  65.  
  66. +#if defined(_ARM_) || defined(_ARM64_)
  67. +
  68.  #define COPYSUP_MAX_HOLE_SIZE (2*4096LL)
  69.  
  70.  BOOLEAN FsRtlCopyRead2(
  71. @@ -570,6 +572,8 @@ done_exit_filesystem:
  72.  done:
  73.      return retval;
  74.  }
  75. +#endif /* defined(_ARM_) || defined(_ARM64_) */
  76. +
  77.  
  78.  #if defined(_ARM_) || defined(_ARM64_)
  79.  
  80. --
  81. 2.45.1
  82.  
  83. From 6ac071cec1143e2c7c0d34a6d0d5dfcd6a680fe1 Mon Sep 17 00:00:00 2001
  84. From: Roland Mainz <roland.mainz@nrubsig.org>
  85. Date: Wed, 25 Sep 2024 11:55:36 +0200
  86. Subject: [PATCH 2/4] build.vc19: Disable VC19 "JustMyCode" feature for better
  87.  drmemory stacktraces
  88.  
  89. Disable VC19 "JustMyCode" feature (see
  90. https://learn.microsoft.com/en-us/cpp/build/reference/jmc?view=msvc-170)
  91. for better drmemory stacktraces.
  92.  
  93. The "JustMyCode" feature has caused problems with accurate
  94. stacktraces in libtirpc&co like this:
  95. ---- snip ----
  96. Error #2: UNINITIALIZED READ: reading 4 byte(s)
  97. libtirpc.dll!__CheckForDebuggerJustMyCode  [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\misc\debugger_jmc.c:23]
  98. libtirpc.dll!time_not_ok                   [msnfs41_uidmapping\ms-nfs41-client\libtirpc\src\clnt_vc.c:15732480]
  99. KERNELBASE.dll!OpenThreadToken            +0x4c     (0x00007ffb9b992b6d <KERNELBASE.dll+0x32b6d>)
  100. KERNELBASE.dll!SleepConditionVariableSRW  +0x36     (0x00007ffb9b9d3327 <KERNELBASE.dll+0x73327>)
  101. nfs41_send_compound                        [ms-nfs41-client\daemon\nfs41_rpc.c:351]
  102. compound_encode_send_decode                [ms-nfs41-client\daemon\nfs41_compound.c:153]
  103. nfs41_read                                 [ms-nfs41-client\daemon\nfs41_ops.c:873]
  104. read_from_mds                              [ms-nfs41-client\daemon\readwrite.c:80]
  105. handle_read                                [ms-nfs41-client\daemon\readwrite.c:165]
  106. upcall_handle                              [ms-nfs41-client\daemon\upcall.c:220]
  107. nfsd_worker_thread_main                    [ms-nfs41-client\daemon\nfs41_daemon.c:188]
  108. ---- snip ----
  109. Note the bogus line number in "clnt_vc.c:15732480", and that
  110. |SleepConditionVariableSRW()| (system library function) cannot call
  111. |libtirpc.dll!time_not_ok|.
  112.  
  113. We just disable this feature as it only causes confusion.
  114.  
  115. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  116. ---
  117. build.vc19/libtirpc/libtirpc.vcxproj       | 3 +++
  118.  build.vc19/nfs41_np/nfs41_np.vcxproj       | 4 +++-
  119.  build.vc19/nfs_install/nfs_install.vcxproj | 4 +++-
  120.  build.vc19/nfs_mount/nfs_mount.vcxproj     | 3 +++
  121.  build.vc19/nfsd/nfsd.vcxproj               | 4 +++-
  122.  5 files changed, 15 insertions(+), 3 deletions(-)
  123.  
  124. diff --git a/build.vc19/libtirpc/libtirpc.vcxproj b/build.vc19/libtirpc/libtirpc.vcxproj
  125. index 3707b88..590715a 100644
  126. --- a/build.vc19/libtirpc/libtirpc.vcxproj
  127. +++ b/build.vc19/libtirpc/libtirpc.vcxproj
  128. @@ -128,6 +128,7 @@
  129.        <BufferSecurityCheck>false</BufferSecurityCheck>
  130.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  131.        <AdditionalOptions>/wd4100 /wd4131 /wd4389</AdditionalOptions>
  132. +      <SupportJustMyCode>false</SupportJustMyCode>
  133.      </ClCompile>
  134.      <Link>
  135.        <SubSystem>Windows</SubSystem>
  136. @@ -150,6 +151,7 @@
  137.        <BufferSecurityCheck>false</BufferSecurityCheck>
  138.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  139.        <AdditionalOptions>/wd4100 /wd4131 /wd4389</AdditionalOptions>
  140. +      <SupportJustMyCode>false</SupportJustMyCode>
  141.      </ClCompile>
  142.      <Link>
  143.        <SubSystem>Windows</SubSystem>
  144. @@ -172,6 +174,7 @@
  145.        <BufferSecurityCheck>false</BufferSecurityCheck>
  146.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  147.        <AdditionalOptions>/wd4100 /wd4131 /wd4389</AdditionalOptions>
  148. +      <SupportJustMyCode>false</SupportJustMyCode>
  149.      </ClCompile>
  150.      <Link>
  151.        <SubSystem>Windows</SubSystem>
  152. diff --git a/build.vc19/nfs41_np/nfs41_np.vcxproj b/build.vc19/nfs41_np/nfs41_np.vcxproj
  153. index 77a61b1..b1aad79 100644
  154. --- a/build.vc19/nfs41_np/nfs41_np.vcxproj
  155. +++ b/build.vc19/nfs41_np/nfs41_np.vcxproj
  156. @@ -72,7 +72,6 @@
  157.      <WholeProgramOptimization>true</WholeProgramOptimization>
  158.      <CharacterSet>Unicode</CharacterSet>
  159.    </PropertyGroup>
  160. -
  161.    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  162.    <ImportGroup Label="ExtensionSettings">
  163.    </ImportGroup>
  164. @@ -126,6 +125,7 @@
  165.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  166.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  167.        <AdditionalOptions>/wd4100</AdditionalOptions>
  168. +      <SupportJustMyCode>false</SupportJustMyCode>
  169.      </ClCompile>
  170.      <Link>
  171.        <SubSystem>Windows</SubSystem>
  172. @@ -144,6 +144,7 @@
  173.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  174.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  175.        <AdditionalOptions>/wd4100</AdditionalOptions>
  176. +      <SupportJustMyCode>false</SupportJustMyCode>
  177.      </ClCompile>
  178.      <Link>
  179.        <SubSystem>Windows</SubSystem>
  180. @@ -162,6 +163,7 @@
  181.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  182.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  183.        <AdditionalOptions>/wd4100</AdditionalOptions>
  184. +      <SupportJustMyCode>false</SupportJustMyCode>
  185.      </ClCompile>
  186.      <Link>
  187.        <SubSystem>Windows</SubSystem>
  188. diff --git a/build.vc19/nfs_install/nfs_install.vcxproj b/build.vc19/nfs_install/nfs_install.vcxproj
  189. index df69486..5c07c13 100644
  190. --- a/build.vc19/nfs_install/nfs_install.vcxproj
  191. +++ b/build.vc19/nfs_install/nfs_install.vcxproj
  192. @@ -124,6 +124,7 @@
  193.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  194.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  195.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  196. +      <SupportJustMyCode>false</SupportJustMyCode>
  197.      </ClCompile>
  198.      <Link>
  199.        <SubSystem>Console</SubSystem>
  200. @@ -140,6 +141,7 @@
  201.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  202.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  203.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  204. +      <SupportJustMyCode>false</SupportJustMyCode>
  205.      </ClCompile>
  206.      <Link>
  207.        <SubSystem>Console</SubSystem>
  208. @@ -156,13 +158,13 @@
  209.        <AdditionalIncludeDirectories>..\..\sys;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  210.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  211.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  212. +      <SupportJustMyCode>false</SupportJustMyCode>
  213.      </ClCompile>
  214.      <Link>
  215.        <SubSystem>Console</SubSystem>
  216.        <GenerateDebugInformation>true</GenerateDebugInformation>
  217.      </Link>
  218.    </ItemDefinitionGroup>
  219. -
  220.    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
  221.      <ClCompile>
  222.        <WarningLevel>Level4</WarningLevel>
  223. diff --git a/build.vc19/nfs_mount/nfs_mount.vcxproj b/build.vc19/nfs_mount/nfs_mount.vcxproj
  224. index 9098369..0f8e9cc 100644
  225. --- a/build.vc19/nfs_mount/nfs_mount.vcxproj
  226. +++ b/build.vc19/nfs_mount/nfs_mount.vcxproj
  227. @@ -124,6 +124,7 @@
  228.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  229.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  230.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  231. +      <SupportJustMyCode>false</SupportJustMyCode>
  232.      </ClCompile>
  233.      <Link>
  234.        <SubSystem>Console</SubSystem>
  235. @@ -141,6 +142,7 @@
  236.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  237.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  238.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  239. +      <SupportJustMyCode>false</SupportJustMyCode>
  240.      </ClCompile>
  241.      <Link>
  242.        <SubSystem>Console</SubSystem>
  243. @@ -158,6 +160,7 @@
  244.        <AdditionalIncludeDirectories>..\..\sys;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  245.        <LanguageStandard_C>stdc17</LanguageStandard_C>
  246.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  247. +      <SupportJustMyCode>false</SupportJustMyCode>
  248.      </ClCompile>
  249.      <Link>
  250.        <SubSystem>Console</SubSystem>
  251. diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
  252. index 481cef9..e49964a 100644
  253. --- a/build.vc19/nfsd/nfsd.vcxproj
  254. +++ b/build.vc19/nfsd/nfsd.vcxproj
  255. @@ -72,7 +72,6 @@
  256.      <WholeProgramOptimization>true</WholeProgramOptimization>
  257.      <CharacterSet>Unicode</CharacterSet>
  258.    </PropertyGroup>
  259. -
  260.    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  261.    <ImportGroup Label="ExtensionSettings">
  262.    </ImportGroup>
  263. @@ -129,6 +128,7 @@
  264.        <StringPooling>true</StringPooling>
  265.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  266.        <AdditionalOptions>/wd4100</AdditionalOptions>
  267. +      <SupportJustMyCode>false</SupportJustMyCode>
  268.      </ClCompile>
  269.      <Link>
  270.        <SubSystem>Console</SubSystem>
  271. @@ -150,6 +150,7 @@
  272.        <StringPooling>true</StringPooling>
  273.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  274.        <AdditionalOptions>/wd4100</AdditionalOptions>
  275. +      <SupportJustMyCode>false</SupportJustMyCode>
  276.      </ClCompile>
  277.      <Link>
  278.        <SubSystem>Console</SubSystem>
  279. @@ -171,6 +172,7 @@
  280.        <StringPooling>true</StringPooling>
  281.        <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  282.        <AdditionalOptions>/wd4100</AdditionalOptions>
  283. +      <SupportJustMyCode>false</SupportJustMyCode>
  284.      </ClCompile>
  285.      <Link>
  286.        <SubSystem>Console</SubSystem>
  287. --
  288. 2.45.1
  289.  
  290. From 3f914b65a4b94fef6b8b59ee856197a290526c22 Mon Sep 17 00:00:00 2001
  291. From: Roland Mainz <roland.mainz@nrubsig.org>
  292. Date: Wed, 25 Sep 2024 15:16:50 +0200
  293. Subject: [PATCH 3/4] daemon: Kernel logs weird getattr ChangeTime
  294.  "1853819773316251935"
  295.  
  296. Kernel logs weired ChangeTime values for getattr, which
  297. turns out to be from uninitalised memory.
  298.  
  299. Example:
  300. ---- snip ----
  301. [1bd0] [unmarshal_nfs41_getattr] ChangeTime 1853819773316251935
  302. ---- snip ----
  303.  
  304. The daemon's |handle_getattr()| should just unconditionally
  305. return the ChangeTime to avoid this confusion.
  306.  
  307. Reported-by: Dan Shelton <dan.f.shelton@gmail.com>
  308. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  309. ---
  310. daemon/getattr.c | 7 ++++---
  311.  1 file changed, 4 insertions(+), 3 deletions(-)
  312.  
  313. diff --git a/daemon/getattr.c b/daemon/getattr.c
  314. index c193d40..67ea820 100644
  315. --- a/daemon/getattr.c
  316. +++ b/daemon/getattr.c
  317. @@ -165,12 +165,13 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
  318.              info.symlink_dir = TRUE;
  319.      }
  320.  
  321. +    EASSERT((info.attrmask.count > 0) &&
  322. +        (info.attrmask.arr[0] & FATTR4_WORD0_CHANGE));
  323. +    args->ctime = info.change;
  324. +
  325.      switch (args->query_class) {
  326.      case FileBasicInformation:
  327.          nfs_to_basic_info(state->file.name.name, &info, &args->basic_info);
  328. -        EASSERT((info.attrmask.count > 0) &&
  329. -            (info.attrmask.arr[0] & FATTR4_WORD0_CHANGE));
  330. -        args->ctime = info.change;
  331.          break;
  332.      case FileStandardInformation:
  333.          nfs_to_standard_info(&info, &args->std_info);
  334. --
  335. 2.45.1
  336.  
  337. From 10d8c2cd069f1385770362f624f3d210f2fa0c67 Mon Sep 17 00:00:00 2001
  338. From: Roland Mainz <roland.mainz@nrubsig.org>
  339. Date: Wed, 25 Sep 2024 16:04:20 +0200
  340. Subject: [PATCH 4/4] cygwin: msnfs41client should wait for nfsd*.exe before
  341.  mounting filesystems
  342.  
  343. cygwin: msnfs41client.bash should wait for nfsd*.exe before mounting
  344. filesystems
  345.  
  346. Reported-by: Martin Wege <martin.l.wege@gmail.com>
  347. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  348. ---
  349. cygwin/devel/msnfs41client.bash | 52 ++++++++++++++++++++++++++++++++-
  350.  1 file changed, 51 insertions(+), 1 deletion(-)
  351.  
  352. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  353. index 0ce778a..426ba8d 100755
  354. --- a/cygwin/devel/msnfs41client.bash
  355. +++ b/cygwin/devel/msnfs41client.bash
  356. @@ -324,6 +324,42 @@ function nfsclient_removedriver
  357.         return 0
  358.  }
  359.  
  360. +function nfsclient_waitfor_clientdaemon
  361. +{
  362. +       typeset -i i
  363. +
  364. +       #
  365. +       # wait for two minutes, and poll in 0.25 second intervals
  366. +       # (four times per second)
  367. +       #
  368. +       for (( i=0 ; i < 120*4 ; i++ )) ; do
  369. +               #
  370. +               # '/proc/sys/BaseNamedObjects/nfs41_shared_memory' is created
  371. +               # when nfsd*.exe starts
  372. +               # Note that this file is not removed if nfsd*.exe exits,
  373. +               # so we explicitly query tasklist too
  374. +               #
  375. +               if [[ -e '/proc/sys/BaseNamedObjects/nfs41_shared_memory' ]] ; then
  376. +                       if [[ "$(tasklist | grep -E 'nfsd(|_debug).exe')" != '' ]] ; then
  377. +                               break
  378. +                       fi
  379. +               fi
  380. +
  381. +               # print message every 5 seconds
  382. +               if (( i%(5*4) == 0 )) ; then
  383. +                       printf '%s: Waiting for nfsd*.exe to start\n' "$0"
  384. +               fi
  385. +               sleep 0.25
  386. +       done
  387. +
  388. +       if [[ -e '/proc/sys/BaseNamedObjects/nfs41_shared_memory' ]] ; then
  389. +               if [[ "$(tasklist | grep -E 'nfsd(|_debug).exe')" != '' ]] ; then
  390. +                       return 0
  391. +               fi
  392. +       fi
  393. +       return 1
  394. +}
  395. +
  396.  function nfsclient_rundeamon
  397.  {
  398.         set -o nounset
  399. @@ -598,6 +634,11 @@ function nfsclient_system_mount_globaldirs
  400.         set -o nounset
  401.         set -o errexit
  402.  
  403. +       if ! nfsclient_waitfor_clientdaemon ; then
  404. +               print -u2 -f $"%s: nfsd*.exe not running.\n" "$0"
  405. +               return 1
  406. +       fi
  407. +
  408.         mountall_msnfs41client
  409.  
  410.         return $?
  411. @@ -615,6 +656,11 @@ function nfsclient_mount_homedir
  412.         set -o nounset
  413.         set -o errexit
  414.  
  415. +       if ! nfsclient_waitfor_clientdaemon ; then
  416. +               print -u2 -f $"%s: nfsd*.exe not running.\n" "$0"
  417. +               return 1
  418. +       fi
  419. +
  420.         #nfs_mount -p -o sec=sys H 'derfwpc5131:/export/home2/rmainz'
  421.         #nfs_mount -p -o sec=sys H '[fe80::219:99ff:feae:73ce]:/export/home2/rmainz'
  422.         nfs_mount -p -o sec=sys H 'derfwpc5131_ipv6linklocal:/export/home2/rmainz'
  423. @@ -704,6 +750,9 @@ function main
  424.         # add defauft system path for POSIX utilities
  425.         PATH+=':/sbin:/usr/sbin:/bin:/usr/bin'
  426.  
  427. +       # add Windows tools path (tasklist, taskkill etc.)
  428. +       PATH+=':/cygdrive/c/Windows/system32/'
  429. +
  430.         # path to WinDBG cdb (fixme: 64bit x86-specific)
  431.         PATH+=':/cygdrive/c/Program Files (x86)/Windows Kits/10/Debuggers/x64/'
  432.  
  433. @@ -792,7 +841,7 @@ function main
  434.                         check_machine_arch || (( numerr++ ))
  435.                         require_cmd 'nfs_mount.exe' || (( numerr++ ))
  436.                         require_cmd 'mountall_msnfs41client' || (( numerr++ ))
  437. -                       require_cmd 'PsExec.exe' || (( numerr++ ))
  438. +                       require_cmd 'tasklist.exe' || (( numerr++ ))
  439.                         if ! is_windows_admin_account ; then
  440.                                 printf $"%s: %q requires Windows Adminstator permissions.\n" "$0" "$cmd"
  441.                                 (( numerr++ ))
  442. @@ -818,6 +867,7 @@ function main
  443.                 'mount_homedir')
  444.                         check_machine_arch || (( numerr++ ))
  445.                         require_cmd 'nfs_mount.exe' || (( numerr++ ))
  446. +                       require_cmd 'tasklist.exe' || (( numerr++ ))
  447.                         (( numerr > 0 )) && return 1
  448.  
  449.                         nfsclient_mount_homedir
  450. --
  451. 2.45.1

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at