pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patch to disable APCs, MariaDB (sparse file) tests+misc, 2025-07-23 ...
Posted by Anonymous on Wed 23rd Jul 2025 17:53
raw | new post

  1. From 2b84712f9a208d3c468e0dc168507fa86a872a90 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Tue, 22 Jul 2025 11:12:49 +0200
  4. Subject: [PATCH 1/5] sys: Add |unmarshal_nfs41_volume()| for consistency with
  5.  other updowncalls
  6.  
  7. Cleanup: Add |unmarshal_nfs41_volume()| for consistency with other
  8. updowncalls.
  9.  
  10. Reported-by: Dan Shelton <dan.f.shelton@gmail.com>
  11. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  12. ---
  13. sys/nfs41sys_driver.h     | 3 +++
  14.  sys/nfs41sys_updowncall.c | 2 +-
  15.  sys/nfs41sys_volinfo.c    | 7 +++++++
  16.  3 files changed, 11 insertions(+), 1 deletion(-)
  17.  
  18. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  19. index a5cb6cd..c6b6c0d 100644
  20. --- a/sys/nfs41sys_driver.h
  21. +++ b/sys/nfs41sys_driver.h
  22. @@ -877,6 +877,9 @@ NTSTATUS marshal_nfs41_volume(
  23.      unsigned char *buf,
  24.      ULONG buf_len,
  25.      ULONG *len);
  26. +void unmarshal_nfs41_volume(
  27. +    nfs41_updowncall_entry *cur,
  28. +    unsigned char **buf);
  29.  NTSTATUS nfs41_QueryVolumeInformation(
  30.      IN OUT PRX_CONTEXT RxContext);
  31.  
  32. diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
  33. index 7e113be..c623dea 100644
  34. --- a/sys/nfs41sys_updowncall.c
  35. +++ b/sys/nfs41sys_updowncall.c
  36. @@ -755,7 +755,7 @@ NTSTATUS nfs41_downcall(
  37.              unmarshal_nfs41_symlink(cur, &buf);
  38.              break;
  39.          case NFS41_SYSOP_VOLUME_QUERY:
  40. -            unmarshal_nfs41_attrget(cur, cur->buf, &cur->buf_len, &buf, TRUE);
  41. +            unmarshal_nfs41_volume(cur, &buf);
  42.              break;
  43.          case NFS41_SYSOP_ACL_QUERY:
  44.              status = unmarshal_nfs41_getacl(cur, &buf);
  45. diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
  46. index 182efcc..2028d4a 100644
  47. --- a/sys/nfs41sys_volinfo.c
  48. +++ b/sys/nfs41sys_volinfo.c
  49. @@ -99,6 +99,13 @@ out:
  50.      return status;
  51.  }
  52.  
  53. +void unmarshal_nfs41_volume(
  54. +    nfs41_updowncall_entry *cur,
  55. +    unsigned char **buf)
  56. +{
  57. +    unmarshal_nfs41_attrget(cur, cur->buf, &cur->buf_len, buf, TRUE);
  58. +}
  59. +
  60.  static void print_queryvolume_args(
  61.      PRX_CONTEXT RxContext)
  62.  {
  63. --
  64. 2.45.1
  65.  
  66. From 82bab5e9957bd098eab9921c3da6e13003ca07ed Mon Sep 17 00:00:00 2001
  67. From: Roland Mainz <roland.mainz@nrubsig.org>
  68. Date: Wed, 23 Jul 2025 14:02:07 +0200
  69. Subject: [PATCH 2/5] tests: Document MariaDB setup+testing
  70.  
  71. Document MariaDB SQL database setup+testing.
  72.  
  73. Reported-by: Aurelien Couderc <aurelien.couderc2002@gmail.com>
  74. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  75. ---
  76. tests/manual_testing.txt | 85 ++++++++++++++++++++++++++++++++++++++++
  77.  1 file changed, 85 insertions(+)
  78.  
  79. diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
  80. index e491a78..a4a3364 100644
  81. --- a/tests/manual_testing.txt
  82. +++ b/tests/manual_testing.txt
  83. @@ -796,5 +796,90 @@ curl --remote-name "https://www.cygwin.com/setup-x86.exe"
  84.  ./setup-x86 -q --no-write-registry --no-admin --root "$(cygpath -w "$PWD")" --no-desktop --allow-unsupported-windows -q --no-verify --site "http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2022/11/23/063457"
  85.  PATH="$PWD/bin" /cygdrive/c/Windows/system32/cmd.exe /C $'.\\bin\\bash.exe -x -c \'[[ "$(./bin/readlink.exe /proc/self/exe)" =~ $PWD/.*bin/.+ ]] && echo Test OK || echo Test failed'
  86.  
  87. +
  88. +#
  89. +# MariaDB testing
  90. +#
  91. +
  92. +#### Setup:
  93. +1. Install MariaDB from https://archive.mariadb.org//mariadb-11.8.2/winx64-packages/mariadb-11.8.2-winx64.msi
  94. +
  95. +2. Create user "MariaDB" and group "MariaDB entries in Cygwin /etc/passwd and /etc/group.
  96. +This is needed because the current ms-nfs41-client idmapper cannot lookup accounts from the "NT SERVICE" domain
  97. +$ getent passwd "NT SERVICE+MariaDB" | sed -E 's/NT SERVICE\+//' >>'/etc/passwd'
  98. +$ getent group "NT SERVICE+MariaDB" | sed -E 's/NT SERVICE\+// '>>'/etc/group'
  99. +
  100. +3. Create user "MariaDB" and group "MariaDB" on the NFS server, based on the Cygwin /etc/passwd and /etc/group entries
  101. +
  102. +4. Create GLOBAL mount N: (e.g. via $ msnfs41client sys_terminal #)
  103. +
  104. +5. Create MariaDB data dir on the NFSv4.2 share
  105. +$ mkdir '/cygdrive/n/mariadbtest'
  106. +
  107. +6. Edit '/cygdrive/c/Program Files/MariaDB 11.8/data/my.ini' and change "datadir" to "L:\mariadbtest".
  108. +Example:
  109. +---- snip ----
  110. +[mysqld]
  111. +datadir=N:\mariadbtest
  112. +port=3306
  113. +innodb_buffer_pool_size=1535M
  114. +character-set-server=utf8mb4
  115. +[client]
  116. +port=3306
  117. +plugin-dir=C:\Program Files\MariaDB 11.8/lib/plugin
  118. +---- snip ----
  119. +
  120. +7. Copy contents of '/cygdrive/c/Program Files/MariaDB 11.8/data' to '/cygdrive/n/mariadbtest'
  121. +$ (cd '/cygdrive/c/Program Files/MariaDB 11.8/data' && tar --sparse -cvf - .) | (cd '/cygdrive/n/mariadbtest' && tar -xf -)
  122. +
  123. +8. $ chown -R "MariaDB:MariaDB" mariadbtest # on the NFS server!!
  124. +
  125. +#### Testing sparse database file:
  126. +1. Test script
  127. +---- snip ----
  128. +$ cat testdbsparse1.ksh
  129. +integer line_num=0
  130. +typeset line
  131. +typeset escaped_line
  132. +
  133. +cat <<EOF
  134. +SELECT VERSION();
  135. +
  136. +DROP DATABASE IF EXISTS alphabet_test4;
  137. +CREATE DATABASE alphabet_test4;
  138. +USE alphabet_test4;
  139. +
  140. +# create table using InnoDB with PAGE_COMPRESSED=1 (which will use punch hole to free space)
  141. +CREATE TABLE file_data (
  142. +    line_number INT PRIMARY KEY,
  143. +    line_text TEXT
  144. +) ENGINE=InnoDB PAGE_COMPRESSED=1;
  145. +EOF
  146. +
  147. +while IFS= read -r line ; do
  148. +    (( line_num++ ))
  149. +    # Escape single quotes in the line to prevent SQL injection issues
  150. +    # This is a basic escape, for more complex data, consider prepared statements
  151. +    escaped_line="${line//\'/\'\'}"
  152. +
  153. +    # Insert the line number and text into the table
  154. +    printf $'INSERT INTO file_data (line_number, line_text) VALUES (%d, \'%s\');\n' line_num "$escaped_line"
  155. +done
  156. +
  157. +# force rebuild, including punching holes
  158. +printf 'OPTIMIZE TABLE file_data;'
  159. +
  160. +print -u2 '#Done;\n#Verify with\nUSE alphabet_test4; SELECT * FROM file_data ORDER BY line_number;\n'
  161. +# EOF.
  162. +---- snip ----
  163. +
  164. +2. Run this test script with a large text file as input:
  165. +---- snip ----
  166. +time ksh93 -c 'for ((i=0 ; i < 10 ; i++ )) ; do cat /usr/share/doc/mingw64-x86_64-gcc/NEWS ; done | ksh93 testdbsparse1.ksh | /cygdrive/c/Program\ Files/MariaDB\ 11.8/bin/mariadb -u root -p'
  167. +---- snip ----
  168. +
  169. +3. Check whether the database file now has holes:
  170. +$ lssparse -H /cygdrive/n/mariadbtest/alphabet_test4/file_data.ibd
  171. +
  172.  #
  173.  # EOF.
  174. --
  175. 2.45.1
  176.  
  177. From d749068796e6b8e265b6f106961eebbc6da6b6e7 Mon Sep 17 00:00:00 2001
  178. From: Dan Shelton <dan.f.shelton@gmail.com>
  179. Date: Wed, 23 Jul 2025 14:31:06 +0200
  180. Subject: [PATCH 3/5] sys: Disable APCs in |nfs41_UpcallWaitForReply()| while
  181.  waiting for upcall
  182.  
  183. Temporarily disable APCs (asynchronous procedure calls) in
  184. |nfs41_UpcallWaitForReply()| while waiting for upcall.
  185.  
  186. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  187. ---
  188. sys/nfs41sys_updowncall.c | 5 +++++
  189.  1 file changed, 5 insertions(+)
  190.  
  191. diff --git a/sys/nfs41sys_updowncall.c b/sys/nfs41sys_updowncall.c
  192. index c623dea..0b3b39c 100644
  193. --- a/sys/nfs41sys_updowncall.c
  194. +++ b/sys/nfs41sys_updowncall.c
  195. @@ -517,6 +517,8 @@ NTSTATUS nfs41_UpcallWaitForReply(
  196.  {
  197.      NTSTATUS status = STATUS_SUCCESS;
  198.  
  199. +    FsRtlEnterFileSystem();
  200. +
  201.      nfs41_AddEntry(upcallLock, upcall, entry);
  202.      KeSetEvent(&upcallEvent, 0, FALSE);
  203.  
  204. @@ -567,7 +569,10 @@ retry_wait:
  205.          goto out;
  206.      }
  207.      nfs41_RemoveEntry(downcallLock, entry);
  208. +
  209.  out:
  210. +    FsRtlExitFileSystem();
  211. +
  212.      return status;
  213.  }
  214.  
  215. --
  216. 2.45.1
  217.  
  218. From 41fee06eef44da57514c4437ec609fc83b6aeb07 Mon Sep 17 00:00:00 2001
  219. From: Dan Shelton <dan.f.shelton@gmail.com>
  220. Date: Wed, 23 Jul 2025 17:37:33 +0200
  221. Subject: [PATCH 4/5] sys: Disable APCs in RDR calls
  222.  
  223. Temporarily disable APCs (asynchronous procedure calls) in RDR
  224. calls.
  225.  
  226. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  227. ---
  228. sys/nfs41sys_acl.c       |  4 ++++
  229.  sys/nfs41sys_dir.c       |  2 ++
  230.  sys/nfs41sys_ea.c        |  5 +++++
  231.  sys/nfs41sys_fileinfo.c  |  4 ++++
  232.  sys/nfs41sys_fsctl.c     |  3 +++
  233.  sys/nfs41sys_ioctl.c     |  3 +++
  234.  sys/nfs41sys_lock.c      |  6 ++++++
  235.  sys/nfs41sys_mount.c     | 19 +++++++++++++++++++
  236.  sys/nfs41sys_openclose.c |  6 ++++++
  237.  sys/nfs41sys_readwrite.c |  8 ++++++++
  238.  sys/nfs41sys_reparse.c   |  4 ++++
  239.  sys/nfs41sys_symlink.c   |  3 +++
  240.  sys/nfs41sys_volinfo.c   |  2 ++
  241.  13 files changed, 69 insertions(+)
  242.  
  243. diff --git a/sys/nfs41sys_acl.c b/sys/nfs41sys_acl.c
  244. index fce29f5..2ddf93d 100644
  245. --- a/sys/nfs41sys_acl.c
  246. +++ b/sys/nfs41sys_acl.c
  247. @@ -225,6 +225,7 @@ NTSTATUS nfs41_QuerySecurityInformation(
  248.      print_debug_header(RxContext);
  249.      print_acl_args(info_class);
  250.  #endif
  251. +    FsRtlEnterFileSystem();
  252.  
  253.      status = check_nfs41_getacl_args(RxContext);
  254.      if (status) goto out;
  255. @@ -355,6 +356,7 @@ out:
  256.          t2.QuadPart - t1.QuadPart, getacl.tops, getacl.ticks);
  257.  #endif
  258.  #endif
  259. +    FsRtlExitFileSystem();
  260.  #ifdef DEBUG_ACL_QUERY
  261.      DbgEx();
  262.  #endif
  263. @@ -412,6 +414,7 @@ NTSTATUS nfs41_SetSecurityInformation(
  264.      print_debug_header(RxContext);
  265.      print_acl_args(info_class);
  266.  #endif
  267. +    FsRtlEnterFileSystem();
  268.  
  269.      status = check_nfs41_setacl_args(RxContext);
  270.      if (status) goto out;
  271. @@ -481,6 +484,7 @@ out:
  272.          t2.QuadPart - t1.QuadPart, setacl.tops, setacl.ticks);
  273.  #endif
  274.  #endif
  275. +    FsRtlExitFileSystem();
  276.  #ifdef DEBUG_ACL_SET
  277.      DbgEx();
  278.  #endif
  279. diff --git a/sys/nfs41sys_dir.c b/sys/nfs41sys_dir.c
  280. index 1e9f581..7f565f5 100644
  281. --- a/sys/nfs41sys_dir.c
  282. +++ b/sys/nfs41sys_dir.c
  283. @@ -238,6 +238,7 @@ NTSTATUS nfs41_QueryDirectory(
  284.      DbgEn();
  285.      print_querydir_args(RxContext);
  286.  #endif
  287. +    FsRtlEnterFileSystem();
  288.  
  289.      status = check_nfs41_dirquery_args(RxContext);
  290.      if (status) goto out;
  291. @@ -335,6 +336,7 @@ out:
  292.          t2.QuadPart - t1.QuadPart, readdir.tops, readdir.ticks);
  293.  #endif
  294.  #endif
  295. +    FsRtlExitFileSystem();
  296.  #ifdef DEBUG_DIR_QUERY
  297.      DbgEx();
  298.  #endif
  299. diff --git a/sys/nfs41sys_ea.c b/sys/nfs41sys_ea.c
  300. index 04447e8..db2005b 100644
  301. --- a/sys/nfs41sys_ea.c
  302. +++ b/sys/nfs41sys_ea.c
  303. @@ -346,6 +346,7 @@ NTSTATUS nfs41_SetEaInformation(
  304.      print_debug_header(RxContext);
  305.      print_ea_info(eainfo);
  306.  #endif
  307. +    FsRtlEnterFileSystem();
  308.  
  309.      status = check_nfs41_setea_args(RxContext);
  310.      if (status) goto out;
  311. @@ -411,6 +412,7 @@ out:
  312.          t2.QuadPart - t1.QuadPart, setexattr.tops, setexattr.ticks);
  313.  #endif
  314.  #endif
  315. +    FsRtlExitFileSystem();
  316.  #ifdef DEBUG_EA_SET
  317.      DbgEx();
  318.  #endif
  319. @@ -624,6 +626,8 @@ NTSTATUS nfs41_QueryEaInformation(
  320.      print_debug_header(RxContext);
  321.      print_get_ea(1, query);
  322.  #endif
  323. +    FsRtlEnterFileSystem();
  324. +
  325.      status = check_nfs41_queryea_args(RxContext);
  326.      if (status) goto out;
  327.  
  328. @@ -688,6 +692,7 @@ out:
  329.          t2.QuadPart - t1.QuadPart, getexattr.tops, getexattr.ticks);
  330.  #endif
  331.  #endif
  332. +    FsRtlExitFileSystem();
  333.  #ifdef DEBUG_EA_QUERY
  334.      DbgEx();
  335.  #endif
  336. diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
  337. index 202e2fd..d7dc5e7 100644
  338. --- a/sys/nfs41sys_fileinfo.c
  339. +++ b/sys/nfs41sys_fileinfo.c
  340. @@ -205,6 +205,7 @@ NTSTATUS nfs41_QueryFileInformation(
  341.      DbgP("--> nfs41_QueryFileInformation, RxContext->Info.LengthRemaining=%ld\n",
  342.          (long)RxContext->Info.LengthRemaining);
  343.  #endif
  344. +    FsRtlEnterFileSystem();
  345.  
  346.      status = check_nfs41_dirquery_args(RxContext);
  347.      if (status) {
  348. @@ -500,6 +501,7 @@ out:
  349.          t2.QuadPart - t1.QuadPart, getattr.tops, getattr.ticks);
  350.  #endif
  351.  #endif
  352. +    FsRtlExitFileSystem();
  353.  #ifdef DEBUG_FILE_QUERY
  354.      DbgEx();
  355.      DbgP("<-- nfs41_QueryFileInformation, status=0x%lx\n",
  356. @@ -655,6 +657,7 @@ NTSTATUS nfs41_SetFileInformation(
  357.      DbgEn();
  358.      print_debug_filedirquery_header(RxContext);
  359.  #endif
  360. +    FsRtlEnterFileSystem();
  361.  
  362.      status = check_nfs41_setattr_args(RxContext);
  363.      if (status) goto out;
  364. @@ -772,6 +775,7 @@ out:
  365.          t2.QuadPart - t1.QuadPart, setattr.tops, setattr.ticks);
  366.  #endif
  367.  #endif
  368. +    FsRtlExitFileSystem();
  369.  #ifdef DEBUG_FILE_SET
  370.      DbgEx();
  371.  #endif
  372. diff --git a/sys/nfs41sys_fsctl.c b/sys/nfs41sys_fsctl.c
  373. index 9df5528..c1a3f2b 100644
  374. --- a/sys/nfs41sys_fsctl.c
  375. +++ b/sys/nfs41sys_fsctl.c
  376. @@ -871,6 +871,8 @@ NTSTATUS nfs41_FsCtl(
  377.      DbgEn();
  378.      print_debug_header(RxContext);
  379.  #endif
  380. +    FsRtlEnterFileSystem();
  381. +
  382.      const ULONG fscontrolcode =
  383.          RxContext->LowIoContext.ParamsFor.FsCtl.FsControlCode;
  384.  
  385. @@ -910,6 +912,7 @@ NTSTATUS nfs41_FsCtl(
  386.      }
  387.  #endif /* DEBUG_FSCTL */
  388.  
  389. +    FsRtlExitFileSystem();
  390.  #ifdef DEBUG_FSCTL
  391.      DbgEx();
  392.  #endif
  393. diff --git a/sys/nfs41sys_ioctl.c b/sys/nfs41sys_ioctl.c
  394. index 56da370..4496be9 100644
  395. --- a/sys/nfs41sys_ioctl.c
  396. +++ b/sys/nfs41sys_ioctl.c
  397. @@ -77,12 +77,15 @@ NTSTATUS nfs41_IoCtl(
  398.      DbgEn();
  399.      print_debug_header(RxContext);
  400.  #endif /* DEBUG_IOCTL */
  401. +    FsRtlEnterFileSystem();
  402. +
  403.      const ULONG iocontrolcode =
  404.          RxContext->LowIoContext.ParamsFor.IoCtl.IoControlCode;
  405.  
  406.      DbgP("nfs41_IoCtl: IoControlCode=0x%lx, status=0x%lx\n",
  407.          (unsigned long)iocontrolcode, (long)status);
  408.  
  409. +    FsRtlExitFileSystem();
  410.  #ifdef DEBUG_IOCTL
  411.      DbgEx();
  412.  #endif
  413. diff --git a/sys/nfs41sys_lock.c b/sys/nfs41sys_lock.c
  414. index 803c4c1..7bd2132 100644
  415. --- a/sys/nfs41sys_lock.c
  416. +++ b/sys/nfs41sys_lock.c
  417. @@ -166,11 +166,13 @@ NTSTATUS nfs41_IsLockRealizable(
  418.          BooleanFlagOn(LowIoLockFlags, SL_EXCLUSIVE_LOCK),
  419.          !BooleanFlagOn(LowIoLockFlags, SL_FAIL_IMMEDIATELY));
  420.  #endif
  421. +    FsRtlEnterFileSystem();
  422.  
  423.      /* NFS lock operations with length=0 MUST fail with NFS4ERR_INVAL */
  424.      if (Length->QuadPart == 0)
  425.          status = STATUS_NOT_SUPPORTED;
  426.  
  427. +    FsRtlExitFileSystem();
  428.  #ifdef DEBUG_LOCK
  429.      DbgEx();
  430.  #endif
  431. @@ -286,6 +288,7 @@ NTSTATUS nfs41_Lock(
  432.      DbgEn();
  433.      print_lock_args(RxContext);
  434.  #endif
  435. +    FsRtlEnterFileSystem();
  436.  
  437.  /*  RxReleaseFcbResourceForThreadInMRx(RxContext, RxContext->pFcb,
  438.          LowIoContext->ResourceThreadId); */
  439. @@ -343,6 +346,7 @@ out:
  440.          lock.tops, lock.ticks);
  441.  #endif
  442.  #endif
  443. +    FsRtlExitFileSystem();
  444.  #ifdef DEBUG_LOCK
  445.      DbgEx();
  446.  #endif
  447. @@ -404,6 +408,7 @@ NTSTATUS nfs41_Unlock(
  448.      DbgEn();
  449.      print_lock_args(RxContext);
  450.  #endif
  451. +    FsRtlEnterFileSystem();
  452.  
  453.  /*  RxReleaseFcbResourceForThreadInMRx(RxContext, RxContext->pFcb,
  454.          LowIoContext->ResourceThreadId); */
  455. @@ -463,6 +468,7 @@ out:
  456.          unlock.tops, unlock.ticks);
  457.  #endif
  458.  #endif
  459. +    FsRtlExitFileSystem();
  460.  #ifdef DEBUG_LOCK
  461.      DbgEx();
  462.  #endif
  463. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  464. index e328885..5e66eda 100644
  465. --- a/sys/nfs41sys_mount.c
  466. +++ b/sys/nfs41sys_mount.c
  467. @@ -841,6 +841,7 @@ NTSTATUS nfs41_CreateVNetRoot(
  468.          pCreateNetRootContext->VirtualNetRootStatus,
  469.          (long)pCreateNetRootContext->NetRootStatus);
  470.  #endif
  471. +    FsRtlEnterFileSystem();
  472.  
  473.      if (pNetRoot->Type != NET_ROOT_DISK && pNetRoot->Type != NET_ROOT_WILD) {
  474.          print_error("nfs41_CreateVNetRoot: Unsupported NetRoot Type %u\n",
  475. @@ -1246,6 +1247,8 @@ out:
  476.      /* RDBSS expects that MRxCreateVNetRoot returns STATUS_PENDING
  477.       * on success or failure */
  478.      status = STATUS_PENDING;
  479. +
  480. +    FsRtlExitFileSystem();
  481.  #ifdef DEBUG_MOUNT
  482.      DbgEx();
  483.  #endif
  484. @@ -1299,6 +1302,8 @@ NTSTATUS nfs41_FinalizeSrvCall(
  485.  #ifdef DEBUG_MOUNT
  486.      DbgEn();
  487.  #endif
  488. +    FsRtlEnterFileSystem();
  489. +
  490.      // print_srv_call(pSrvCall);
  491.  
  492.      if (pSrvCall->Context == NULL)
  493. @@ -1310,6 +1315,7 @@ NTSTATUS nfs41_FinalizeSrvCall(
  494.  
  495.      pSrvCall->Context = NULL;
  496.  out:
  497. +    FsRtlExitFileSystem();
  498.  #ifdef DEBUG_MOUNT
  499.      DbgEx();
  500.  #endif
  501. @@ -1330,6 +1336,7 @@ NTSTATUS nfs41_FinalizeNetRoot(
  502.      DbgEn();
  503.      print_net_root(pNetRoot);
  504.  #endif
  505. +    FsRtlEnterFileSystem();
  506.  
  507.      if (pNetRoot->Type != NET_ROOT_DISK && pNetRoot->Type != NET_ROOT_WILD) {
  508.          status = STATUS_NOT_SUPPORTED;
  509. @@ -1420,6 +1427,7 @@ NTSTATUS nfs41_FinalizeNetRoot(
  510.              break;
  511.      } while (1);
  512.  out:
  513. +    FsRtlExitFileSystem();
  514.  #ifdef DEBUG_MOUNT
  515.      DbgEx();
  516.  #endif
  517. @@ -1435,9 +1443,13 @@ NTSTATUS nfs41_FinalizeVNetRoot(
  518.      DbgEn();
  519.      print_v_net_root(pVNetRoot);
  520.  #endif
  521. +    FsRtlEnterFileSystem();
  522. +
  523.      if (pVNetRoot->pNetRoot->Type != NET_ROOT_DISK &&
  524.              pVNetRoot->pNetRoot->Type != NET_ROOT_WILD)
  525.          status = STATUS_NOT_SUPPORTED;
  526. +
  527. +    FsRtlExitFileSystem();
  528.  #ifdef DEBUG_MOUNT
  529.      DbgEx();
  530.  #endif
  531. @@ -1457,6 +1469,8 @@ NTSTATUS GetConnectionHandle(
  532.  #ifdef DEBUG_MOUNT
  533.      DbgEn();
  534.  #endif
  535. +    FsRtlEnterFileSystem();
  536. +
  537.      InitializeObjectAttributes(&ObjectAttributes, ConnectionName,
  538.          OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE, NULL, NULL);
  539.  
  540. @@ -1467,6 +1481,7 @@ NTSTATUS GetConnectionHandle(
  541.          FILE_CREATE_TREE_CONNECTION | FILE_SYNCHRONOUS_IO_NONALERT,
  542.          EaBuffer, EaLength);
  543.  
  544. +    FsRtlExitFileSystem();
  545.  #ifdef DEBUG_MOUNT
  546.      DbgEx();
  547.  #endif
  548. @@ -1545,6 +1560,7 @@ NTSTATUS nfs41_CreateConnection(
  549.  #ifdef DEBUG_MOUNT
  550.      DbgEn();
  551.  #endif
  552. +    FsRtlEnterFileSystem();
  553.  
  554.      if (!Wait) {
  555.          //just post right now!
  556. @@ -1563,6 +1579,7 @@ NTSTATUS nfs41_CreateConnection(
  557.      if (!status && Handle != INVALID_HANDLE_VALUE)
  558.          ZwClose(Handle);
  559.  out:
  560. +    FsRtlExitFileSystem();
  561.  #ifdef DEBUG_MOUNT
  562.      DbgEx();
  563.  #endif
  564. @@ -1585,6 +1602,7 @@ NTSTATUS nfs41_DeleteConnection(
  565.  #ifdef DEBUG_MOUNT
  566.      DbgEn();
  567.  #endif
  568. +    FsRtlEnterFileSystem();
  569.  
  570.      if (!Wait) {
  571.          //just post right now!
  572. @@ -1625,6 +1643,7 @@ NTSTATUS nfs41_DeleteConnection(
  573.      }
  574.      ZwClose(Handle);
  575.  out:
  576. +    FsRtlExitFileSystem();
  577.  #ifdef DEBUG_MOUNT
  578.      DbgEx();
  579.  #endif
  580. diff --git a/sys/nfs41sys_openclose.c b/sys/nfs41sys_openclose.c
  581. index 406c1bf..94d3fa8 100644
  582. --- a/sys/nfs41sys_openclose.c
  583. +++ b/sys/nfs41sys_openclose.c
  584. @@ -617,6 +617,7 @@ NTSTATUS nfs41_Create(
  585.      print_nt_create_params(1, RxContext->Create.NtCreateParameters);
  586.      // if (ea) print_ea_info(ea);
  587.  #endif
  588. +    FsRtlEnterFileSystem();
  589.  
  590.      status = check_nfs41_create_args(RxContext);
  591.      if (status) goto out;
  592. @@ -1075,6 +1076,7 @@ out:
  593.  #endif
  594.      }
  595.  #endif
  596. +    FsRtlExitFileSystem();
  597.  #ifdef DEBUG_OPEN
  598.      DbgEx();
  599.  #endif
  600. @@ -1086,6 +1088,8 @@ NTSTATUS nfs41_CollapseOpen(
  601.  {
  602.      NTSTATUS status = STATUS_MORE_PROCESSING_REQUIRED;
  603.      DbgEn();
  604. +    FsRtlEnterFileSystem();
  605. +    FsRtlExitFileSystem();
  606.      DbgEx();
  607.      return status;
  608.  }
  609. @@ -1140,6 +1144,7 @@ NTSTATUS nfs41_CloseSrvOpen(
  610.      DbgEn();
  611.      print_debug_header(RxContext);
  612.  #endif
  613. +    FsRtlEnterFileSystem();
  614.  
  615.      if (!nfs41_fobx->deleg_type && !nfs41_fcb->StandardInfo.Directory &&
  616.              !RxContext->pFcb->OpenCount) {
  617. @@ -1183,6 +1188,7 @@ out:
  618.          t2.QuadPart - t1.QuadPart, close.tops, close.ticks);
  619.  #endif
  620.  #endif
  621. +    FsRtlExitFileSystem();
  622.  #ifdef DEBUG_CLOSE
  623.      DbgEx();
  624.  #endif
  625. diff --git a/sys/nfs41sys_readwrite.c b/sys/nfs41sys_readwrite.c
  626. index b60d544..bdef760 100644
  627. --- a/sys/nfs41sys_readwrite.c
  628. +++ b/sys/nfs41sys_readwrite.c
  629. @@ -250,6 +250,8 @@ NTSTATUS nfs41_Read(
  630.      DbgEn();
  631.      print_readwrite_args(RxContext);
  632.  #endif
  633. +    FsRtlEnterFileSystem();
  634. +
  635.      status = check_nfs41_read_args(RxContext);
  636.      if (status) goto out;
  637.  
  638. @@ -322,6 +324,7 @@ out:
  639.          read.tops, read.ticks);
  640.  #endif
  641.  #endif
  642. +    FsRtlExitFileSystem();
  643.  #ifdef DEBUG_READ
  644.      DbgEx();
  645.  #endif
  646. @@ -373,6 +376,7 @@ NTSTATUS nfs41_Write(
  647.      DbgEn();
  648.      print_readwrite_args(RxContext);
  649.  #endif
  650. +    FsRtlEnterFileSystem();
  651.  
  652.      status = check_nfs41_write_args(RxContext);
  653.      if (status) goto out;
  654. @@ -454,6 +458,7 @@ out:
  655.          write.tops, write.ticks);
  656.  #endif
  657.  #endif
  658. +    FsRtlExitFileSystem();
  659.  #ifdef DEBUG_WRITE
  660.      DbgEx();
  661.  #endif
  662. @@ -476,6 +481,8 @@ ULONG nfs41_ExtendForCache(
  663.          (long long)pNewFileSize->QuadPart,
  664.          (long long)pNewAllocationSize->QuadPart);
  665.  #endif
  666. +    FsRtlEnterFileSystem();
  667. +
  668.      pNewAllocationSize->QuadPart = pNewFileSize->QuadPart;
  669.      nfs41_fcb->StandardInfo.AllocationSize.QuadPart =
  670.          pNewAllocationSize->QuadPart;
  671. @@ -485,6 +492,7 @@ ULONG nfs41_ExtendForCache(
  672.          (long long)pNewFileSize->QuadPart,
  673.          (long long)pNewAllocationSize->QuadPart);
  674.  #endif
  675. +    FsRtlExitFileSystem();
  676.  #ifdef DEBUG_CACHE
  677.      DbgEx();
  678.  #endif
  679. diff --git a/sys/nfs41sys_reparse.c b/sys/nfs41sys_reparse.c
  680. index df4fa1f..f97b6bf 100644
  681. --- a/sys/nfs41sys_reparse.c
  682. +++ b/sys/nfs41sys_reparse.c
  683. @@ -80,6 +80,7 @@ NTSTATUS nfs41_SetReparsePoint(
  684.      __notnull PREPARSE_DATA_BUFFER Reparse = (PREPARSE_DATA_BUFFER)FsCtl->pInputBuffer;
  685.  
  686.      DbgEn();
  687. +    FsRtlEnterFileSystem();
  688.  
  689.      DbgP("nfs41_SetReparsePoint: ReparseTag: '%s'/0x%04lx\n",
  690.          reparsetag2string(Reparse->ReparseTag),
  691. @@ -98,6 +99,7 @@ NTSTATUS nfs41_SetReparsePoint(
  692.              break;
  693.      }
  694.  
  695. +    FsRtlExitFileSystem();
  696.      DbgEx();
  697.      return status;
  698.  }
  699. @@ -109,9 +111,11 @@ NTSTATUS nfs41_GetReparsePoint(
  700.      NTSTATUS status;
  701.  
  702.      DbgEn();
  703. +    FsRtlEnterFileSystem();
  704.  
  705.      status = nfs41_GetSymlinkReparsePoint(RxContext);
  706.  
  707. +    FsRtlExitFileSystem();
  708.      DbgEx();
  709.      return status;
  710.  }
  711. diff --git a/sys/nfs41sys_symlink.c b/sys/nfs41sys_symlink.c
  712. index 6db82de..43334a1 100644
  713. --- a/sys/nfs41sys_symlink.c
  714. +++ b/sys/nfs41sys_symlink.c
  715. @@ -565,6 +565,8 @@ NTSTATUS nfs41_GetSymlinkReparsePoint(
  716.  #ifdef DEBUG_SYMLINK
  717.      DbgEn();
  718.  #endif
  719. +    FsRtlEnterFileSystem();
  720. +
  721.      status = check_nfs41_getsymlinkreparse_args(RxContext);
  722.      if (status) {
  723.          DbgP("nfs41_GetSymlinkReparsePoint: "
  724. @@ -903,6 +905,7 @@ out:
  725.      if (targetname_buffer)
  726.          RxFreePool(targetname_buffer);
  727.  
  728. +    FsRtlExitFileSystem();
  729.  #ifdef DEBUG_SYMLINK
  730.      DbgEx();
  731.  #endif
  732. diff --git a/sys/nfs41sys_volinfo.c b/sys/nfs41sys_volinfo.c
  733. index 2028d4a..e663d0b 100644
  734. --- a/sys/nfs41sys_volinfo.c
  735. +++ b/sys/nfs41sys_volinfo.c
  736. @@ -158,6 +158,7 @@ NTSTATUS nfs41_QueryVolumeInformation(
  737.      DbgEn();
  738.      print_queryvolume_args(RxContext);
  739.  #endif
  740. +    FsRtlEnterFileSystem();
  741.  
  742.      status = check_nfs41_dirquery_args(RxContext);
  743.      if (status) goto out;
  744. @@ -240,6 +241,7 @@ out:
  745.          t2.QuadPart - t1.QuadPart, volume.tops, volume.ticks);
  746.  #endif
  747.  #endif
  748. +    FsRtlExitFileSystem();
  749.  #ifdef DEBUG_VOLUME_QUERY
  750.      DbgEx();
  751.  #endif
  752. --
  753. 2.45.1
  754.  
  755. From 1e6c9c98c8801bcb18a1bea89c22fbf94d063644 Mon Sep 17 00:00:00 2001
  756. From: Roland Mainz <roland.mainz@nrubsig.org>
  757. Date: Wed, 23 Jul 2025 18:25:39 +0200
  758. Subject: [PATCH 5/5] daemon: Add hack to allow renaming files which are still
  759.  opened
  760.  
  761. Add hack to allow renaming files which are still opened. We
  762. still need to figure out what the correct Win32 behaviour would be.
  763.  
  764. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  765. ---
  766. daemon/setattr.c | 10 +++++++++-
  767.  1 file changed, 9 insertions(+), 1 deletion(-)
  768.  
  769. diff --git a/daemon/setattr.c b/daemon/setattr.c
  770. index 322e934..ab124c8 100644
  771. --- a/daemon/setattr.c
  772. +++ b/daemon/setattr.c
  773. @@ -465,9 +465,17 @@ static int handle_nfs41_rename(void *daemon_context, setattr_upcall_args *args)
  774.          /* AGLO: 03/21/2011: we can't handle rename of a file with a filename
  775.           * that is currently opened by this client
  776.           */
  777. -        eprintf("handle_nfs41_rename: '%s' is opened\n", dst_path.path);
  778. +        eprintf("handle_nfs41_rename: destination '%s' is opened\n",
  779. +            dst_path.path);
  780. +/*
  781. + * gisburn: HACK: We have disabled this check to get MariaDB working,
  782. + * but we have to figure out what is the correct solution compared
  783. + * to NTFS and SMBFS
  784. + */
  785. +#ifdef DISABLED_FOR_NOW
  786.          status = ERROR_FILE_EXISTS;
  787.          goto out;
  788. +#endif
  789.      }
  790.  
  791.      /* break any delegations on the source file */
  792. --
  793. 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