- From ac2d0ed7114f93a69310bb4125d423653f35bd7f Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 14 Oct 2025 13:08:36 +0200
- Subject: [PATCH 1/5] dll: Add more debug output to network provider
- Add more debug output to network provider.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- dll/nfs41_np.c | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
- diff --git a/dll/nfs41_np.c b/dll/nfs41_np.c
- index 37209ea..52d6e84 100644
- --- a/dll/nfs41_np.c
- +++ b/dll/nfs41_np.c
- @@ -1343,7 +1343,9 @@ NPGetResourceParent(
- LPVOID lpBuffer,
- LPDWORD lpBufferSize )
- {
- - DbgP((L"NPGetResourceParent: WN_NOT_SUPPORTED\n"));
- + DbgP((L"NPGetResourceParent(pNetResource->lpRemoteName='%ls'): "
- + "WN_NOT_SUPPORTED\n",
- + lpNetResource->lpRemoteName));
- return WN_NOT_SUPPORTED;
- }
- @@ -1354,7 +1356,9 @@ NPGetResourceInformation(
- __inout LPDWORD lpBufferSize,
- __deref_out LPWSTR *lplpSystem )
- {
- - DbgP((L"NPGetResourceInformation: WN_NOT_SUPPORTED\n"));
- + DbgP((L"NPGetResourceInformation(lpNetResource->lpRemoteName='%ls'): "
- + "WN_NOT_SUPPORTED\n",
- + lpNetResource->lpRemoteName));
- return WN_NOT_SUPPORTED;
- }
- --
- 2.51.0
- From ac146ca60d11ab2037b5e657942b6610bb1a0469 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 16 Oct 2025 18:17:07 +0200
- Subject: [PATCH 2/5]
- README.md,daemon,dll,docs,mount,nfs41_build_features.h,sys,tests: Move NFS
- tag into UNC path server part
- Move NFS tag into UNC path server part. Previously we used
- /nfs4/ and /pubnfs4/ subdirs in the UNC root to mark this
- as NFSv4 or "public NFSv4" filesystem. But this caused
- issues, as Windows software was not able to deal with issues that
- the mount points for filesystems were not in the immediate UNC
- root, and there was no room to store additional transport attributes,
- e.g. having both TLS and non-TLS mounts to the same server.
- We fix these issues by putting the "NFS"/"PUBNFS" tags into the
- UNC server part, like Microsoft Windows WebDAV driver does it
- (e.g. see
- https://learn.microsoft.com/en-us/windows/win32/api/davclnt/nf-davclnt-davgethttpfromuncpath)
- This commits marks a "flag day" (e.g. incompatibilty for existing
- installations), because the layout of the UNC paths changes, e.g.
- '\\10.49.202.230@2049\nfs4\net_tmpfs2' becomes
- '\\10.49.202.230@NFS@2049\net_tmpfs2'.
- Reported-by: Lionel Cons <lionelcons1972@gmail.com>
- Reported-by: Cedric Blancher <cedric.blancher@gmail.com>
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- README.md | 28 +++----
- daemon/mount.c | 15 +++-
- dll/nfs41_np.c | 32 +++-----
- docs/README.xml | 28 +++----
- mount/enum.c | 94 ++++++++++------------
- mount/mount.c | 23 +++---
- nfs41_build_features.h | 11 ---
- sys/nfs41sys_buildconfig.h | 2 -
- sys/nfs41sys_driver.c | 6 +-
- sys/nfs41sys_driver.h | 2 -
- sys/nfs41sys_mount.c | 161 +++++++++++++++----------------------
- tests/manual_testing.txt | 24 +++---
- 12 files changed, 191 insertions(+), 235 deletions(-)
- diff --git a/README.md b/README.md
- index 01cbb9f..8d34637 100644
- --- a/README.md
- +++ b/README.md
- @@ -85,12 +85,12 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11 & Windows Server
- - `/sbin/nfs_mount` prints UNC paths in Win32+Cygwin/MSYS2 formats
- - Cygwin/MSYS2 bash+ksh93 support UNC paths, e.g.,
- - `cd //derfwnb4966@2049/nfs4/bigdisk/mysqldb4/`
- + `cd //derfwnb4966@NFS@2049/bigdisk/mysqldb4/`
- - Symlinks on NFS can redirect to other filesystems via UNC syntax and
- work with Cygwin, MSYS2, cmd.exe, powershell etc., e.g.:
- - mklink /D symlnk1_to_h_tmp \\lab17@2049\nfs4\export\home\rsm\tmp
- + mklink /D symlnk1_to_h_tmp \\lab17@NFS@2049\export\home\rsm\tmp
- - WSL support
- @@ -507,7 +507,7 @@ Run the NFSv4 client daemon manually:
- Mount a filesystem to drive N: and use it
- $ /sbin/nfs_mount -o rw N 10.49.202.230:/net_tmpfs2
- - Successfully mounted '10.49.202.230@2049' to drive 'N:'
- + Successfully mounted '10.49.202.230@NFS@2049' to drive 'N:'
- $ cd /cygdrive/n/
- $ ls -la
- total 4
- @@ -527,10 +527,10 @@ Unmount filesystem:
- Mount a filesystem WITHOUT a dos drive assigned and use it via UNC path
- $ /sbin/nfs_mount -o rw 10.49.202.230:/net_tmpfs2
- - Successfully mounted '10.49.202.230@2049' to drive '\0.49.202.230@2049\nfs4\net_tmpfs2'
- - $ cygpath -u '\0.49.202.230@2049\nfs4\net_tmpfs2'
- - //10.49.202.230@2049/nfs4/net_tmpfs2
- - $ cd '//10.49.202.230@2049/nfs4/net_tmpfs2'
- + Successfully mounted '10.49.202.230@NFS@2049' to drive '\0.49.202.230@NFS@2049\net_tmpfs2'
- + $ cygpath -u '\0.49.202.230@NFS@2049\net_tmpfs2'
- + //10.49.202.230@NFS@2049/net_tmpfs2
- + $ cd '//10.49.202.230@NFS@2049/net_tmpfs2'
- $ ls -la
- total 4
- drwxrwxrwt 5 Unix_User+0 Unix_Group+0 100 Dec 7 14:17 .
- @@ -541,10 +541,10 @@ Mount a filesystem WITHOUT a dos drive assigned and use it via UNC path
- Unmount filesystem:
- - $ cd ~ && /sbin/nfs_umount '\0.49.202.230@2049\nfs4\net_tmpfs2'
- + $ cd ~ && /sbin/nfs_umount '\0.49.202.230@NFS@2049\net_tmpfs2'
- # OR
- $ cd ~
- - $ net use '\0.49.202.230@2049\nfs4\net_tmpfs2' /delete
- + $ net use '\0.49.202.230@NFS@2049\net_tmpfs2' /delete
- List mounted NFSv4.2 filesystems:
- @@ -574,7 +574,7 @@ Example 1: Mount Windows NFSv4.2 share via Windows drive letter
- Mount NFSv4.2 share in Windows to drive letter 'N':
- $ /sbin/nfs_mount -o rw 'N' nfs://10.49.202.230//bigdisk
- - Successfully mounted '10.49.202.230@2049' to drive 'N:'
- + Successfully mounted '10.49.202.230@NFS@2049' to drive 'N:'
- Within WSL mount drive letter 'N' to `/mnt/n`
- @@ -587,13 +587,13 @@ Example 2: Mount Windows NFSv4.2 share via UNC path:
- Mount NFSv4.2 share in Windows
- $ /sbin/nfs_mount -o rw nfs://10.49.202.230//bigdisk
- - Successfully mounted '10.49.202.230@2049' to drive '\0.49.202.230@2049\nfs4\bigdisk'
- + Successfully mounted '10.49.202.230@NFS@2049' to drive '\0.49.202.230@NFS@2049\bigdisk'
- Within WSL mount UNC path returned by `/sbin/nfs_mount`
- $ sudo bash
- $ mkdir /mnt/bigdisk
- - $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
- + $ mount -t drvfs '\0.49.202.230@NFS@2049\bigdisk' /mnt/bigdisk
- **Known issues with WSL:**
- @@ -633,7 +633,7 @@ Within WSL mount UNC path returned by `/sbin/nfs_mount`
- - Cygwin/MSYS2 symlinks are supported, but might require
- `$ fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1 #`.
- This includes symlinks to UNC paths, e.g., as Administrator
- - `$ cmd /c 'mklink /d c:\home\rmainz \\derfwpc5131_ipv6@2049\nfs4\export\home2\rmainz' #`
- + `$ cmd /c 'mklink /d c:\home\rmainz \\derfwpc5131_ipv6@NFS@2049\export\home2\rmainz' #`
- and then `$ cd /cygdrive/c/home/rmainz/ #` should work
- - performance: All binaries are built without any optimisation, so the
- @@ -771,7 +771,7 @@ Within WSL mount UNC path returned by `/sbin/nfs_mount`
- Example:
- {Fehler beim verzoegerten Schreibvorgang} Nicht alle Daten fuer die
- - Datei "\\34.159.25.153@2049\nfs4\export\nfs4export\gcc\lto-dump.exe"
- + Datei "\\34.159.25.153@NFS@2049\exportexport\gcc\lto-dump.exe"
- konnten gespeichert werden. Daten gingen verloren.
- Dieser Fehler wurde von dem Server zurueckgegeben, auf dem sich die
- Datei befindet. Versuchen Sie, die Datei woanders zu speichern.
- diff --git a/daemon/mount.c b/daemon/mount.c
- index 81f1b30..1fa78ec 100644
- --- a/daemon/mount.c
- +++ b/daemon/mount.c
- @@ -172,14 +172,25 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
- (void)strcpy_s(hostname, sizeof(hostname), args->hostport);
- s = strchr(hostname, '@');
- + if (s) {
- + char *tmps;
- + *s++ = '\0';
- + tmps = strchr(s, '@');
- + if (tmps)
- + s = tmps;
- + }
- +
- if (s) {
- *s++ = '\0';
- port = atoi(s);
- if ((port < 1) || (port > 65535)) {
- status = ERROR_BAD_ARGUMENTS;
- - eprintf("handle_mount: bad port number %d specified in "
- + eprintf("handle_mount: "
- + "bad port number '%s' -> %d specified in "
- "hostport '%s'\n",
- - port, args->hostport);
- + s,
- + port,
- + args->hostport);
- goto out;
- }
- diff --git a/dll/nfs41_np.c b/dll/nfs41_np.c
- index 52d6e84..d305614 100644
- --- a/dll/nfs41_np.c
- +++ b/dll/nfs41_np.c
- @@ -274,7 +274,8 @@ static DWORD StoreConnectionInfo(
- LUID authenticationid = { .LowPart = 0, .HighPart = 0L };
- #endif /* NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE */
- - DbgP((L"--> StoreConnectionInfo\n"));
- + DbgP((L"--> StoreConnectionInfo(LocalName='%ls',ConnectionName='%ls')\n",
- + LocalName, ConnectionName));
- #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
- (void)get_token_authenticationid(GetCurrentThreadEffectiveToken(),
- @@ -603,14 +604,18 @@ NPAddConnection3(
- }
- ServerName[i] = L'\0';
- + /* Check for "@NFS" or "@PUBNFS" tag in UNC path */
- + if ((wcsstr(ServerName, L"@NFS") == NULL) &&
- + (wcsstr(ServerName, L"@PUBNFS") == NULL)) {
- + DbgP((L"ServerName name '%ls' not tagged with "
- + "'@NFS' or '@PUBNFS'\n",
- + ServerName));
- + Status = WN_BAD_NETNAME;
- + goto out;
- + }
- +
- (void)StringCchCatW(ConnectionName,
- NFS41_SYS_MAX_PATH_LEN, ServerName);
- -#ifndef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- - /* insert the "nfs4" in between the server name and the path,
- - * just to make sure all calls to our driver come thru this */
- - (void)StringCchCatW(ConnectionName,
- - NFS41_SYS_MAX_PATH_LEN, L"\\nfs4");
- -#endif /* NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX */
- #ifdef CONVERT_2_UNIX_SLASHES
- /* convert all windows slashes to unix slashes */
- @@ -645,7 +650,7 @@ NPAddConnection3(
- * from looking up the path from the device letter
- * (e.g. device letter does not show up in /cygdrive/).
- * nfsd_daemon will still see the full path with all backslashes
- - * (e.g. "msg=mount(hostport='derfwnb4966_ipv4@2049',
- + * (e.g. "msg=mount(hostport='derfwnb4966_ipv4@NFS@2049',
- * path='\\\\\\\\\net_tmpfs2\\test2')"
- */
- {
- @@ -661,17 +666,6 @@ NPAddConnection3(
- }
- #endif
- -#ifdef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- - if (wcsncmp(&p[i], L"\\nfs4", 5) &&
- - wcsncmp(&p[i], L"\\pubnfs4", 8)) {
- - DbgP((L"Connection name '%ls' not prefixed with "
- - "'\\nfs41' or '\\pubnfs41'\n",
- - &p[i]));
- - Status = WN_BAD_NETNAME;
- - goto out;
- - }
- -#endif /* NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX */
- -
- (void)StringCchCatW(ConnectionName,
- NFS41_SYS_MAX_PATH_LEN, &p[i]);
- DbgP((L"Full Connect Name: '%ls'\n", ConnectionName));
- diff --git a/docs/README.xml b/docs/README.xml
- index 5830f66..a1dbd2c 100644
- --- a/docs/README.xml
- +++ b/docs/README.xml
- @@ -71,11 +71,11 @@
- <para><filename>/sbin/nfs_mount</filename> prints UNC paths in Win32+Cygwin/MSYS2 formats</para>
- </listitem>
- <listitem>
- - <para>Cygwin/MSYS2 bash+ksh93 support UNC paths, e.g., <command>cd //derfwnb4966@2049/nfs4/bigdisk/mysqldb4/</command></para>
- + <para>Cygwin/MSYS2 bash+ksh93 support UNC paths, e.g., <command>cd //derfwnb4966@NFS@2049/bigdisk/mysqldb4/</command></para>
- </listitem>
- <listitem>
- <para>Symlinks on NFS can redirect to other filesystems via UNC syntax and work with Cygwin, MSYS2, cmd.exe, powershell etc., e.g.:
- - <programlisting>mklink /D symlnk1_to_h_tmp \\lab17@2049\nfs4\export\home\rsm\tmp</programlisting>
- + <programlisting>mklink /D symlnk1_to_h_tmp \\lab17@NFS@2049\export\home\rsm\tmp</programlisting>
- </para>
- </listitem>
- </itemizedlist>
- @@ -647,7 +647,7 @@ $ /sbin/msnfs41client install
- <title>Basic usage</title>
- <para>Mount a filesystem to drive N: and use it</para>
- <programlisting>$ /sbin/nfs_mount -o rw N 10.49.202.230:/net_tmpfs2
- -Successfully mounted '10.49.202.230@2049' to drive 'N:'
- +Successfully mounted '10.49.202.230@NFS@2049' to drive 'N:'
- $ cd /cygdrive/n/
- $ ls -la
- total 4
- @@ -665,10 +665,10 @@ $ net use N: /delete</programlisting>
- <para>Mount a filesystem WITHOUT a dos drive assigned and use it via UNC path</para>
- <programlisting>$ /sbin/nfs_mount -o rw 10.49.202.230:/net_tmpfs2
- -Successfully mounted '10.49.202.230@2049' to drive '\0.49.202.230@2049\nfs4\net_tmpfs2'
- -$ cygpath -u '\0.49.202.230@2049\nfs4\net_tmpfs2'
- -//10.49.202.230@2049/nfs4/net_tmpfs2
- -$ cd '//10.49.202.230@2049/nfs4/net_tmpfs2'
- +Successfully mounted '10.49.202.230@NFS@2049' to drive '\0.49.202.230@NFS@2049\net_tmpfs2'
- +$ cygpath -u '\0.49.202.230@NFS@2049\net_tmpfs2'
- +//10.49.202.230@NFS@2049/net_tmpfs2
- +$ cd '//10.49.202.230@NFS@2049/net_tmpfs2'
- $ ls -la
- total 4
- drwxrwxrwt 5 Unix_User+0 Unix_Group+0 100 Dec 7 14:17 .
- @@ -677,10 +677,10 @@ drwxr-xr-x 3 Unix_User+197608 Unix_Group+197121 80 Dec 12 16:24 10492030
- drwxr-xr-x 3 Unix_User+197608 Unix_Group+197121 60 Dec 13 17:58 directory_t
- drwxr-xr-x 3 Unix_User+197608 Unix_Group+197121 60 Dec 7 11:01 test2</programlisting>
- <para>Unmount filesystem:</para>
- - <programlisting>$ cd ~ && /sbin/nfs_umount '\0.49.202.230@2049\nfs4\net_tmpfs2'
- + <programlisting>$ cd ~ && /sbin/nfs_umount '\0.49.202.230@NFS@2049\net_tmpfs2'
- # OR
- $ cd ~
- -$ net use '\0.49.202.230@2049\nfs4\net_tmpfs2' /delete</programlisting>
- +$ net use '\0.49.202.230@NFS@2049\net_tmpfs2' /delete</programlisting>
- <para>List mounted NFSv4.2 filesystems:</para>
- <programlisting>$ /sbin/nfs_mount</programlisting>
- </section>
- @@ -704,7 +704,7 @@ sc start ms-nfs41-client-globalmountall-service</programlisting>
- <para>Example 1: Mount Windows NFSv4.2 share via Windows drive letter</para>
- <para>Mount NFSv4.2 share in Windows to drive letter 'N':</para>
- <programlisting>$ /sbin/nfs_mount -o rw 'N' nfs://10.49.202.230//bigdisk
- -Successfully mounted '10.49.202.230@2049' to drive 'N:'</programlisting>
- +Successfully mounted '10.49.202.230@NFS@2049' to drive 'N:'</programlisting>
- <para>Within WSL mount drive letter 'N' to <filename>/mnt/n</filename></para>
- <programlisting>$ sudo bash
- $ mkdir /mnt/n
- @@ -713,11 +713,11 @@ $ mount -t drvfs N: /mnt/n</programlisting>
- <para>Example 2: Mount Windows NFSv4.2 share via UNC path:</para>
- <para>Mount NFSv4.2 share in Windows</para>
- <programlisting>$ /sbin/nfs_mount -o rw nfs://10.49.202.230//bigdisk
- -Successfully mounted '10.49.202.230@2049' to drive '\0.49.202.230@2049\nfs4\bigdisk'</programlisting>
- +Successfully mounted '10.49.202.230@NFS@2049' to drive '\0.49.202.230@NFS@2049\bigdisk'</programlisting>
- <para>Within WSL mount UNC path returned by <filename>/sbin/nfs_mount</filename></para>
- <programlisting>$ sudo bash
- $ mkdir /mnt/bigdisk
- -$ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk</programlisting>
- +$ mount -t drvfs '\0.49.202.230@NFS@2049\bigdisk' /mnt/bigdisk</programlisting>
- <para><emphasis role="strong">Known issues with WSL:</emphasis></para>
- <itemizedlist>
- @@ -750,7 +750,7 @@ $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk</programlistin
- </para>
- </listitem>
- <listitem>
- - <para>Cygwin/MSYS2 symlinks are supported, but might require <command>$ fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1 #</command>. This includes symlinks to UNC paths, e.g., as Administrator <command>$ cmd /c 'mklink /d c:\home\rmainz \\derfwpc5131_ipv6@2049\nfs4\export\home2\rmainz' #</command> and then <command>$ cd /cygdrive/c/home/rmainz/ #</command> should work</para>
- + <para>Cygwin/MSYS2 symlinks are supported, but might require <command>$ fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1 #</command>. This includes symlinks to UNC paths, e.g., as Administrator <command>$ cmd /c 'mklink /d c:\home\rmainz \\derfwpc5131_ipv6@NFS@2049\export\home2\rmainz' #</command> and then <command>$ cd /cygdrive/c/home/rmainz/ #</command> should work</para>
- </listitem>
- <listitem>
- <para>performance: All binaries are built without any optimisation, so the filesystem is much slower than it could be.</para>
- @@ -870,7 +870,7 @@ A::EVERYONE@:rtcy</programlisting>
- <listitem>
- <para>Windows event log can list errors like "MUP 0xc0000222" (<literal>|STATUS_LOST_WRITEBEHIND_DATA|</literal>) in case the disk on the NFSv4 server is full and outstanding writes from a memory-mapped file fail. Example:</para>
- <programlisting>{Fehler beim verzoegerten Schreibvorgang} Nicht alle Daten fuer die
- -Datei "\\34.159.25.153@2049\nfs4\export\nfs4export\gcc\lto-dump.exe"
- +Datei "\\34.159.25.153@NFS@2049\exportexport\gcc\lto-dump.exe"
- konnten gespeichert werden. Daten gingen verloren.
- Dieser Fehler wurde von dem Server zurueckgegeben, auf dem sich die
- Datei befindet. Versuchen Sie, die Datei woanders zu speichern.</programlisting>
- diff --git a/mount/enum.c b/mount/enum.c
- index 11f8a6d..99d1be3 100644
- --- a/mount/enum.c
- +++ b/mount/enum.c
- @@ -1,5 +1,6 @@
- /* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- @@ -57,26 +58,14 @@ void PrintMountLine(
- wchar_t *b;
- LPCWSTR s;
- wchar_t sc;
- -#ifndef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- - unsigned int backslash_counter;
- -#endif
- bool is_pubfh = false;
- + bool found_unc_nfs_tag = false;
- - for(b = cygwin_unc_buffer, s = remote
- -#ifndef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- - , backslash_counter = 0
- -#endif
- - ;
- + for(b = cygwin_unc_buffer, s = remote ;
- (sc = *s++) != L'\0' ; ) {
- switch(sc) {
- case L'\\':
- *b++ = L'/';
- -#ifndef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- - if (backslash_counter++ == 2) {
- - (void)wcscpy_s(b, 6, L"nfs4/");
- - b+=5;
- - }
- -#endif
- break;
- default:
- *b++ = sc;
- @@ -128,8 +117,8 @@ void PrintMountLine(
- unsigned int slash_counter = 0;
- char *utf8unc = wcs2utf8str(cygwin_unc_buffer);
- - if (!utf8unc)
- - return;
- + if (utf8unc == NULL)
- + goto out;
- char *utf8unc_p = utf8unc;
- char *us = cygwin_nfsurl_buffer;
- @@ -153,43 +142,47 @@ void PrintMountLine(
- slash_counter++;
- /*
- - * Skip "nfs4", but not the last '/' to make the nfs://-URL
- - * an absolute URL, not a relative nfs://-URL.
- - * (This assumes that all input strings have "nfs4/"!)
- + * Intercept "tags" in UNC hostnames, e.g.
- + * "\hostname@TAG1@TAG2@port\path"
- */
- - if (slash_counter == 1) {
- - *us++ = uc;
- - if (strncmp(utf8unc_p, "pubnfs4/", 8) == 0) {
- - /*
- - * Skip "pubnfs4/", the trailing slash is skipped
- - * because public nfs://-URLs must be relative to
- - * the pubfh
- - */
- - utf8unc_p += 8;
- - slash_counter++;
- - is_pubfh = true;
- - }
- - else if (strncmp(utf8unc_p, "nfs4/", 5) == 0) {
- - /* Skip "nfs4" */
- - utf8unc_p += 4;
- - }
- - else {
- - (void)fwprintf(stderr,
- - L"PrintMountLine: ## Internal error, "
- - "unknown provider prefix, utf8unc_p='%s'\n",
- - utf8unc_p);
- - return;
- + if (uc == '@') {
- + /* |slash_counter == 0| means we are processing the UNC hostname */
- + if (slash_counter == 0) {
- + if (found_unc_nfs_tag) {
- + /*
- + * Replace '@' for UNC port number with ':' for
- + * URL port number
- + */
- + *us++ = ':';
- + continue;
- + }
- + else {
- + if (strncmp(utf8unc_p, "NFS", 3) == 0) {
- + /* Skip "NFS" */
- + utf8unc_p += 3;
- + found_unc_nfs_tag = true;
- + }
- + else if (strncmp(utf8unc_p, "PUBNFS", 6) == 0) {
- + /* Skip "PUBNFS" */
- + utf8unc_p += 6;
- + is_pubfh = true;
- + found_unc_nfs_tag = true;
- + }
- + else {
- + (void)fwprintf(stderr,
- + L"PrintMountLine: ## Internal error, "
- + "unknown UNC tag, utf8unc_p='%s'\n",
- + utf8unc_p);
- + goto out;
- + }
- + continue;
- + }
- }
- -
- - continue;
- }
- - if ((uc == '@') && (slash_counter == 0)) {
- - *us++ = ':';
- - }
- - else if (printURLShellSafe?
- - (ISVALIDSHELLSAFEURLCHAR(uc)):
- - (ISVALIDURLCHAR(uc))) {
- + if (printURLShellSafe?
- + (ISVALIDSHELLSAFEURLCHAR(uc)):
- + (ISVALIDURLCHAR(uc))) {
- *us++ = uc;
- }
- else {
- @@ -220,6 +213,7 @@ void PrintMountLine(
- (void)wprintf(L"%-8ls\t%-50ls\t%-50ls\t%-50s\n",
- local, remote, cygwin_unc_buffer, cygwin_nfsurl_buffer);
- +out:
- free(utf8unc);
- }
- diff --git a/mount/mount.c b/mount/mount.c
- index a5355aa..daac874 100644
- --- a/mount/mount.c
- +++ b/mount/mount.c
- @@ -1136,12 +1136,21 @@ static DWORD ParseRemoteName(
- * too
- */
- (void)swprintf(srvname, SRVNAME_LEN,
- - L"%ls.ipv6-literal.net@%d", premotename, port);
- + L"%ls.ipv6-literal.net@%ls@%d",
- + premotename,
- + (use_nfspubfh?L"PUBNFS":L"NFS"),
- + port);
- }
- else {
- - /* ALWAYS add port number to hostname, so UNC paths use it too */
- - (void)swprintf(srvname, SRVNAME_LEN, L"%ls@%d",
- - premotename, port);
- + /*
- + * ALWAYS add @NFS/@PUBNFS tag and port number to hostname, so
- + * UNC paths use them too
- + */
- + (void)swprintf(srvname, SRVNAME_LEN,
- + L"%ls@%ls@%d",
- + premotename,
- + (use_nfspubfh?L"PUBNFS":L"NFS"),
- + port);
- }
- /*
- @@ -1174,12 +1183,6 @@ static DWORD ParseRemoteName(
- result = StringCbCatW(pConnectionName, cchConnectionLen, srvname);
- if (FAILED(result))
- goto out;
- -#ifdef NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX
- - result = StringCbCatW(pConnectionName, cchConnectionLen,
- - (use_nfspubfh?(L"\\pubnfs4"):(L"\\nfs4")));
- - if (FAILED(result))
- - goto out;
- -#endif /* NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX */
- if (*pEnd)
- result = StringCchCatW(pConnectionName, cchConnectionLen, pEnd);
- diff --git a/nfs41_build_features.h b/nfs41_build_features.h
- index 27cfb07..274950b 100644
- --- a/nfs41_build_features.h
- +++ b/nfs41_build_features.h
- @@ -53,17 +53,6 @@
- */
- #define NFS41_DRIVER_SID_CACHE 1
- -/*
- - * NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX - nfs_mount.exe and
- - * not nfs41_np does the \nfs4 prefix between servername and path
- - * in UNC paths. As side-effect both normal and Windows UNC paths
- - * always have \nfs4 in them (e.g. \\derfwnb4966_ipv4@2049\nfs4\bigdisk
- - * (Windows UNC) and //derfwnb4966_ipv4@2049/nfs4/bigdisk (Cygwin UNC)
- - * instead of just the the Cygwin UNC paths, which constantly confuses
- - * users madly.
- - */
- -#define NFS41_DRIVER_MOUNT_DOES_NFS4_PREFIX 1
- -
- /*
- * NFS41_DRIVER_STABILITY_HACKS - use horrible
- * hacks to improve stabilty
- diff --git a/sys/nfs41sys_buildconfig.h b/sys/nfs41sys_buildconfig.h
- index aec9c54..760f39d 100644
- --- a/sys/nfs41sys_buildconfig.h
- +++ b/sys/nfs41sys_buildconfig.h
- @@ -50,8 +50,6 @@
- // #define LOOKASIDELISTS_STATS 1
- #endif /* (NTDDI_VERSION >= NTDDI_WIN10_VB) */
- -// #define USE_ENTIRE_PATH_FOR_NETROOT 1
- -
- /* debugging printout defines */
- #if defined(_DEBUG)
- /* Debug build defines follow... */
- diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
- index 38cc8e3..42c1e15 100644
- --- a/sys/nfs41sys_driver.c
- +++ b/sys/nfs41sys_driver.c
- @@ -72,11 +72,9 @@
- /*
- * In order to cooperate with other network providers,
- - * we only claim paths of the format '\\server\nfs4\path' or
- - * '\\server\pubnfs4\path'
- + * we only claim paths of the format '\\server@NFS@<portnum>\path'
- + * or '\\server@PUBNFS@<portnum>\path'
- */
- -DECLARE_CONST_UNICODE_STRING(NfsPrefix, L"\\nfs4");
- -DECLARE_CONST_UNICODE_STRING(PubNfsPrefix, L"\\pubnfs4");
- DECLARE_CONST_UNICODE_STRING(AUTH_NONE_NAME, L"none");
- DECLARE_CONST_UNICODE_STRING(AUTH_SYS_NAME, L"sys");
- DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5_NAME, L"krb5");
- diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
- index 8061528..b984878 100644
- --- a/sys/nfs41sys_driver.h
- +++ b/sys/nfs41sys_driver.h
- @@ -108,8 +108,6 @@ typedef struct __nfs41_timings {
- #define NFS41_MM_POOLTAG_DOWN ('down')
- -DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(NfsPrefix);
- -DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(PubNfsPrefix);
- DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(AUTH_NONE_NAME);
- DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(AUTH_SYS_NAME);
- DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5_NAME);
- diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
- index 7133e72..062b076 100644
- --- a/sys/nfs41sys_mount.c
- +++ b/sys/nfs41sys_mount.c
- @@ -533,7 +533,7 @@ NTSTATUS nfs41_MountConfig_ParseOptions(
- else if (wcsncmp(L"public", Name, NameLen) == 0) {
- /*
- + We ignore this value here, and instead rely on the
- - * /pubnfs4 prefix
- + * "@PUBNFS" tag in the UNC path
- */
- BOOLEAN dummy;
- status = nfs41_MountConfig_ParseBoolean(Option, &usValue,
- @@ -776,81 +776,65 @@ release_sec_ctx:
- }
- static
- -NTSTATUS has_nfs_prefix(
- +NTSTATUS netroot_has_nfs_tag(
- IN PUNICODE_STRING SrvCallName,
- IN PUNICODE_STRING NetRootName,
- - OUT BOOLEAN *pubfh_prefix)
- + OUT bool *pubfh_tag)
- {
- NTSTATUS status = STATUS_BAD_NETWORK_NAME;
- -#ifdef USE_ENTIRE_PATH_FOR_NETROOT
- - if (NetRootName->Length >=
- - (SrvCallName->Length + NfsPrefix.Length)) {
- - size_t len = NetRootName->Length / 2;
- - size_t i;
- - int state = 0;
- + DbgP("netroot_has_nfs_tag: SrvCallName='%wZ' NetRootName='%wZ'\n",
- + SrvCallName, NetRootName);
- - /* Scan \hostname@port\nfs4 */
- - for (i = 0 ; i < len ; i++) {
- - wchar_t ch = NetRootName->Buffer[i];
- + size_t len = NetRootName->Length / 2;
- + size_t i;
- + int state = 0;
- + wchar_t *nfstag = NULL;
- - if ((ch == L'\\') && (state == 0)) {
- - state = 1;
- - continue;
- - }
- - else if ((ch == L'@') && (state == 1)) {
- - state = 2;
- - continue;
- - }
- - else if ((ch == L'\\') && (state == 2)) {
- - state = 3;
- - break;
- - }
- - else if (ch == L'\\') {
- - /* Abort, '\\' with wrong state */
- - break;
- - }
- - }
- + /* Scan \hostname@NFS@port\ or \hostname@PUBNFS@port\ */
- + for (i = 0 ; i < len ; i++) {
- + wchar_t ch = NetRootName->Buffer[i];
- - if (state == 3) {
- - if (!memcmp(&NetRootName->Buffer[i], L"\\nfs4",
- - (4*sizeof(wchar_t))))) {
- - *pubfh_prefix = FALSE;
- - status = STATUS_SUCCESS;
- - }
- - if ((NetRootName->Length >=
- - (SrvCallName->Length + PubNfsPrefix.Length)) &&
- - (!memcmp(&NetRootName->Buffer[i], L"\\pubnfs4",
- - (4*sizeof(wchar_t))))) {
- - *pubfh_prefix = TRUE;
- - status = STATUS_SUCCESS;
- + if ((ch == L'\\') && (state == 0)) {
- + state = 1;
- + continue;
- + }
- + else if ((ch == L'@') && ((state == 1) || (state == 2))) {
- + if (state == 1) {
- + nfstag = &NetRootName->Buffer[i];
- }
- + state = 2;
- + continue;
- + }
- + else if ((ch == L'\\') && (state == 2)) {
- + state = 3;
- + continue;
- + }
- + else if (ch == L'\\') {
- + /* Abort, '\\' with wrong state */
- + break;
- + }
- + else {
- + /* Next character */
- }
- }
- -#else
- - if (NetRootName->Length ==
- - (SrvCallName->Length + NfsPrefix.Length)) {
- - const UNICODE_STRING NetRootPrefix = {
- - NfsPrefix.Length,
- - NetRootName->MaximumLength - SrvCallName->Length,
- - &NetRootName->Buffer[SrvCallName->Length/2]
- - };
- - if (!RtlCompareUnicodeString(&NetRootPrefix, &NfsPrefix, FALSE))
- - *pubfh_prefix = FALSE;
- +
- + DbgP("netroot_has_nfs_tag: state=%d, nfstag=0x%p\n", state, nfstag);
- +
- + if (((state == 2) || (state == 3)) && (nfstag != NULL)) {
- + if (memcmp(nfstag, L"@NFS", (4*sizeof(wchar_t))) == 0) {
- + *pubfh_tag = false;
- status = STATUS_SUCCESS;
- - }
- - else if (NetRootName->Length ==
- - (SrvCallName->Length + PubNfsPrefix.Length)) {
- - const UNICODE_STRING PubNetRootPrefix = {
- - PubNfsPrefix.Length,
- - NetRootName->MaximumLength - SrvCallName->Length,
- - &NetRootName->Buffer[SrvCallName->Length/2]
- - };
- - if (!RtlCompareUnicodeString(&PubNetRootPrefix, &PubNfsPrefix, FALSE))
- - *pubfh_prefix = TRUE;
- + }
- + else if (memcmp(nfstag, L"@PUBNFS", (7*sizeof(wchar_t))) == 0) {
- + *pubfh_tag = true;
- status = STATUS_SUCCESS;
- + }
- + else {
- + DbgP("netroot_has_nfs_tag: no match\n");
- + }
- }
- -#endif /* USE_ENTIRE_PATH_FOR_NETROOT */
- +
- return status;
- }
- @@ -934,15 +918,16 @@ NTSTATUS nfs41_CreateVNetRoot(
- /*
- * In order to cooperate with other network providers, we
- - * must only claim paths of the form '\\server\nfs4\path'
- - * or '\\server\pubnfs4\path'
- + * must only claim paths of the form '\\server@NFS@<port>\path'
- + * or '\\server@PUBNFS@<port>\path'
- */
- - BOOLEAN pubfh_prefix = FALSE;
- - status = has_nfs_prefix(pSrvCall->pSrvCallName, pNetRoot->pNetRootName, &pubfh_prefix);
- + bool pubfh_tag = false;
- + status = netroot_has_nfs_tag(pSrvCall->pSrvCallName, pNetRoot->pNetRootName, &pubfh_tag);
- if (status) {
- - print_error("nfs41_CreateVNetRoot: NetRootName '%wZ' doesn't match "
- - "'\\nfs4' or '\\pubnfs4'!\n", pNetRoot->pNetRootName);
- - goto out;
- + print_error("nfs41_CreateVNetRoot: "
- + "NetRootName '%wZ' does not match '@NFS' or '@PUBNFS'!\n",
- + pNetRoot->pNetRootName);
- + goto out;
- }
- pNetRoot->MRxNetRootState = MRX_NET_ROOT_STATE_GOOD;
- pNetRoot->DeviceType = FILE_DEVICE_DISK;
- @@ -979,10 +964,10 @@ NTSTATUS nfs41_CreateVNetRoot(
- pVNetRootContext->timebasedcoherency = Config->timebasedcoherency;
- } else {
- /*
- - * Codepath for \\server@port\nfs4\path or
- - * \\server@port\pubnfs4\path
- + * Codepath for \\server@NFS@port\path or
- + * \\server@PUBNFS@port\path
- */
- - DbgP("Codepath for \\\\server@port\\@(pubnfs4|nfs4)\\path\n");
- + DbgP("Codepath for \\\\server@(NFS|PUBNFS)@port\\path\n");
- /*
- * STATUS_NFS_SHARE_NOT_MOUNTED - status code for the case
- @@ -1102,7 +1087,7 @@ NTSTATUS nfs41_CreateVNetRoot(
- pVNetRootContext->timebasedcoherency = Config->timebasedcoherency;
- }
- - Config->use_nfspubfh = pubfh_prefix;
- + Config->use_nfspubfh = pubfh_tag;
- DbgP("Config->{ "
- "MntPt='%wZ', "
- @@ -1283,7 +1268,7 @@ NTSTATUS nfs41_CreateVNetRoot(
- RtlCopyLuid(&entry->login_id, &luid);
- /*
- * Save mount config so we can use it for
- - * \\server@port\@(pubnfs4|nfs4)\path mounts later
- + * \\server@(PUBNFS|NFS)@port\path mounts later
- */
- copy_nfs41_mount_config(&entry->Config, Config);
- nfs41_AddEntry(pNetRootContext->mounts.lock,
- @@ -1366,32 +1351,18 @@ VOID nfs41_ExtractNetRootName(
- ULONG length = FilePathName->Length;
- PWCH w = FilePathName->Buffer;
- PWCH wlimit = (PWCH)(((PCHAR)w)+length);
- - PWCH wlow;
- - w += (SrvCall->pSrvCallName->Length/sizeof(WCHAR));
- - NetRootName->Buffer = wlow = w;
- - /* parse the entire path into NetRootName */
- -#if USE_ENTIRE_PATH_FOR_NETROOT
- - w = wlimit;
- -#else
- - for (;;) {
- - if (w >= wlimit)
- - break;
- - if ((*w == OBJ_NAME_PATH_SEPARATOR) && (w != wlow))
- - break;
- - w++;
- - }
- -#endif
- - NetRootName->Length = NetRootName->MaximumLength
- - = (USHORT)((PCHAR)w - (PCHAR)wlow);
- + NetRootName->Buffer = wlimit;
- + NetRootName->Length = NetRootName->MaximumLength = 0;
- +
- + /* FIXME: |RestOfName| not implemented yet, the Win10 RDR does not use it */
- +
- #ifdef DEBUG_MOUNT
- DbgP("nfs41_ExtractNetRootName: "
- - "In: pSrvCall 0x%p PathName='%wZ' SrvCallName='%wZ' "
- + "In: pSrvCall 0x%p FilePathName='%wZ' SrvCallName='%wZ' "
- "Out: NetRootName='%wZ'\n",
- SrvCall, FilePathName, SrvCall->pSrvCallName, NetRootName);
- -#endif
- - return;
- -
- +#endif /* DEBUG_MOUNT */
- }
- NTSTATUS nfs41_FinalizeSrvCall(
- diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
- index ee1cb7f..a969839 100644
- --- a/tests/manual_testing.txt
- +++ b/tests/manual_testing.txt
- @@ -1,5 +1,5 @@
- #
- -# ms-nfs41-client manual testing sequence, 2025-10-02
- +# ms-nfs41-client manual testing sequence, 2025-10-15
- #
- # Draft version, needs to be turned into automated tests
- # if possible
- @@ -264,16 +264,16 @@ ln -s /dev/zero foo && ls -l foo && rm foo
- rm -f symlink1_to_m_builds ; cmd /C 'mklink /D symlink1_to_m_builds M:\builds' ; cmd /C 'cd symlink1_to_m_builds && dir && echo test_OK'
- # 8. cmd.exe follow sublink dir to other filesystem
- # (this assumes we have an valid UNC path
- -# \\derfwnb4966_ipv6linklocal@2049\nfs4\bigdisk\ with a subdir "builds")
- -rm -f symlink1_to_unc ; cmd /C 'mklink /D symlink1_to_unc \\derfwnb4966_ipv6linklocal@2049\nfs4\bigdisk\builds\' ; cmd /C 'cd symlink1_to_unc && dir && echo test_OK'
- +# \\derfwnb4966_ipv6linklocal@NFS@2049\bigdisk\ with a subdir "builds")
- +rm -f symlink1_to_unc ; cmd /C 'mklink /D symlink1_to_unc \\derfwnb4966_ipv6linklocal@NFS@2049\bigdisk\builds\' ; cmd /C 'cd symlink1_to_unc && dir && echo test_OK'
- # 9a. powershell follow sublink dir to other filesystem
- # (this assumes we have an valid UNC path
- -# \\derfwnb4966_ipv6linklocal@2049\nfs4\bigdisk\ with a subdir "builds")
- -rm -f symlink1_to_unc ; cmd /C 'mklink /D symlink1_to_unc \\derfwnb4966_ipv6linklocal@2049\nfs4\bigdisk\builds\' ; powershell -Command 'cd symlink1_to_unc ; if ($?) { dir ; if ($?) { echo "test OK" } else { echo "dir failed" } } else { echo "cd failed" }'
- +# \\derfwnb4966_ipv6linklocal@NFS@2049\bigdisk\ with a subdir "builds")
- +rm -f symlink1_to_unc ; cmd /C 'mklink /D symlink1_to_unc \\derfwnb4966_ipv6linklocal@NFS@2049\bigdisk\builds\' ; powershell -Command 'cd symlink1_to_unc ; if ($?) { dir ; if ($?) { echo "test OK" } else { echo "dir failed" } } else { echo "cd failed" }'
- # 9b. powershell follow sublink dir to other filesystem
- # (this assumes we have an valid UNC path
- -# \\derfwpc5131_ipv4@2049\nfs4\export\home2\rmainz\ with a subdir "tmp")
- -rm -f symlink1_to_h_tmp ; cmd /C 'mklink /D symlink1_to_h_tmp \\derfwpc5131_ipv4@2049\nfs4\export\home2\rmainz\tmp' ; powershell -Command 'cd symlink1_to_h_tmp ; if ($?) { dir ; if ($?) { echo "test OK" } else { echo "dir failed" } } else { echo "cd failed" }'
- +# \\derfwpc5131_ipv4@NFS@2049\export\home2\rmainz\ with a subdir "tmp")
- +rm -f symlink1_to_h_tmp ; cmd /C 'mklink /D symlink1_to_h_tmp \\derfwpc5131_ipv4@NFS@2049\export\home2\rmainz\tmp' ; powershell -Command 'cd symlink1_to_h_tmp ; if ($?) { dir ; if ($?) { echo "test OK" } else { echo "dir failed" } } else { echo "cd failed" }'
- #
- # Tests for absolute (start from root "/") POSIX symlinks
- @@ -392,11 +392,11 @@ Example:
- ---- snip ----
- # get UNC path for driver letterr 'L':
- $ powershell -Command 'Get-PSDrive -Name L | Select-Object -Property DisplayRoot,CurrentLocation | Format-List' | ksh93 -c 'compound c=(typeset -A ar) ; while IFS="" read -r l ; do dummy="${l/~(Elr)(.+?)[[:space:]]*:[[:space:]](.+)\015/x}" ; [[ "${.sh.match[1]-}" == "" ]] && continue ; c.ar["${.sh.match[1]}"]="${.sh.match[2]}" ; done ; cygpath -u "$(printf "%s\\\\%s\n" "${c.ar[DisplayRoot]}" "${c.ar[CurrentLocation]}")"'
- -//derfwnb4966_ipv6linklocal@2049/nfs4/bigdisk/builds/bash_build1
- +//derfwnb4966_ipv6linklocal@NFS@2049/bigdisk/builds/bash_build1
- # tests
- -mkdir -p //derfwnb4966_ipv6linklocal@2049/nfs4/bigdisk/builds/bash_build1/a1/b1/c1 || echo FAIL
- -mkdir //derfwnb4966_ipv6linklocal@2049/nfs4/bigdisk/builds/bash_build1/a2 || echo FAIL
- -mkdir //derfwnb4966_ipv6linklocal@2049/nfs4/bigdisk/builds/bash_build1/a2/b2 || echo FAIL
- +mkdir -p //derfwnb4966_ipv6linklocal@NFS@2049/bigdisk/builds/bash_build1/a1/b1/c1 || echo FAIL
- +mkdir //derfwnb4966_ipv6linklocal@NFS@2049/bigdisk/builds/bash_build1/a2 || echo FAIL
- +mkdir //derfwnb4966_ipv6linklocal@NFS@2049/bigdisk/builds/bash_build1/a2/b2 || echo FAIL
- ---- snip ----
- #
- @@ -655,7 +655,7 @@ $ time ksh93 -c 'rm -Rf nfstmp1 gcc.x.strace.log x.c x.exe && mkdir nfstmp1 && c
- git clone -b 'v1.0.10' https://github.com/ksh93/ksh.git
- cd ksh
- git config --global --add safe.directory "$PWD"
- -# add patch so UNC path support is enabled (e.g. "cd cd //derfwnb4966_ipv6linklocal@2049/nfs4/net_tmpfs")
- +# add patch so UNC path support is enabled (e.g. "cd //derfwnb4966_ipv6linklocal@NFS@2049/net_tmpfs")
- patch -p1 <'../cygwin/cygwin_ksh93/ksh_1_0_8_libast_Cygwin_set_PATH_LEADING_SLASHES_for_UNC_paths.patch'
- sed -i -r 's/mkfifo.+?(-m [[:digit:]]+)/mkfifo /g' ./src/cmd/INIT/package.sh ./bin/package
- # repeat:
- --
- 2.51.0
- From b221fb1ae46b738a838bc73b41f4a392648b707d Mon Sep 17 00:00:00 2001
- From: Dan Shelton <dan.f.shelton@gmail.com>
- Date: Thu, 16 Oct 2025 18:36:39 +0200
- Subject: [PATCH 3/5] sys: Remove unused NTRY_OPCODE2STRING(entry) macro
- Remove unused NTRY_OPCODE2STRING(entry) macro.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_debug.h | 1 -
- 1 file changed, 1 deletion(-)
- diff --git a/sys/nfs41sys_debug.h b/sys/nfs41sys_debug.h
- index 4570cde..47f8d61 100644
- --- a/sys/nfs41sys_debug.h
- +++ b/sys/nfs41sys_debug.h
- @@ -50,7 +50,6 @@ void print_ea_info(PFILE_FULL_EA_INFORMATION info);
- void print_get_ea(int on, PFILE_GET_EA_INFORMATION info);
- void print_caching_level(int on, ULONG flag, PUNICODE_STRING s);
- const char *opcode2string(int opcode);
- -#define ENTRY_OPCODE2STRING(entry) ((entry)?opcode2string((entry)->opcode):"<entry==NULL>")
- void print_open_error(int on, int status);
- void print_wait_status(int on, const char *str, NTSTATUS status,
- const char *opcode, PVOID entry, LONGLONG xid);
- --
- 2.51.0
- From 919186a7ed8a639b174d31eb1c0995c9e61f9597 Mon Sep 17 00:00:00 2001
- From: Cedric Blancher <cedric.blancher@gmail.com>
- Date: Thu, 16 Oct 2025 20:12:08 +0200
- Subject: [PATCH 4/5] tests: nfsbuildtest: Add bison,flex to required packages
- for bash build
- nfsbuildtest: Add bison,flex to required packages for bash build.
- Signed-off-by: Roland Mainz <roland.mainz@nrubsig.org>
- ---
- tests/nfsbuildtest/nfsbuildtest.ksh93 | 2 ++
- 1 file changed, 2 insertions(+)
- diff --git a/tests/nfsbuildtest/nfsbuildtest.ksh93 b/tests/nfsbuildtest/nfsbuildtest.ksh93
- index 2103fa3..5cd2015 100644
- --- a/tests/nfsbuildtest/nfsbuildtest.ksh93
- +++ b/tests/nfsbuildtest/nfsbuildtest.ksh93
- @@ -754,6 +754,8 @@ function main
- is_toolkit_pkg_installed itp 'gcc-g++' || (( errc++ ))
- is_toolkit_pkg_installed itp 'autoconf' || (( errc++ ))
- is_toolkit_pkg_installed itp 'automake' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'flex' || (( errc++ ))
- + is_toolkit_pkg_installed itp 'bison' || (( errc++ ))
- if is_cygwin ; then
- if (( (cygwin_vers.major*1000+cygwin_vers.minor) >= 3005 )) ; then
- print '# bash_build: Using Cygwin >= 3.5 config'
- --
- 2.51.0
- From bc301b70df576b9d14b095af34303e67f07708a1 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Thu, 16 Oct 2025 21:31:48 +0200
- Subject: [PATCH 5/5] daemon: Add some debug statistics for NFS I/O read+write
- sizes
- Add some debug statistics for NFS I/O read+write sizes.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/readwrite.c | 139 +++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 139 insertions(+)
- diff --git a/daemon/readwrite.c b/daemon/readwrite.c
- index ac42a50..e86c623 100644
- --- a/daemon/readwrite.c
- +++ b/daemon/readwrite.c
- @@ -24,6 +24,12 @@
- #include <Windows.h>
- #include <stdio.h>
- +// #define IOSIZE_STAT 1
- +
- +#ifdef IOSIZE_STAT
- +#include <math.h>
- +#endif /* IOSIZE_STAT */
- +
- #include "nfs41_ops.h"
- #include "name_cache.h"
- #include "upcall.h"
- @@ -35,6 +41,129 @@
- #define MAX_WRITE_RETRIES 6
- +
- +#ifdef IOSIZE_STAT
- +struct
- +{
- + /*
- + * Windows I/O is limited to |ULONG| (32bit) block sizes, so
- + * |log2()| below can never go beyond 2^31
- + */
- + long long readstats[32+1];
- + long read_counter;
- + long long writestats[32+1];
- + long write_counter;
- +} iosizestat;
- +
- +static
- +void ioread_stats(int status, ULONG size)
- +{
- + if (status != ERROR_SUCCESS)
- + return;
- +
- + /* No locking, no atomic operations, we do not need to be 100% accurate! */
- + iosizestat.readstats[(int)log2((double)size)]++;
- + iosizestat.read_counter++;
- + if ((iosizestat.read_counter % 256) == 0) {
- + DPRINTF(0, ("ioread_stats: readstats=( "
- + "[0]=%lld [1]=%lld [2]=%lld [3]=%lld "
- + "[4]=%lld [5]=%lld [6]=%lld [7]=%lld "
- + "[8]=%lld [9]=%lld [10]=%lld [11]=%lld "
- + "[12]=%lld [13]=%lld [14]=%lld [15]=%lld "
- + "[16]=%lld [17]=%lld [18]=%lld [19]=%lld "
- + "[20]=%lld [21]=%lld [22]=%lld [23]=%lld "
- + "[24]=%lld [25]=%lld [26]=%lld [27]=%lld "
- + "[28]=%lld [29]=%lld [30]=%lld [31]=%lld )\n",
- + iosizestat.readstats[0],
- + iosizestat.readstats[1],
- + iosizestat.readstats[2],
- + iosizestat.readstats[3],
- + iosizestat.readstats[4],
- + iosizestat.readstats[5],
- + iosizestat.readstats[6],
- + iosizestat.readstats[7],
- + iosizestat.readstats[8],
- + iosizestat.readstats[9],
- + iosizestat.readstats[10],
- + iosizestat.readstats[11],
- + iosizestat.readstats[12],
- + iosizestat.readstats[13],
- + iosizestat.readstats[14],
- + iosizestat.readstats[15],
- + iosizestat.readstats[16],
- + iosizestat.readstats[17],
- + iosizestat.readstats[18],
- + iosizestat.readstats[19],
- + iosizestat.readstats[20],
- + iosizestat.readstats[21],
- + iosizestat.readstats[22],
- + iosizestat.readstats[23],
- + iosizestat.readstats[24],
- + iosizestat.readstats[25],
- + iosizestat.readstats[26],
- + iosizestat.readstats[27],
- + iosizestat.readstats[28],
- + iosizestat.readstats[29],
- + iosizestat.readstats[30],
- + iosizestat.readstats[31]));
- + }
- +}
- +
- +static
- +void iowrite_stats(int status, ULONG size)
- +{
- + if (status != ERROR_SUCCESS)
- + return;
- +
- + /* No locking, no atomic operations, we do not need to be 100% accurate! */
- + iosizestat.writestats[(int)log2((double)size)]++;
- + iosizestat.write_counter++;
- + if ((iosizestat.write_counter % 256) == 0) {
- + DPRINTF(0, ("iowrite_stats: writestats=( "
- + "[0]=%lld [1]=%lld [2]=%lld [3]=%lld "
- + "[4]=%lld [5]=%lld [6]=%lld [7]=%lld "
- + "[8]=%lld [9]=%lld [10]=%lld [11]=%lld "
- + "[12]=%lld [13]=%lld [14]=%lld [15]=%lld "
- + "[16]=%lld [17]=%lld [18]=%lld [19]=%lld "
- + "[20]=%lld [21]=%lld [22]=%lld [23]=%lld "
- + "[24]=%lld [25]=%lld [26]=%lld [27]=%lld "
- + "[28]=%lld [29]=%lld [30]=%lld [31]=%lld )\n",
- + iosizestat.writestats[0],
- + iosizestat.writestats[1],
- + iosizestat.writestats[2],
- + iosizestat.writestats[3],
- + iosizestat.writestats[4],
- + iosizestat.writestats[5],
- + iosizestat.writestats[6],
- + iosizestat.writestats[7],
- + iosizestat.writestats[8],
- + iosizestat.writestats[9],
- + iosizestat.writestats[10],
- + iosizestat.writestats[11],
- + iosizestat.writestats[12],
- + iosizestat.writestats[13],
- + iosizestat.writestats[14],
- + iosizestat.writestats[15],
- + iosizestat.writestats[16],
- + iosizestat.writestats[17],
- + iosizestat.writestats[18],
- + iosizestat.writestats[19],
- + iosizestat.writestats[20],
- + iosizestat.writestats[21],
- + iosizestat.writestats[22],
- + iosizestat.writestats[23],
- + iosizestat.writestats[24],
- + iosizestat.writestats[25],
- + iosizestat.writestats[26],
- + iosizestat.writestats[27],
- + iosizestat.writestats[28],
- + iosizestat.writestats[29],
- + iosizestat.writestats[30],
- + iosizestat.writestats[31]));
- + }
- +}
- +#endif /* IOSIZE_STAT */
- +
- const stateid4 special_read_stateid = {0xffffffff,
- {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
- @@ -193,6 +322,11 @@ static int handle_read(void *daemon_context, nfs41_upcall *upcall)
- args->out_len += pnfs_bytes_read;
- out:
- +
- +#ifdef IOSIZE_STAT
- + ioread_stats(status, args->out_len);
- +#endif /* IOSIZE_STAT */
- +
- return status;
- }
- @@ -396,6 +530,11 @@ static int handle_write(void *daemon_context, nfs41_upcall *upcall)
- status = write_to_mds(upcall, &stateid);
- out:
- args->out_len += pnfs_bytes_written;
- +
- +#ifdef IOSIZE_STAT
- + iowrite_stats(status, args->out_len);
- +#endif /* IOSIZE_STAT */
- +
- return status;
- }
- --
- 2.51.0
msnfs41client: Patches for moving the NFS tag into UNC server part+misc, 2025-10-16
Posted by Anonymous on Thu 16th Oct 2025 20:57
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.
rovema.kpaste.net RSS