pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: More fixes for Win32 named streams, tests, docs+misc, 2026-01-08
Posted by Anonymous on Thu 8th Jan 2026 22:43
raw | new post

  1. From c75325806ec7287fdb69f844ef1dd5199ca7a4fd Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Thu, 8 Jan 2026 19:35:47 +0100
  4. Subject: [PATCH 1/7] tests: Clarify that multisparsefiletest.ksh should only
  5.  use POSIX/SUS/Cygwin-APIs
  6.  
  7. Clarify that multisparsefiletest.ksh should only use POSIX/SUS/Cygwin-APIs.
  8.  
  9. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  10. ---
  11. tests/sparsefiles/multisparsefiletest.ksh | 3 ++-
  12.  1 file changed, 2 insertions(+), 1 deletion(-)
  13.  
  14. diff --git a/tests/sparsefiles/multisparsefiletest.ksh b/tests/sparsefiles/multisparsefiletest.ksh
  15. index b8106e4..4ad6fcc 100644
  16. --- a/tests/sparsefiles/multisparsefiletest.ksh
  17. +++ b/tests/sparsefiles/multisparsefiletest.ksh
  18. @@ -3,7 +3,7 @@
  19.  #
  20.  # MIT License
  21.  #
  22. -# Copyright (c) 2025 Roland Mainz <roland.mainz@nrubsig.org>
  23. +# Copyright (c) 2025-2026 Roland Mainz <roland.mainz@nrubsig.org>
  24.  #
  25.  # Permission is hereby granted, free of charge, to any person obtaining a copy
  26.  # of this software and associated documentation files (the "Software"), to deal
  27. @@ -26,6 +26,7 @@
  28.  
  29.  #
  30.  # multisparsefiletest1.ksh - test many combinations of sparse file layouts
  31. +# via POSIX/SUS/Cygwin-only APIs (e.g. no fsutil)
  32.  #
  33.  # Written by Roland Mainz <roland.mainz@nrubsig.org>
  34.  #
  35. --
  36. 2.51.0
  37.  
  38. From 20a69e98948245d1263ef0d9d9f298bbacf78857 Mon Sep 17 00:00:00 2001
  39. From: Roland Mainz <roland.mainz@nrubsig.org>
  40. Date: Thu, 8 Jan 2026 20:02:36 +0100
  41. Subject: [PATCH 2/7] cygwin,tests: Add new test script for sparse Win32 named
  42.  streams
  43.  
  44. Add new test script for sparse Win32 named streams.
  45.  
  46. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  47. ---
  48. cygwin/Makefile.install                |   1 +
  49.  tests/sparsefiles/winsparsestream1.ksh | 102 +++++++++++++++++++++++++
  50.  2 files changed, 103 insertions(+)
  51.  create mode 100644 tests/sparsefiles/winsparsestream1.ksh
  52.  
  53. diff --git a/cygwin/Makefile.install b/cygwin/Makefile.install
  54. index 064b417..c003e1e 100644
  55. --- a/cygwin/Makefile.install
  56. +++ b/cygwin/Makefile.install
  57. @@ -189,6 +189,7 @@ installdest:
  58.         cp $(PROJECT_BASEDIR_DIR)/tests/sparsefiles/testsparsefile1.ksh $(DESTDIR)/usr/share/msnfs41client/tests/sparsefiles/testsparsefile1.ksh
  59.         cp $(PROJECT_BASEDIR_DIR)/tests/sparsefiles/testsparseexe1.ksh $(DESTDIR)/usr/share/msnfs41client/tests/sparsefiles/testsparseexe1.ksh
  60.         cp $(PROJECT_BASEDIR_DIR)/tests/sparsefiles/multisparsefiletest.ksh $(DESTDIR)/usr/share/msnfs41client/tests/sparsefiles/multisparsefiletest.ksh
  61. +       cp $(PROJECT_BASEDIR_DIR)/tests/sparsefiles/winsparsestream1.ksh $(DESTDIR)/usr/share/msnfs41client/tests/sparsefiles/winsparsestream1.ksh
  62.         cp $(PROJECT_BASEDIR_DIR)/tests/fstest_make_numtree1/fstest_make_numtree1.ksh93 $(DESTDIR)/usr/share/msnfs41client/tests/misc/fstest_make_numtree1.ksh93
  63.         cp $(PROJECT_BASEDIR_DIR)/tests/wintartests/wintartest_comparewinvsgnu001.bash $(DESTDIR)/usr/share/msnfs41client/tests/misc/wintartest_comparewinvsgnu001.bash
  64.         cp $(PROJECT_BASEDIR_DIR)/tests/wintartests/wintartest_seq001.bash $(DESTDIR)/usr/share/msnfs41client/tests/misc/wintartest_seq001.bash
  65. diff --git a/tests/sparsefiles/winsparsestream1.ksh b/tests/sparsefiles/winsparsestream1.ksh
  66. new file mode 100644
  67. index 0000000..897fdcd
  68. --- /dev/null
  69. +++ b/tests/sparsefiles/winsparsestream1.ksh
  70. @@ -0,0 +1,102 @@
  71. +#!/bin/ksh93
  72. +
  73. +#
  74. +# MIT License
  75. +#
  76. +# Copyright (c) 2025-2026 Roland Mainz <roland.mainz@nrubsig.org>
  77. +#
  78. +# Permission is hereby granted, free of charge, to any person obtaining a copy
  79. +# of this software and associated documentation files (the "Software"), to deal
  80. +# in the Software without restriction, including without limitation the rights
  81. +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  82. +# copies of the Software, and to permit persons to whom the Software is
  83. +# furnished to do so, subject to the following conditions:
  84. +#
  85. +# The above copyright notice and this permission notice shall be included in all
  86. +# copies or substantial portions of the Software.
  87. +#
  88. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  89. +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  90. +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  91. +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  92. +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  93. +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  94. +# SOFTWARE.
  95. +#
  96. +
  97. +#
  98. +# winsparsestream.ksh - test many combinations of sparse streams via Windows
  99. +# (non-Cygwin) APIs
  100. +#
  101. +# Written by Roland Mainz <roland.mainz@nrubsig.org>
  102. +#
  103. +
  104. +function test_sparse_streams
  105. +{
  106. +    set -o xtrace
  107. +    set -o errexit
  108. +    set -o nounset
  109. +
  110. +    compound fsutilout
  111. +
  112. +    rm -f ii
  113. +    touch ii
  114. +    #
  115. +    # $ icacls ".\\ii" /grant "$(logname):(X,DC)" # is required for fsutil
  116. +    # on NTFS, otherwise we get a "Permission denied"
  117. +    #
  118. +    icacls ".\\ii" /grant "$(logname):(X,DC)"
  119. +
  120. +    for streamname in "ii:yyy6" "ii:yyy7" "ii:yyy8" "ii:yyy9" ; do
  121. +        powershell -Command "Remove-Item -Path .\\${streamname} -ErrorAction SilentlyContinue" || true
  122. +
  123. +        fsutil file createnew ${streamname} 0
  124. +        fsutil sparse setflag ${streamname} 1
  125. +        cmd /C "C:\cygwin64\bin\printf.exe \"MARK1\\n\" >>${streamname}"
  126. +
  127. +        fsutil file seteof ${streamname} 0x100000000
  128. +        cmd /C "C:\cygwin64\bin\printf.exe \"MARK2\\n\" >>${streamname}"
  129. +
  130. +        fsutil file seteof ${streamname} 0x200000000
  131. +        cmd /C "C:\cygwin64\bin\printf.exe \"MARK3\\n\" >>${streamname}"
  132. +
  133. +        fsutil file seteof ${streamname} 0x300000000
  134. +        cmd /C "C:\cygwin64\bin\printf.exe \"MARK4\\n\" >>${streamname}"
  135. +
  136. +        fsutil file seteof ${streamname} 0x400000000
  137. +        cmd /C "C:\cygwin64\bin\printf.exe \"EOF.\\n\" >>${streamname}"
  138. +
  139. +        # check whether we really have five data sections
  140. +        fsutilout.stderr="${ fsutilout.stdout="${ fsutil sparse queryrange ${streamname} || true ; }" 2>&1 ; }"
  141. +        #print -v fsutilout
  142. +        if (( $(wc -l <<<"${fsutilout.stdout}") != 5 )) ; then
  143. +            print -u2 -f $"Test failed, expected 5 lines of output\n"
  144. +            return 1
  145. +        fi
  146. +
  147. +        # punch a hole over the data section containing "MARK3" ...
  148. +        fsutil sparse setrange ${streamname} $((0x200000000-0x100000)) $((2*0x100000))
  149. +
  150. +        # ... and verify that we now only have four data sections left:
  151. +        fsutilout.stderr="${ fsutilout.stdout="${ fsutil sparse queryrange ${streamname} || true ; }" 2>&1 ; }"
  152. +        #print -v fsutilout
  153. +        if (( $(wc -l <<<"${fsutilout.stdout}") != 4 )) ; then
  154. +            print -u2 -f $"Test failed, expected 4 lines of output\n"
  155. +            return 1
  156. +        fi
  157. +    done
  158. +
  159. +    printf '#\n# TEST OK\n#\n'
  160. +    return 0
  161. +}
  162. +
  163. +
  164. +#
  165. +# main
  166. +#
  167. +
  168. +builtin wc
  169. +
  170. +test_sparse_streams
  171. +
  172. +#EOF.
  173. --
  174. 2.51.0
  175.  
  176. From 82ca2474b21d67bf67274cf006cb0c11b61d5c00 Mon Sep 17 00:00:00 2001
  177. From: Roland Mainz <roland.mainz@nrubsig.org>
  178. Date: Thu, 8 Jan 2026 20:30:14 +0100
  179. Subject: [PATCH 3/7] tests: winfsinfo should use the public userland API for
  180.  getting Win32 named stream information
  181.  
  182. winfsinfo should use the public userland API (i.e.
  183. |GetFileInformationByHandleEx(..., FileStreamInfo, ...)| for getting Win32
  184. named stream information.
  185.  
  186. Reported-by: Cedric Blancher <cedric.blancher@gmail.com>
  187. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  188. ---
  189. tests/winfsinfo1/winfsinfo.c | 29 +++++++++++++----------------
  190.  1 file changed, 13 insertions(+), 16 deletions(-)
  191.  
  192. diff --git a/tests/winfsinfo1/winfsinfo.c b/tests/winfsinfo1/winfsinfo.c
  193. index 74ac2b7..a1c12b5 100644
  194. --- a/tests/winfsinfo1/winfsinfo.c
  195. +++ b/tests/winfsinfo1/winfsinfo.c
  196. @@ -1522,9 +1522,8 @@ static
  197.  int get_filestreaminfo(const char *progname, const char *filename)
  198.  {
  199.      int res = EXIT_FAILURE;
  200. -    NTSTATUS status;
  201. -    IO_STATUS_BLOCK iostatus;
  202. -    PFILE_STREAM_INFORMATION fsi = NULL;
  203. +    bool ok;
  204. +    PFILE_STREAM_INFO fsi = NULL;
  205.  
  206.      HANDLE fileHandle = CreateFileA(filename,
  207.          GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
  208. @@ -1540,8 +1539,8 @@ int get_filestreaminfo(const char *progname, const char *filename)
  209.  
  210.  #define MAX_STREAM_INFOS (16)
  211.  #define FSI_MAXCHARS (256)
  212. -    fsi = calloc(1,
  213. -        (sizeof(FILE_STREAM_INFORMATION)+sizeof(wchar_t)*FSI_MAXCHARS)*MAX_STREAM_INFOS);
  214. +    size_t fsi_size = (sizeof(FILE_STREAM_INFO)+sizeof(wchar_t)*FSI_MAXCHARS)*MAX_STREAM_INFOS;
  215. +    fsi = calloc(1, fsi_size);
  216.      if (fsi == NULL) {
  217.           (void)fprintf(stderr,
  218.              "%s: Out of memory.\n",
  219. @@ -1549,23 +1548,21 @@ int get_filestreaminfo(const char *progname, const char *filename)
  220.          return EXIT_FAILURE;
  221.      }
  222.  
  223. -    status = ZwQueryInformationFile(fileHandle,
  224. -        &iostatus,
  225. -        fsi,
  226. -        ((sizeof(FILE_STREAM_INFORMATION)+sizeof(wchar_t)*FSI_MAXCHARS)*MAX_STREAM_INFOS),
  227. -        FileStreamInformation);
  228. +    ok = GetFileInformationByHandleEx(fileHandle,
  229. +        FileStreamInfo,
  230. +        fsi, fsi_size);
  231.  
  232. -    if (status != STATUS_SUCCESS) {
  233. -        (void)fprintf(stderr, "%s: ZwQueryInformationFile() "
  234. -            "error. status==0x%lx.\n",
  235. +    if (!ok) {
  236. +        (void)fprintf(stderr, "%s: GetFileInformationByHandleEx() "
  237. +            "error, lasterr=%d.\n",
  238.              progname,
  239. -            (long)status);
  240. +            (int)GetLastError());
  241.          res = EXIT_FAILURE;
  242.          goto done;
  243.      }
  244.  
  245.      int streamindex;
  246. -    FILE_STREAM_INFORMATION *stream;
  247. +    const FILE_STREAM_INFO *stream;
  248.  
  249.      (void)printf("(\n");
  250.      (void)printf("\tfilename='%s'\n", filename);
  251. @@ -1584,7 +1581,7 @@ int get_filestreaminfo(const char *progname, const char *filename)
  252.          if (stream->NextEntryOffset == 0)
  253.              break;
  254.  
  255. -        stream = (FILE_STREAM_INFORMATION *)((char *)stream + stream->NextEntryOffset);
  256. +        stream = (const FILE_STREAM_INFO *)((char *)stream + stream->NextEntryOffset);
  257.      }
  258.      (void)printf("\t)\n");
  259.  
  260. --
  261. 2.51.0
  262.  
  263. From 3c30962d2afc1fec7aaac660c637076d0dd2a8fe Mon Sep 17 00:00:00 2001
  264. From: Roland Mainz <roland.mainz@nrubsig.org>
  265. Date: Thu, 8 Jan 2026 22:14:56 +0100
  266. Subject: [PATCH 4/7] README.md,docs: Update docs for file cloning and offload
  267.  copy about Win32 named streams
  268.  
  269. Update docs for file cloning and offload copy about Win32 named streams.
  270.  
  271. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  272. ---
  273. README.md       | 14 +++++++++-----
  274.  docs/README.xml |  9 ++++++---
  275.  2 files changed, 15 insertions(+), 8 deletions(-)
  276.  
  277. diff --git a/README.md b/README.md
  278. index 49ce9c3..5e9f717 100644
  279. --- a/README.md
  280. +++ b/README.md
  281. @@ -136,8 +136,9 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11 & Windows Server
  282.      itself supports an unlimited number of data ranges)
  283.  
  284.    - `/cygdrive/c/Windows/system32/xcopy /sparse` can be used to copy
  285. -    sparse files. Requires on Win11 \>= 22H2 because it relies on
  286. -    `|CopyFile2()|` flag `|COPY_FILE_ENABLE_SPARSE_COPY|`.
  287. +    sparse files+sparse named streams. Requires on Win11 \>= 22H2
  288. +    because it relies on `|CopyFile2()|` flag
  289. +    `|COPY_FILE_ENABLE_SPARSE_COPY|`.
  290.  
  291.  - Windows "named streams"/[Alternate Data
  292.    Stream](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/c54dec26-1551-4d3a-a0ea-4fa40f848eb3)
  293. @@ -149,6 +150,8 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11 & Windows Server
  294.      `|FSCTL_QUERY_ALLOCATED_RANGES|`, `|FSCTL_SET_SPARSE|`,
  295.      `|FSCTL_SET_ZERO_DATA|` etc. on Win32 named streams)
  296.  
  297. +  - Supports Win32 named streams on directories.
  298. +
  299.    - Requires NFSv4.1 server which supports the NFSv4.1 named attributes.
  300.  
  301.  - Case-insensitive filesystem support
  302. @@ -165,7 +168,8 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11 & Windows Server
  303.    - Requires NFSv4.2 server which supports the NFSv4.2 operations
  304.      "COPY", "DEALLOCATE", "SEEK"
  305.  
  306. -  - Sparse files are correctly copied including all hole and data ranges
  307. +  - Sparse files+sparse Win32 named streams are correctly copied
  308. +    including all hole and data ranges
  309.  
  310.    - Windows 10 `|CopyFile2()|` API uses
  311.      `|FSCTL_OFFLOAD_READ|`+`|FSCTL_OFFLOAD_WRITE|` by default
  312. @@ -183,8 +187,8 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11 & Windows Server
  313.      "CLONE", "DEALLOCATE", "SEEK", and exports a filesystem which
  314.      supports block cloning (e.g. Linux BTRFS+XFS, but NOT Linux tmpfs)
  315.  
  316. -  - Sparse files are correctly cloned, including all hole and data
  317. -    ranges
  318. +  - Sparse files+sparse Win32 named streams are correctly cloned,
  319. +    including all hole and data ranges
  320.  
  321.    - `/usr/bin/winclonefile.exe` can be used to clone a file
  322.  
  323. diff --git a/docs/README.xml b/docs/README.xml
  324. index fc8b96e..541cef7 100644
  325. --- a/docs/README.xml
  326. +++ b/docs/README.xml
  327. @@ -136,7 +136,7 @@
  328.                <para><filename>/cygdrive/c/Windows/system32/fsutil sparse queryrange myfile.dat</filename> can be used to enumerate ranges where data are allocated (BUG: Win10+Win11 fsutil only support 64 data ranges, the filesystem itself supports an unlimited number of data ranges)</para>
  329.              </listitem>
  330.              <listitem>
  331. -              <para><filename>/cygdrive/c/Windows/system32/xcopy /sparse</filename> can be used to copy sparse files. Requires on Win11 &gt;= 22H2 because it relies on <literal>|CopyFile2()|</literal> flag <literal>|COPY_FILE_ENABLE_SPARSE_COPY|</literal>.</para>
  332. +              <para><filename>/cygdrive/c/Windows/system32/xcopy /sparse</filename> can be used to copy sparse files+sparse named streams. Requires on Win11 &gt;= 22H2 because it relies on <literal>|CopyFile2()|</literal> flag <literal>|COPY_FILE_ENABLE_SPARSE_COPY|</literal>.</para>
  333.              </listitem>
  334.            </itemizedlist>
  335.          </para>
  336. @@ -150,6 +150,9 @@
  337.              <listitem>
  338.                <para>Supports sparse streams (e.g. supports Win32 APIs <literal>|FSCTL_QUERY_ALLOCATED_RANGES|</literal>, <literal>|FSCTL_SET_SPARSE|</literal>, <literal>|FSCTL_SET_ZERO_DATA|</literal> etc. on Win32 named streams)</para>
  339.              </listitem>
  340. +            <listitem>
  341. +              <para>Supports Win32 named streams on directories.</para>
  342. +            </listitem>
  343.              <listitem>
  344.                <para>Requires NFSv4.1 server which supports the NFSv4.1 named attributes.</para>
  345.              </listitem>
  346. @@ -175,7 +178,7 @@
  347.                <para>Requires NFSv4.2 server which supports the NFSv4.2 operations "COPY", "DEALLOCATE", "SEEK"</para>
  348.              </listitem>
  349.              <listitem>
  350. -              <para>Sparse files are correctly copied including all hole and data ranges</para>
  351. +              <para>Sparse files+sparse Win32 named streams are correctly copied including all hole and data ranges</para>
  352.              </listitem>
  353.              <listitem>
  354.                <para>Windows 10 <literal>|CopyFile2()|</literal> API uses <literal>|FSCTL_OFFLOAD_READ|</literal>+<literal>|FSCTL_OFFLOAD_WRITE|</literal> by default</para>
  355. @@ -196,7 +199,7 @@
  356.                <para>Requires NFSv4.2 server which supports the NFSv4.2 operations "CLONE", "DEALLOCATE", "SEEK", and exports a filesystem which supports block cloning (e.g. Linux BTRFS+XFS, but NOT Linux tmpfs)</para>
  357.              </listitem>
  358.              <listitem>
  359. -              <para>Sparse files are correctly cloned, including all hole and data ranges</para>
  360. +              <para>Sparse files+sparse Win32 named streams are correctly cloned, including all hole and data ranges</para>
  361.              </listitem>
  362.              <listitem>
  363.                <para><filename>/usr/bin/winclonefile.exe</filename> can be used to clone a file</para>
  364. --
  365. 2.51.0
  366.  
  367. From d5616ba0e62c4701e8c4830268feed855917979d Mon Sep 17 00:00:00 2001
  368. From: Roland Mainz <roland.mainz@nrubsig.org>
  369. Date: Thu, 8 Jan 2026 22:21:37 +0100
  370. Subject: [PATCH 5/7] daemon: Fix state leak if ACL mapping for file/dir
  371.  creation fails
  372. MIME-Version: 1.0
  373. Content-Type: text/plain; charset=UTF-8
  374. Content-Transfer-Encoding: 8bit
  375.  
  376. Fix state leak if ACL mapping for file/dir creation fails.
  377.  
  378. Reported-by: Aurelien Couderc <aurelien.couderc2002@gmail.com>
  379. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  380. ---
  381. daemon/open.c | 8 ++++----
  382.  1 file changed, 4 insertions(+), 4 deletions(-)
  383.  
  384. diff --git a/daemon/open.c b/daemon/open.c
  385. index a86824c..585245c 100644
  386. --- a/daemon/open.c
  387. +++ b/daemon/open.c
  388. @@ -920,7 +920,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  389.              eprintf("handle_open: "
  390.                  "GetSecurityDescriptorDacl() failed, lasterr=%d\n",
  391.                  status);
  392. -            goto out;
  393. +            goto out_free_state;
  394.          }
  395.          status = GetSecurityDescriptorOwner(args->sec_desc,
  396.              &sid, &sid_default);
  397. @@ -929,7 +929,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  398.              eprintf("handle_open: "
  399.                  "GetSecurityDescriptorOwner() failed, lasterr=%d\n",
  400.                  status);
  401. -            goto out;
  402. +            goto out_free_state;
  403.          }
  404.          status = GetSecurityDescriptorGroup(args->sec_desc,
  405.              &gsid, &gsid_default);
  406. @@ -938,7 +938,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  407.              eprintf("handle_open: "
  408.                  "GetSecurityDescriptorOwner() failed, lasterr=%d\n",
  409.                  status);
  410. -            goto out;
  411. +            goto out_free_state;
  412.          }
  413.          status = map_dacl_2_nfs4acl(acl, sid, gsid, &create_nfs4_acl,
  414.              state->type,
  415. @@ -948,7 +948,7 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  416.              eprintf("handle_open: "
  417.                  "map_dacl_2_nfs4acl() failed, status=%d\n",
  418.                  status);
  419. -            goto out;
  420. +            goto out_free_state;
  421.          }
  422.      }
  423.  #endif /* NFS41_DRIVER_ALLOW_CREATEFILE_ACLS */
  424. --
  425. 2.51.0
  426.  
  427. From b1f973c9aa4bca91a175621dc0f0f2d5a77e08f4 Mon Sep 17 00:00:00 2001
  428. From: Roland Mainz <roland.mainz@nrubsig.org>
  429. Date: Thu, 8 Jan 2026 22:47:39 +0100
  430. Subject: [PATCH 6/7] tests: Do not use a hardcoded Win path to printf.exe
  431.  
  432. Do not use a hardcoded Windows path to printf.exe, Cygwin 32bit
  433. uses C:\cygwin\, Cygwin 64bit uses C:\cygwin64\, and MSYS2
  434. can be installed in any location.
  435.  
  436. Reported-by: Cedric Blancher <cedric.blancher@gmail.com>
  437. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  438. ---
  439. tests/sparsefiles/winsparsestream1.ksh | 12 +++++++-----
  440.  1 file changed, 7 insertions(+), 5 deletions(-)
  441.  
  442. diff --git a/tests/sparsefiles/winsparsestream1.ksh b/tests/sparsefiles/winsparsestream1.ksh
  443. index 897fdcd..c2eb19e 100644
  444. --- a/tests/sparsefiles/winsparsestream1.ksh
  445. +++ b/tests/sparsefiles/winsparsestream1.ksh
  446. @@ -37,6 +37,8 @@ function test_sparse_streams
  447.      set -o errexit
  448.      set -o nounset
  449.  
  450. +    # Windows path to printf.exe, Cygwin can use "C:\cygwin64" or "C:\cygwin"
  451. +    typeset -r wpath_printf="$(cygpath -w /bin/printf.exe)"
  452.      compound fsutilout
  453.  
  454.      rm -f ii
  455. @@ -52,19 +54,19 @@ function test_sparse_streams
  456.  
  457.          fsutil file createnew ${streamname} 0
  458.          fsutil sparse setflag ${streamname} 1
  459. -        cmd /C "C:\cygwin64\bin\printf.exe \"MARK1\\n\" >>${streamname}"
  460. +        cmd /C "${wpath_printf} \"MARK1\\n\" >>${streamname}"
  461.  
  462.          fsutil file seteof ${streamname} 0x100000000
  463. -        cmd /C "C:\cygwin64\bin\printf.exe \"MARK2\\n\" >>${streamname}"
  464. +        cmd /C "${wpath_printf} \"MARK2\\n\" >>${streamname}"
  465.  
  466.          fsutil file seteof ${streamname} 0x200000000
  467. -        cmd /C "C:\cygwin64\bin\printf.exe \"MARK3\\n\" >>${streamname}"
  468. +        cmd /C "${wpath_printf} \"MARK3\\n\" >>${streamname}"
  469.  
  470.          fsutil file seteof ${streamname} 0x300000000
  471. -        cmd /C "C:\cygwin64\bin\printf.exe \"MARK4\\n\" >>${streamname}"
  472. +        cmd /C "${wpath_printf} \"MARK4\\n\" >>${streamname}"
  473.  
  474.          fsutil file seteof ${streamname} 0x400000000
  475. -        cmd /C "C:\cygwin64\bin\printf.exe \"EOF.\\n\" >>${streamname}"
  476. +        cmd /C "${wpath_printf} \"EOF.\\n\" >>${streamname}"
  477.  
  478.          # check whether we really have five data sections
  479.          fsutilout.stderr="${ fsutilout.stdout="${ fsutil sparse queryrange ${streamname} || true ; }" 2>&1 ; }"
  480. --
  481. 2.51.0
  482.  
  483. From ab6f2ffef853d7dc0453776d448329833f4f011c Mon Sep 17 00:00:00 2001
  484. From: Roland Mainz <roland.mainz@nrubsig.org>
  485. Date: Thu, 8 Jan 2026 23:32:18 +0100
  486. Subject: [PATCH 7/7] daemon: Explicily return delegations if we instruct the
  487.  NFS server to query or modify data
  488.  
  489. Explicily return delegations if we instruct the NFS server to query
  490. (i.e. |FSCTL_QUERY_ALLOCATED_RANGES|) or modify data (i.e.
  491. |FSCTL_DUPLICATE_EXTENTS_TO_FILE|, |FSCTL_OFFLOAD_WRITE|).
  492.  
  493. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  494. ---
  495. daemon/fsctl.c | 11 +++++++++++
  496.  1 file changed, 11 insertions(+)
  497.  
  498. diff --git a/daemon/fsctl.c b/daemon/fsctl.c
  499. index a12d5d8..7d25a90 100644
  500. --- a/daemon/fsctl.c
  501. +++ b/daemon/fsctl.c
  502. @@ -278,6 +278,9 @@ int handle_queryallocatedranges(void *daemon_context,
  503.              "got space for %ld records\n",
  504.              (int)num_records));
  505.  
  506. +    nfs41_delegation_return(state->session, &state->file,
  507. +        OPEN_DELEGATE_READ, FALSE);
  508. +
  509.      args->buffer_overflow = FALSE;
  510.      args->returned_size = 0;
  511.  
  512. @@ -410,6 +413,9 @@ int handle_setzerodata(void *daemon_context,
  513.          goto out;
  514.      }
  515.  
  516. +    nfs41_delegation_return(state->session, &state->file,
  517. +        OPEN_DELEGATE_READ, FALSE);
  518. +
  519.      nfs41_open_stateid_arg(state, &stateid);
  520.  
  521.      status = nfs42_deallocate(session, file, &stateid,
  522. @@ -763,6 +769,11 @@ int handle_duplicatedata(void *daemon_context,
  523.          goto out;
  524.      }
  525.  
  526. +    nfs41_delegation_return(src_state->session, &src_state->file,
  527. +        OPEN_DELEGATE_READ, FALSE);
  528. +    nfs41_delegation_return(dst_state->session, &dst_state->file,
  529. +        OPEN_DELEGATE_READ, FALSE);
  530. +
  531.      nfs41_open_stateid_arg(src_state, &src_stateid);
  532.      nfs41_open_stateid_arg(dst_state, &dst_stateid);
  533.  
  534. --
  535. 2.51.0

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