pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Fixes for volumelabel, fileallocationinfo changeattr+misc, 2025-07-17
Posted by Anonymous on Thu 17th Jul 2025 20:14
raw | new post

  1. From fb2c62facec29d3859a858fd8471c01382918d1e Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Thu, 17 Jul 2025 19:40:39 +0200
  4. Subject: [PATCH 1/5] sys: Fix updowncall timeout= mount option
  5.  
  6. Fix updowncall timeout= mount option, it should support more
  7. than the default value.
  8.  
  9. Reported-by: Josh Hurst <joshhurst@gmail.com>
  10. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  11. ---
  12. sys/nfs41sys_mount.c | 4 ++--
  13.  1 file changed, 2 insertions(+), 2 deletions(-)
  14.  
  15. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  16. index 181faca..e328885 100644
  17. --- a/sys/nfs41sys_mount.c
  18. +++ b/sys/nfs41sys_mount.c
  19. @@ -475,8 +475,8 @@ NTSTATUS nfs41_MountConfig_ParseOptions(
  20.          }
  21.          else if (wcsncmp(L"timeout", Name, NameLen) == 0) {
  22.              status = nfs41_MountConfig_ParseDword(Option, &usValue,
  23. -                &Config->timeout, UPCALL_TIMEOUT_DEFAULT,
  24. -                UPCALL_TIMEOUT_DEFAULT);
  25. +                &Config->timeout, 15,
  26. +                3600);
  27.          }
  28.          else if (wcsncmp(L"rsize", Name, NameLen) == 0) {
  29.              status = nfs41_MountConfig_ParseDword(Option, &usValue,
  30. --
  31. 2.45.1
  32.  
  33. From 727185b922ebab407a63a1dff93f7aa589d8919f Mon Sep 17 00:00:00 2001
  34. From: Roland Mainz <roland.mainz@nrubsig.org>
  35. Date: Thu, 17 Jul 2025 19:42:58 +0200
  36. Subject: [PATCH 2/5] daemon: Setting the |FileAllocationInformation| should
  37.  return the correct changeattr value
  38.  
  39. Setting the |FileAllocationInformation| should return the correct
  40. changeattr value.
  41.  
  42. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  43. ---
  44. daemon/setattr.c |  5 +++--
  45.  daemon/util.c    | 13 +++++++++++++
  46.  daemon/util.h    |  3 +++
  47.  3 files changed, 19 insertions(+), 2 deletions(-)
  48.  
  49. diff --git a/daemon/setattr.c b/daemon/setattr.c
  50. index e4926a4..a812708 100644
  51. --- a/daemon/setattr.c
  52. +++ b/daemon/setattr.c
  53. @@ -41,7 +41,6 @@
  54.  #error UPCALL_BUF_SIZE too small for rename ((NFS41_MAX_PATH_LEN*2)+2048)
  55.  #endif
  56.  
  57. -
  58.  /* NFS41_SYSOP_FILE_SET */
  59.  static int parse_setattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
  60.  {
  61. @@ -515,7 +514,9 @@ static int handle_nfs41_set_size(void *daemon_context, setattr_upcall_args *args
  62.       * automagically
  63.       */
  64.      if (args->set_class == FileAllocationInformation) {
  65. -        status = NO_ERROR;
  66. +        status = nfs41_cached_getchangeattr(state, &info);
  67. +        EASSERT(bitmap_isset(&info.attrmask, 0, FATTR4_WORD0_CHANGE));
  68. +        args->ctime = info.change;
  69.          goto out;
  70.      }
  71.  
  72. diff --git a/daemon/util.c b/daemon/util.c
  73. index 3a56b7c..bf99ac1 100644
  74. --- a/daemon/util.c
  75. +++ b/daemon/util.c
  76. @@ -638,3 +638,16 @@ bool getwinntversionnnumbers(
  77.      return false;
  78.  #endif /* _WIN64 */
  79.  }
  80. +
  81. +int nfs41_cached_getchangeattr(nfs41_open_state *state, nfs41_file_info *restrict info)
  82. +{
  83. +    int status;
  84. +    bitmap4 change_bitmap = {
  85. +        .count = 1,
  86. +        .arr[0] = FATTR4_WORD0_CHANGE,
  87. +    };
  88. +
  89. +    status = nfs41_cached_getattr(state->session,
  90. +        &state->file, &change_bitmap, info);
  91. +    return status;
  92. +}
  93. diff --git a/daemon/util.h b/daemon/util.h
  94. index 3f640cc..53c0ad3 100644
  95. --- a/daemon/util.h
  96. +++ b/daemon/util.h
  97. @@ -34,6 +34,7 @@
  98.  extern DWORD NFS41D_VERSION;
  99.  struct __nfs41_session;
  100.  struct __nfs41_write_verf;
  101. +typedef struct __nfs41_open_state nfs41_open_state;
  102.  typedef struct __nfs41_file_info nfs41_file_info;
  103.  typedef struct __nfs41_superblock nfs41_superblock;
  104.  enum stable_how4;
  105. @@ -376,4 +377,6 @@ bool_t waitcriticalsection(LPCRITICAL_SECTION cs);
  106.  
  107.  bool getwinntversionnnumbers(DWORD *MajorVersionPtr, DWORD *MinorVersionPtr, DWORD *BuildNumberPtr);
  108.  
  109. +int nfs41_cached_getchangeattr(nfs41_open_state *state, nfs41_file_info *restrict info);
  110. +
  111.  #endif /* !__NFS41_DAEMON_UTIL_H__ */
  112. --
  113. 2.45.1
  114.  
  115. From a14380fd029efdbcebd5faf774cd31f98546f1a5 Mon Sep 17 00:00:00 2001
  116. From: Roland Mainz <roland.mainz@nrubsig.org>
  117. Date: Thu, 17 Jul 2025 20:00:40 +0200
  118. Subject: [PATCH 3/5] daemon: Fix returned size values for
  119.  |FileFsAttributeInformation|+|FileFsVolumeInformation|
  120.  
  121. Fix returned size values for |FileFsAttributeInformation|+|FileFsVolumeInformation|
  122.  
  123. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  124. ---
  125. daemon/volume.c | 6 ++++--
  126.  1 file changed, 4 insertions(+), 2 deletions(-)
  127.  
  128. diff --git a/daemon/volume.c b/daemon/volume.c
  129. index d1df718..6c0e058 100644
  130. --- a/daemon/volume.c
  131. +++ b/daemon/volume.c
  132. @@ -154,7 +154,8 @@ static int handle_volume(void *daemon_context, nfs41_upcall *upcall)
  133.              2049,
  134.              (session->client->root->use_nfspubfh?"":""));
  135.          vi->VolumeLabelLength = (ULONG)(wcslen(vi->VolumeLabel)*sizeof(wchar_t));
  136. -        args->len = sizeof(args->info.volume_info) + vi->VolumeLabelLength;
  137. +        args->len = sizeof(args->info.volume_info) +
  138. +            vi->VolumeLabelLength - 1*sizeof(wchar_t);
  139.          break;
  140.  
  141.      case FileFsSizeInformation:
  142. @@ -182,9 +183,10 @@ static int handle_volume(void *daemon_context, nfs41_upcall *upcall)
  143.          break;
  144.  
  145.      case FileFsAttributeInformation:
  146. -        args->len = sizeof(args->info.attribute);
  147.          nfs41_superblock_fs_attributes(upcall->state_ref->file.fh.superblock,
  148.              &args->info.attribute);
  149. +        args->len = sizeof(FILE_FS_ATTRIBUTE_INFORMATION) +
  150. +            args->info.attribute.FileSystemNameLength-1*sizeof(wchar_t);
  151.          break;
  152.  
  153.      case FileFsSectorSizeInformation:
  154. --
  155. 2.45.1
  156.  
  157. From 8131d5ef3df5f384bb30a6ed0dc448a0448db61b Mon Sep 17 00:00:00 2001
  158. From: Roland Mainz <roland.mainz@nrubsig.org>
  159. Date: Thu, 17 Jul 2025 20:02:38 +0200
  160. Subject: [PATCH 4/5] daemon: Fix volumelabel size in alternate |MAX_PATH|
  161.  codepath
  162.  
  163. Fix volumelabel size in alternate |MAX_PATH| codepath
  164.  
  165. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  166. ---
  167. daemon/volume.c | 2 +-
  168.  1 file changed, 1 insertion(+), 1 deletion(-)
  169.  
  170. diff --git a/daemon/volume.c b/daemon/volume.c
  171. index 6c0e058..cba4c1d 100644
  172. --- a/daemon/volume.c
  173. +++ b/daemon/volume.c
  174. @@ -147,7 +147,7 @@ static int handle_volume(void *daemon_context, nfs41_upcall *upcall)
  175.               */
  176.              31,
  177.  #else
  178. -            (MAX_PATH*sizeof(wchar_t)),
  179. +            MAX_PATH,
  180.  #endif
  181.              L"nfs://%s:%d/%s",
  182.              session->client->rpc->server_name,
  183. --
  184. 2.45.1
  185.  
  186. From 96b9206b655f9b59fbcab0c045c94bd61a05a072 Mon Sep 17 00:00:00 2001
  187. From: Roland Mainz <roland.mainz@nrubsig.org>
  188. Date: Thu, 17 Jul 2025 20:06:20 +0200
  189. Subject: [PATCH 5/5] daemon: volume label nfs://-URL should include parameter
  190.  for public NFS
  191.  
  192. nfs://-URL returned by |FileFsVolumeInformation|'s volume label field
  193. should include parameter for public NFS.
  194.  
  195. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  196. ---
  197. daemon/volume.c | 2 +-
  198.  1 file changed, 1 insertion(+), 1 deletion(-)
  199.  
  200. diff --git a/daemon/volume.c b/daemon/volume.c
  201. index cba4c1d..c32022e 100644
  202. --- a/daemon/volume.c
  203. +++ b/daemon/volume.c
  204. @@ -152,7 +152,7 @@ static int handle_volume(void *daemon_context, nfs41_upcall *upcall)
  205.              L"nfs://%s:%d/%s",
  206.              session->client->rpc->server_name,
  207.              2049,
  208. -            (session->client->root->use_nfspubfh?"":""));
  209. +            (session->client->root->use_nfspubfh?"public=1":""));
  210.          vi->VolumeLabelLength = (ULONG)(wcslen(vi->VolumeLabel)*sizeof(wchar_t));
  211.          args->len = sizeof(args->info.volume_info) +
  212.              vi->VolumeLabelLength - 1*sizeof(wchar_t);
  213. --
  214. 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