pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for use delete-on-close, enable NFS services by default+misc, 2025-08-07
Posted by Anonymous on Thu 7th Aug 2025 16:21
raw | new post

  1. From 7db0e4bd2aa81ccda4d5df72ef22a2ecabb0a4c7 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 6 Aug 2025 16:53:20 +0200
  4. Subject: [PATCH 1/8] sys: |FileDispositionInformation| should use
  5.  delete-on-close and not POSIX-semantics
  6.  
  7. |FileDispositionInformation| should use Win32 delete-on-close and not
  8. POSIX-semantics for deleting files and dirs.
  9.  
  10. Only |FileDispositionInformationEx| can use POSIX semantics via
  11. |FILE_DISPOSITION_INFORMATION_EX.Flags & FILE_DISPOSITION_POSIX_SEMANTICS|,
  12. but we cannot implement that (yet) because the Windows rdbss.lib does
  13. not support |FileDispositionInformationEx|+|FileRenameInformationEx| ... ;-(
  14.  
  15. Reported-by: Lionel Cons <Lionelcons1972@gmail.com>
  16. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  17. ---
  18. sys/nfs41sys_buildconfig.h |  3 ++-
  19.  sys/nfs41sys_fileinfo.c    | 20 +++++++++++++++++++-
  20.  2 files changed, 21 insertions(+), 2 deletions(-)
  21.  
  22. diff --git a/sys/nfs41sys_buildconfig.h b/sys/nfs41sys_buildconfig.h
  23. index 2809a4a..3730547 100644
  24. --- a/sys/nfs41sys_buildconfig.h
  25. +++ b/sys/nfs41sys_buildconfig.h
  26. @@ -1,5 +1,5 @@
  27.  /* NFSv4.1 client for Windows
  28. - * Copyright (C) 2023-2024 Roland Mainz <roland.mainz@nrubsig.org>
  29. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  30.   *
  31.   * Roland Mainz <roland.mainz@nrubsig.org>
  32.   *
  33. @@ -22,6 +22,7 @@
  34.  #define _NFS41SYS_BUILDCONFIG_H_ 1
  35.  
  36.  /* Driver build config */
  37. +// #define FORCE_POSIX_SEMANTICS_DELETE 1
  38.  #define USE_STACK_FOR_DOWNCALL_UPDOWNCALLENTRY_MEM 1
  39.  
  40.  #if (NTDDI_VERSION >= NTDDI_WIN10_VB)
  41. diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
  42. index d7dc5e7..de386ab 100644
  43. --- a/sys/nfs41sys_fileinfo.c
  44. +++ b/sys/nfs41sys_fileinfo.c
  45. @@ -640,7 +640,10 @@ NTSTATUS nfs41_SetFileInformation(
  46.      NTSTATUS status = STATUS_INVALID_PARAMETER;
  47.      nfs41_updowncall_entry *entry = NULL;
  48.      FILE_INFORMATION_CLASS InfoClass = RxContext->Info.FileInformationClass;
  49. +
  50. +#ifdef FORCE_POSIX_SEMANTICS_DELETE
  51.      FILE_RENAME_INFORMATION rinfo;
  52. +#endif /* FORCE_POSIX_SEMANTICS_DELETE */
  53.      __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen;
  54.      __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
  55.          NFS41GetVNetRootExtension(SrvOpen->pVNetRoot);
  56. @@ -668,6 +671,12 @@ NTSTATUS nfs41_SetFileInformation(
  57.              PFILE_DISPOSITION_INFORMATION dinfo =
  58.                  (PFILE_DISPOSITION_INFORMATION)RxContext->Info.Buffer;
  59.              if (dinfo->DeleteFile) {
  60. +#ifdef FORCE_POSIX_SEMANTICS_DELETE
  61. +                /*
  62. +                 * Do POSIX-style delete here, i.e. what
  63. +                 * |FILE_DISPOSITION_INFORMATION_EX.Flags &
  64. +                 * FILE_DISPOSITION_POSIX_SEMANTICS| would do
  65. +                 */
  66.                  nfs41_fcb->DeletePending = TRUE;
  67.                  // we can delete directories right away
  68.                  if (nfs41_fcb->StandardInfo.Directory)
  69. @@ -682,6 +691,11 @@ NTSTATUS nfs41_SetFileInformation(
  70.                      nfs41_fcb->Renamed = TRUE;
  71.                      break;
  72.                  }
  73. +#else
  74. +                /* Do Win32 delete-on-close */
  75. +                nfs41_fcb->DeletePending = TRUE;
  76. +                nfs41_fcb->StandardInfo.DeletePending = TRUE;
  77. +#endif /* FORCE_POSIX_SEMANTICS_DELETE */
  78.              } else {
  79.                  /* section 4.3.3 of [FSBO]
  80.                   * "file system behavior in the microsoft windows environment"
  81. @@ -732,13 +746,17 @@ NTSTATUS nfs41_SetFileInformation(
  82.  
  83.      entry->u.SetFile.InfoClass = InfoClass;
  84.  
  85. +#ifdef FORCE_POSIX_SEMANTICS_DELETE
  86.      /* original irp has infoclass for remove but we need to rename instead,
  87.       * thus we changed the local variable infoclass */
  88.      if (RxContext->Info.FileInformationClass == FileDispositionInformation &&
  89.              InfoClass == FileRenameInformation) {
  90.          entry->buf = &rinfo;
  91.          entry->buf_len = sizeof(rinfo);
  92. -    } else {
  93. +    }
  94. +    else
  95. +#endif /* FORCE_POSIX_SEMANTICS_DELETE */
  96. +    {
  97.          entry->buf = RxContext->Info.Buffer;
  98.          entry->buf_len = RxContext->Info.Length;
  99.      }
  100. --
  101. 2.45.1
  102.  
  103. From 1ea82b5319ef289b5b9ad4b1a6e0ffbc91bb0263 Mon Sep 17 00:00:00 2001
  104. From: Roland Mainz <roland.mainz@nrubsig.org>
  105. Date: Thu, 7 Aug 2025 09:50:32 +0200
  106. Subject: [PATCH 2/8] sys: delete-on-close should not delete dirs with open
  107.  filehandles
  108.  
  109. delete-on-close should not delete dirs with open filehandles.
  110.  
  111. Reported-by: Lionel Cons <Lionelcons1972@gmail.com>
  112. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  113. ---
  114. sys/nfs41sys_buildconfig.h | 6 ++++++
  115.  sys/nfs41sys_openclose.c   | 8 +++++---
  116.  2 files changed, 11 insertions(+), 3 deletions(-)
  117.  
  118. diff --git a/sys/nfs41sys_buildconfig.h b/sys/nfs41sys_buildconfig.h
  119. index 3730547..20b5188 100644
  120. --- a/sys/nfs41sys_buildconfig.h
  121. +++ b/sys/nfs41sys_buildconfig.h
  122. @@ -22,7 +22,13 @@
  123.  #define _NFS41SYS_BUILDCONFIG_H_ 1
  124.  
  125.  /* Driver build config */
  126. +
  127. +/*
  128. + * |FORCE_POSIX_SEMANTICS_DELETE| and |FORCE_DELETE_DIRS_IMMEDIATELY| are for
  129. + * bug-by-bug compatibility with the original Windows NFSv3 filesystem driver
  130. + */
  131.  // #define FORCE_POSIX_SEMANTICS_DELETE 1
  132. +// #define FORCE_DELETE_DIRS_IMMEDIATELY 1
  133.  #define USE_STACK_FOR_DOWNCALL_UPDOWNCALLENTRY_MEM 1
  134.  
  135.  #if (NTDDI_VERSION >= NTDDI_WIN10_VB)
  136. diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
  137. index 9a4431f..a4c3508 100644
  138. --- a/sys/nfs41sys_openclose.c
  139. +++ b/sys/nfs41sys_openclose.c
  140. @@ -1165,9 +1165,11 @@ NTSTATUS nfs41_CloseSrvOpen(
  141.      entry->u.Close.srv_open = SrvOpen;
  142.      if (nfs41_fcb->StandardInfo.DeletePending)
  143.          nfs41_fcb->DeletePending = TRUE;
  144. -    if (!RxContext->pFcb->OpenCount ||
  145. -            (nfs41_fcb->StandardInfo.DeletePending &&
  146. -                nfs41_fcb->StandardInfo.Directory))
  147. +    if ((RxContext->pFcb->OpenCount == 0)
  148. +#ifdef FORCE_DELETE_DIRS_IMMEDIATELY
  149. +        || (nfs41_fcb->StandardInfo.DeletePending && nfs41_fcb->StandardInfo.Directory)
  150. +#endif /* FORCE_DELETE_DIRS_IMMEDIATELY */
  151. +        )
  152.          entry->u.Close.remove = nfs41_fcb->StandardInfo.DeletePending;
  153.      if (!RxContext->pFcb->OpenCount)
  154.          entry->u.Close.renamed = nfs41_fcb->Renamed;
  155. --
  156. 2.45.1
  157.  
  158. From 96cbf08b0a1b90cae1c21a4d102c4b2a1a799341 Mon Sep 17 00:00:00 2001
  159. From: Roland Mainz <roland.mainz@nrubsig.org>
  160. Date: Thu, 7 Aug 2025 11:02:19 +0200
  161. Subject: [PATCH 3/8] cygwin,tests: Update drmemory version
  162.  
  163. Update drmemory version.
  164.  
  165. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  166. ---
  167. cygwin/devel/msnfs41client.bash | 2 +-
  168.  tests/manual_testing.txt        | 6 +++---
  169.  2 files changed, 4 insertions(+), 4 deletions(-)
  170.  
  171. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  172. index 4a391dd..56be0fd 100755
  173. --- a/cygwin/devel/msnfs41client.bash
  174. +++ b/cygwin/devel/msnfs41client.bash
  175. @@ -485,7 +485,7 @@ function nfsclient_rundeamon
  176.                 "${nfsd_args[@]}"
  177.         elif false ; then
  178.                 #
  179. -               # test nfsd.exe with Dr. Memory (version 2.6.0 -- build 0)
  180. +               # test nfsd.exe with Dr. Memory (version 2.6.2028 -- build 0)
  181.                 #
  182.                 export _NT_ALT_SYMBOL_PATH="$(cygpath -w "$PWD")"
  183.                 nfsd_args=(
  184. diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
  185. index 526547c..9500021 100644
  186. --- a/tests/manual_testing.txt
  187. +++ b/tests/manual_testing.txt
  188. @@ -791,9 +791,9 @@ ksh93 tests/sparsefiles/testsparsefile1.ksh
  189.  #
  190.  
  191.  # cd /cygdrive/l/download/
  192. -# from https://github.com/DynamoRIO/drmemory/releases/tag/cronbuild-2.6.20167
  193. -wget 'https://github.com/DynamoRIO/drmemory/releases/download/cronbuild-2.6.20167/DrMemory-Windows-2.6.20167.msi'
  194. -msiexec /i DrMemory-Windows-2.6.20167.msi
  195. +# from https://github.com/DynamoRIO/drmemory/releases/tag/cronbuild-2.6.20282
  196. +wget 'https://github.com/DynamoRIO/drmemory/releases/download/cronbuild-2.6.20282/DrMemory-Windows-2.6.20282.msi'
  197. +msiexec /i DrMemory-Windows-2.6.20282.msi
  198.  
  199.  
  200.  #
  201. --
  202. 2.45.1
  203.  
  204. From beb724ccfc504aa5d39553aa7430cd9ba0864824 Mon Sep 17 00:00:00 2001
  205. From: Roland Mainz <roland.mainz@nrubsig.org>
  206. Date: Thu, 7 Aug 2025 12:16:30 +0200
  207. Subject: [PATCH 4/8] sys: Revert "sys: delete-on-close should not delete dirs
  208.  with open filehandles", NTFS allows this
  209.  
  210. Revert "sys: delete-on-close should not delete dirs with open filehandles",
  211. NTFS allows deleting files immediately even if there are open file handles
  212. to that directory.
  213.  
  214. Reviewed-by: Lionel Cons <Lionelcons1972@gmail.com>
  215. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  216. ---
  217. sys/nfs41sys_buildconfig.h |  5 ++---
  218.  sys/nfs41sys_fileinfo.c    |  5 ++++-
  219.  sys/nfs41sys_openclose.c   | 12 +++++++-----
  220.  3 files changed, 13 insertions(+), 9 deletions(-)
  221.  
  222. diff --git a/sys/nfs41sys_buildconfig.h b/sys/nfs41sys_buildconfig.h
  223. index 20b5188..a8c10ad 100644
  224. --- a/sys/nfs41sys_buildconfig.h
  225. +++ b/sys/nfs41sys_buildconfig.h
  226. @@ -24,11 +24,10 @@
  227.  /* Driver build config */
  228.  
  229.  /*
  230. - * |FORCE_POSIX_SEMANTICS_DELETE| and |FORCE_DELETE_DIRS_IMMEDIATELY| are for
  231. - * bug-by-bug compatibility with the original Windows NFSv3 filesystem driver
  232. + * |FORCE_POSIX_SEMANTICS_DELETE| is for bug-by-bug compatibility with the
  233. + * original Windows NFSv3 filesystem driver
  234.   */
  235.  // #define FORCE_POSIX_SEMANTICS_DELETE 1
  236. -// #define FORCE_DELETE_DIRS_IMMEDIATELY 1
  237.  #define USE_STACK_FOR_DOWNCALL_UPDOWNCALLENTRY_MEM 1
  238.  
  239.  #if (NTDDI_VERSION >= NTDDI_WIN10_VB)
  240. diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
  241. index de386ab..82b8054 100644
  242. --- a/sys/nfs41sys_fileinfo.c
  243. +++ b/sys/nfs41sys_fileinfo.c
  244. @@ -678,7 +678,10 @@ NTSTATUS nfs41_SetFileInformation(
  245.                   * FILE_DISPOSITION_POSIX_SEMANTICS| would do
  246.                   */
  247.                  nfs41_fcb->DeletePending = TRUE;
  248. -                // we can delete directories right away
  249. +                /*
  250. +                 * We can delete directories right away
  251. +                 * (NTFS allows deleting a dir which has open handles)
  252. +                 */
  253.                  if (nfs41_fcb->StandardInfo.Directory)
  254.                      break;
  255.                  nfs41_fcb->StandardInfo.DeletePending = TRUE;
  256. diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
  257. index a4c3508..fc1821f 100644
  258. --- a/sys/nfs41sys_openclose.c
  259. +++ b/sys/nfs41sys_openclose.c
  260. @@ -1165,11 +1165,13 @@ NTSTATUS nfs41_CloseSrvOpen(
  261.      entry->u.Close.srv_open = SrvOpen;
  262.      if (nfs41_fcb->StandardInfo.DeletePending)
  263.          nfs41_fcb->DeletePending = TRUE;
  264. -    if ((RxContext->pFcb->OpenCount == 0)
  265. -#ifdef FORCE_DELETE_DIRS_IMMEDIATELY
  266. -        || (nfs41_fcb->StandardInfo.DeletePending && nfs41_fcb->StandardInfo.Directory)
  267. -#endif /* FORCE_DELETE_DIRS_IMMEDIATELY */
  268. -        )
  269. +    /*
  270. +     * Note that we can delete directories right away
  271. +     * (NTFS allows deleting a dir which has open handles)
  272. +     */
  273. +    if ((RxContext->pFcb->OpenCount == 0) ||
  274. +        (nfs41_fcb->StandardInfo.DeletePending &&
  275. +            nfs41_fcb->StandardInfo.Directory))
  276.          entry->u.Close.remove = nfs41_fcb->StandardInfo.DeletePending;
  277.      if (!RxContext->pFcb->OpenCount)
  278.          entry->u.Close.renamed = nfs41_fcb->Renamed;
  279. --
  280. 2.45.1
  281.  
  282. From 3dfc550541081211bfe4073600cd430eb28b6f3f Mon Sep 17 00:00:00 2001
  283. From: Roland Mainz <roland.mainz@nrubsig.org>
  284. Date: Thu, 7 Aug 2025 12:18:03 +0200
  285. Subject: [PATCH 5/8] daemon: Add more debug info to |handle_nfs41_rename()|
  286.  for rename-with-dest-open-filehandles
  287.  
  288. Add more debug info to |handle_nfs41_rename()| for the case that the destination
  289. file still has open filehandles.
  290.  
  291. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  292. ---
  293. daemon/setattr.c | 6 ++++--
  294.  1 file changed, 4 insertions(+), 2 deletions(-)
  295.  
  296. diff --git a/daemon/setattr.c b/daemon/setattr.c
  297. index 02b1060..a47918e 100644
  298. --- a/daemon/setattr.c
  299. +++ b/daemon/setattr.c
  300. @@ -465,8 +465,10 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
  301.          /* AGLO: 03/21/2011: we can't handle rename of a file with a filename
  302.           * that is currently opened by this client
  303.           */
  304. -        eprintf("handle_nfs41_rename: destination '%s' is opened\n",
  305. -            dst_path.path);
  306. +        eprintf("handle_nfs41_rename: destination '%s' is opened, "
  307. +            "ReplaceIfExists=%d\n",
  308. +            dst_path.path,
  309. +            (int)rename->ReplaceIfExists);
  310.  /*
  311.   * gisburn: HACK: We have disabled this check to get MariaDB working,
  312.   * but we have to figure out what is the correct solution compared
  313. --
  314. 2.45.1
  315.  
  316. From 244cc95a33030970b25f87bb8811e305f666cf91 Mon Sep 17 00:00:00 2001
  317. From: Roland Mainz <roland.mainz@nrubsig.org>
  318. Date: Thu, 7 Aug 2025 14:40:57 +0200
  319. Subject: [PATCH 6/8] README.md,cygwin,docs: Enable NFSv4.2 client+mountall
  320.  services by default
  321.  
  322. Enable NFSv4.2 client+mountall services by default.
  323.  
  324. This marks a "flag day":
  325. We change the default behaviour. $ /sbin/msnfs41client install # will now
  326. enable the "ms-nfs41-client-service" and
  327. "ms-nfs41-client-globalmountall-service" services by DEFAULT, so an user
  328. only has to use /sbin/nfs_mount to mount a filesystem, or add a matching
  329. line to /etc/fstab.msnfs41client
  330.  
  331. Developers can use $ /sbin/msnfs41client devinstall # to not
  332. enable the services, or use $ /sbin/msnfs41client disableautostartservices #
  333. to disable the automatic start of the Windows services at boot time.
  334.  
  335. Reported-by: Lionel Cons <Lionelcons1972@gmail.com>
  336. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  337. ---
  338. README.md                       | 17 +++++------
  339.  cygwin/devel/msnfs41client.bash | 54 +++++++++++++++++++++++++++++----
  340.  docs/README.xml                 | 15 +++++----
  341.  3 files changed, 62 insertions(+), 24 deletions(-)
  342.  
  343. diff --git a/README.md b/README.md
  344. index 48e6695..1c737a1 100644
  345. --- a/README.md
  346. +++ b/README.md
  347. @@ -517,7 +517,7 @@ NFS server side.
  348.      for all users on a machine.
  349.  
  350.    - The "ms-nfs41-client-service" service is installed by default as
  351. -    "disabled" and therefore always requires a "manual" start (e.g.,
  352. +    "enabled" and therefore does not require a "manual" start (e.g.,
  353.      `$ sc start ms-nfs41-client-service #`)
  354.  
  355.    - DOS devices are virtualised per LSA Logon, so each Logon needs to do
  356. @@ -547,16 +547,16 @@ NFS server side.
  357.  
  358.          $ sc qc ms-nfs41-client-service
  359.  
  360. -  - Start service automatically:
  361. +  - Start service automatically (default):
  362.  
  363.      (`nfsd_debug.exe` will be started automagically, but mounts are not
  364.      restored):
  365.  
  366. -        $ sc config ms-nfs41-client-service start=auto
  367. +        $ /sbin/msnfs41client enableautostartservices
  368.  
  369. -  - Start service manually (default):
  370. +  - Start service manually:
  371.  
  372. -        $ sc config ms-nfs41-client-service start=disabled
  373. +        $ /sbin/msnfs41client disableautostartservices
  374.  
  375.  ### Manual starting the daemon
  376.  
  377. @@ -626,17 +626,14 @@ Mounts created by user "SYSTEM" are usable by all users in a system.
  378.  Example usage:
  379.  
  380.      # Create a file /etc/fstab.msnfs41client, which list the mounts
  381. -    # which should be available system-wide
  382. +    # which should be mounted system-wide at boot
  383.      $ cat /etc/fstab.msnfs41client
  384. -    nfs://[fe80::21b:1bff:fec3:7713]//bigdisk       V       nfs     rw      0       0
  385. +    nfs://[fe80::21b:1bff:fec3:7713]//bigdisk       N:       nfs     sec=sys,rw      0       0
  386.      # run "ms-nfs41-client-globalmountall-service", which runs
  387.      # /sbin/mountall_msnfs41client as user "SYSTEM" to read
  388.      # /etc/fstab.msnfs41client and mount the matching filesystems
  389.      sc start ms-nfs41-client-globalmountall-service
  390.  
  391. -BUG: "ms-nfs41-client-globalmountall-service" currently does not wait
  392. -until `nfsd*.exe` is available for accepting mounts.
  393. -
  394.  ### WSL usage
  395.  
  396.  Example 1: Mount Windows NFSv4.2 share via Windows drive letter
  397. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  398. index 56be0fd..f6d7dec 100755
  399. --- a/cygwin/devel/msnfs41client.bash
  400. +++ b/cygwin/devel/msnfs41client.bash
  401. @@ -123,6 +123,8 @@ function nfsclient_install
  402.         set -o xtrace
  403.         set -o errexit
  404.  
  405. +       typeset cmd="$1"
  406. +
  407.         typeset use_secureboot=false
  408.  
  409.         # switch to the location where this script is installed,
  410. @@ -232,9 +234,6 @@ function nfsclient_install
  411.                 --type 'manual' \
  412.                 --chdir "$PWD"
  413.  
  414. -       # query new 'ms-nfs41-client-service'
  415. -       sc query 'ms-nfs41-client-service'
  416. -
  417.         #
  418.         # install "mountall_msnfs41client" as system service
  419.         # 'ms-nfs41-client-globalmountall-service'
  420. @@ -272,12 +271,19 @@ function nfsclient_install
  421.                 {
  422.                         printf '#\n'
  423.                         printf '# /etc/fstab.msnfs41client - used by /sbin/mountall_msnfs41client\n'
  424. +                       printf '# at system boot time to mount global shares\n'
  425.                         printf '#\n\n'
  426. -                       printf '# nfs://[fe80::21b:1bff:fec3:7713]//bigdisk\tV\tnfs\trw\t0\t0\n\n'
  427. +                       printf '# nfs://[fe80::21b:1bff:fec3:7713]//bigdisk\tN:\tnfs\tsec=sys,rw\t0\t0\n\n'
  428.                         printf '# EOF.\n'
  429.                 } >'/etc/fstab.msnfs41client'
  430.         fi
  431.  
  432. +       if [[ "$cmd" != *devinstall* ]] ; then
  433. +               nfsclient_enable_autostartservices
  434. +       fi
  435. +
  436. +       # query new 'ms-nfs41-client-service'
  437. +       sc query 'ms-nfs41-client-service'
  438.         # query new 'ms-nfs41-client-globalmountall-service'
  439.         sc query 'ms-nfs41-client-globalmountall-service'
  440.  
  441. @@ -315,6 +321,18 @@ function nfsclient_install
  442.         return 0
  443.  }
  444.  
  445. +function nfsclient_enable_autostartservices
  446. +{
  447. +       sc config 'ms-nfs41-client-service' start=auto
  448. +       sc config 'ms-nfs41-client-globalmountall-service' start=auto
  449. +}
  450. +
  451. +function nfsclient_disable_autostartservices
  452. +{
  453. +       sc config 'ms-nfs41-client-service' start=disabled
  454. +       sc config 'ms-nfs41-client-globalmountall-service' start=disabled
  455. +}
  456. +
  457.  function nfsclient_adddriver
  458.  {
  459.         set -o nounset
  460. @@ -921,7 +939,7 @@ function main
  461.         PATH+=':/cygdrive/c/Users/roland_mainz/download/DebugView'
  462.  
  463.         case "$cmd" in
  464. -               'install')
  465. +               'install' | 'devinstall')
  466.                         check_machine_arch || (( numerr++ ))
  467.                         require_cmd 'regtool.exe' || (( numerr++ ))
  468.                         require_cmd 'cygrunsrv.exe' || (( numerr++ ))
  469. @@ -937,7 +955,31 @@ function main
  470.                         fi
  471.                         (( numerr > 0 )) && return 1
  472.  
  473. -                       nfsclient_install
  474. +                       nfsclient_install "$cmd"
  475. +                       return $?
  476. +                       ;;
  477. +               'enableautostartservices')
  478. +                       check_machine_arch || (( numerr++ ))
  479. +                       require_cmd 'sc.exe' || (( numerr++ ))
  480. +                       if ! is_windows_admin_account ; then
  481. +                               printf $"%s: %q requires Windows Adminstator permissions.\n" "$0" "$cmd"
  482. +                               (( numerr++ ))
  483. +                       fi
  484. +                       (( numerr > 0 )) && return 1
  485. +
  486. +                       nfsclient_enable_autostartservices
  487. +                       return $?
  488. +                       ;;
  489. +               'disableautostartservices')
  490. +                       check_machine_arch || (( numerr++ ))
  491. +                       require_cmd 'sc.exe' || (( numerr++ ))
  492. +                       if ! is_windows_admin_account ; then
  493. +                               printf $"%s: %q requires Windows Adminstator permissions.\n" "$0" "$cmd"
  494. +                               (( numerr++ ))
  495. +                       fi
  496. +                       (( numerr > 0 )) && return 1
  497. +
  498. +                       nfsclient_disable_autostartservices
  499.                         return $?
  500.                         ;;
  501.                 #
  502. diff --git a/docs/README.xml b/docs/README.xml
  503. index 6fc896a..1252843 100644
  504. --- a/docs/README.xml
  505. +++ b/docs/README.xml
  506. @@ -524,7 +524,7 @@ $ /sbin/msnfs41client install
  507.                      <para>requires "Administrator" account, and one nfsd client daemon is used for all users on a machine.</para>
  508.                    </listitem>
  509.                    <listitem>
  510. -                    <para>The "ms-nfs41-client-service" service is installed by default as "disabled" and therefore always requires a "manual" start (e.g., <command>$ sc start ms-nfs41-client-service #</command>)</para>
  511. +                    <para>The "ms-nfs41-client-service" service is installed by default as "enabled" and therefore does not require a "manual" start (e.g., <command>$ sc start ms-nfs41-client-service #</command>)</para>
  512.                    </listitem>
  513.                    <listitem>
  514.                      <para>DOS devices are virtualised per LSA Logon, so each Logon needs to do a separate <command>nfs_mount.exe</command> to mount a NFSv4 share. The exception are mounts created by user "SYSTEM", such mounts are available to all users/logons. (see <command>PsExec</command> or function "su_system" in <filename>msnfs41client.bash</filename> how to run a process as user "SYSTEM")</para>
  515. @@ -554,13 +554,13 @@ $ /sbin/msnfs41client install
  516.                      <programlisting>$ sc qc ms-nfs41-client-service</programlisting>
  517.                    </listitem>
  518.                    <listitem>
  519. -                    <para>Start service automatically:</para>
  520. +                    <para>Start service automatically (default):</para>
  521.                      <para>(<command>nfsd_debug.exe</command> will be started automagically, but mounts are not restored):</para>
  522. -                    <programlisting>$ sc config ms-nfs41-client-service start=auto</programlisting>
  523. +                    <programlisting>$ /sbin/msnfs41client enableautostartservices</programlisting>
  524.                    </listitem>
  525.                    <listitem>
  526. -                    <para>Start service manually (default):</para>
  527. -                    <programlisting>$ sc config ms-nfs41-client-service start=disabled</programlisting>
  528. +                    <para>Start service manually:</para>
  529. +                    <programlisting>$ /sbin/msnfs41client disableautostartservices</programlisting>
  530.                    </listitem>
  531.                  </itemizedlist>
  532.                </para>
  533. @@ -634,14 +634,13 @@ $ net use '\0.49.202.230@2049\nfs4\net_tmpfs2' /delete</programlisting>
  534.          <title>Global/System-wide mounts</title>
  535.          <para>Mounts created by user "SYSTEM" are usable by all users in a system. Example usage:</para>
  536.          <programlisting># Create a file /etc/fstab.msnfs41client, which list the mounts
  537. -# which should be available system-wide
  538. +# which should be mounted system-wide at boot
  539.  $ cat /etc/fstab.msnfs41client
  540. -nfs://[fe80::21b:1bff:fec3:7713]//bigdisk       V       nfs     rw      0       0
  541. +nfs://[fe80::21b:1bff:fec3:7713]//bigdisk       N:       nfs     sec=sys,rw      0       0
  542.  # run "ms-nfs41-client-globalmountall-service", which runs
  543.  # /sbin/mountall_msnfs41client as user "SYSTEM" to read
  544.  # /etc/fstab.msnfs41client and mount the matching filesystems
  545.  sc start ms-nfs41-client-globalmountall-service</programlisting>
  546. -        <para>BUG: "ms-nfs41-client-globalmountall-service" currently does not wait until <command>nfsd*.exe</command> is available for accepting mounts.</para>
  547.        </section>
  548.  
  549.        <section xml:id="wsl-usage">
  550. --
  551. 2.45.1
  552.  
  553. From c6c63900a5e644b9562d3cbb53da50b9a4c9f9fc Mon Sep 17 00:00:00 2001
  554. From: Dan Shelton <dan.f.shelton@gmail.com>
  555. Date: Thu, 7 Aug 2025 15:27:34 +0200
  556. Subject: [PATCH 7/8] sys: Fix build with all |DEBUG_*| flags in
  557.  sys/nfs41sys_buildconfig.h enabled
  558.  
  559. Fix build with all |DEBUG_*| flags in sys/nfs41sys_buildconfig.h enabled.
  560.  
  561. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  562. ---
  563. sys/nfs41sys_dir.c    | 2 +-
  564.  sys/nfs41sys_driver.c | 5 +++--
  565.  sys/nfs41sys_driver.h | 2 ++
  566.  3 files changed, 6 insertions(+), 3 deletions(-)
  567.  
  568. diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
  569. index 7f565f5..d2765be 100644
  570. --- a/sys/nfs41sys_dir.c
  571. +++ b/sys/nfs41sys_dir.c
  572. @@ -164,7 +164,7 @@ NTSTATUS unmarshal_nfs41_dirquery(
  573.      return status;
  574.  }
  575.  
  576. -static void print_debug_filedirquery_header(
  577. +void print_debug_filedirquery_header(
  578.      PRX_CONTEXT RxContext)
  579.  {
  580.      print_debug_header(RxContext);
  581. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  582. index 20ac368..628789f 100644
  583. --- a/sys/nfs41sys_driver.c
  584. +++ b/sys/nfs41sys_driver.c
  585. @@ -728,7 +728,8 @@ VOID nfs41_invalidate_fobx_entry(
  586.                  nfs41_fcb_list_entry, next);
  587.          if (cur->nfs41_fobx == nfs41_fobx) {
  588.  #ifdef DEBUG_CLOSE
  589. -            DbgP("nfs41_invalidate_fobx_entry: Found match for fobx=0x%p\n", fobx);
  590. +            DbgP("nfs41_invalidate_fobx_entry: Found match for nfs41_fobx=0x%p\n",
  591. +                nfs41_fobx);
  592.  #endif
  593.              cur->nfs41_fobx = NULL;
  594.              break;
  595. @@ -736,7 +737,7 @@ VOID nfs41_invalidate_fobx_entry(
  596.          if (pEntry->Flink == &openlist.head) {
  597.  #ifdef DEBUG_CLOSE
  598.              DbgP("nfs41_invalidate_fobx_entry: reached EOL looking "
  599. -                "for fobx 0x%p\n", fobx);
  600. +                "for nfs41_fobx=0x%p\n", nfs41_fobx);
  601.  #endif
  602.              break;
  603.          }
  604. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  605. index 87047f9..6f57818 100644
  606. --- a/sys/nfs41sys_driver.h
  607. +++ b/sys/nfs41sys_driver.h
  608. @@ -596,6 +596,8 @@ NTSTATUS marshal_nfs41_dirquery(
  609.  NTSTATUS unmarshal_nfs41_dirquery(
  610.      nfs41_updowncall_entry *cur,
  611.      unsigned char **buf);
  612. +void print_debug_filedirquery_header(
  613. +    PRX_CONTEXT RxContext);
  614.  NTSTATUS check_nfs41_dirquery_args(
  615.      IN PRX_CONTEXT RxContext);
  616.  NTSTATUS nfs41_QueryDirectory(
  617. --
  618. 2.45.1
  619.  
  620. From a150a36d3c43febf96d7744c1f2031cab2da31d8 Mon Sep 17 00:00:00 2001
  621. From: Roland Mainz <roland.mainz@nrubsig.org>
  622. Date: Thu, 7 Aug 2025 15:59:39 +0200
  623. Subject: [PATCH 8/8] cygwin: msnfs41client install should no longer disable
  624.  Dfsc
  625.  
  626. $ msnfs41client install # should no longer disable Dfsc,
  627. since we use UNC names wit \\hostname@portnumber\... #, which no
  628. longer collides with normal SMB usage.
  629.  
  630. Reported-by: Lionel Cons <Lionelcons1972@gmail.com>
  631. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  632. ---
  633. cygwin/devel/msnfs41client.bash | 10 +++++++---
  634.  1 file changed, 7 insertions(+), 3 deletions(-)
  635.  
  636. diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
  637. index f6d7dec..d00e59e 100755
  638. --- a/cygwin/devel/msnfs41client.bash
  639. +++ b/cygwin/devel/msnfs41client.bash
  640. @@ -192,9 +192,13 @@ function nfsclient_install
  641.         fi
  642.  
  643.         # disable DFS
  644. -       sc query Dfsc
  645. -       sc stop Dfsc || true
  646. -       sc config Dfsc start=disabled
  647. +       #
  648. +       # Notes:
  649. +       # - no longer needed because we have the UNC hostname@port layout
  650. +       # - Use $ sc config Dfsc start=system to undo this
  651. +       #sc query Dfsc
  652. +       #sc stop Dfsc || true
  653. +       #sc config Dfsc start=disabled
  654.  
  655.         sc query nfs41_driver
  656.         domainname
  657. --
  658. 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