pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for NFSv4.2 attribute handling+misc, 2025-11-05
Posted by Anonymous on Wed 5th Nov 2025 12:54
raw | new post

  1. From 7cb8cbf08bb255f64b9e0435c71bb27464c149c4 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 5 Nov 2025 12:45:53 +0100
  4. Subject: [PATCH 1/5] daemon: Only use NFSv4.2 attributes if we use NFS >= v4.2
  5.  
  6. Only use NFSv4.2 attributes (e.g. |FATTR4_WORD2_OFFLINE|) if we use
  7. NFS >= v4.2.
  8.  
  9. Reported-by: Lionel Cons <lionelcons1972@gmail.com>
  10. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  11. ---
  12. daemon/lookup.c           | 8 ++++++--
  13.  daemon/nfs41_superblock.c | 7 +++++--
  14.  2 files changed, 11 insertions(+), 4 deletions(-)
  15.  
  16. diff --git a/daemon/lookup.c b/daemon/lookup.c
  17. index 3257eee..40ea2dd 100644
  18. --- a/daemon/lookup.c
  19. +++ b/daemon/lookup.c
  20. @@ -89,6 +89,7 @@ typedef struct __nfs41_lookup_component_res {
  21.  
  22.  
  23.  static void init_component_args(
  24. +    IN nfs41_session *session,
  25.      IN nfs41_lookup_component_args *args,
  26.      IN nfs41_lookup_component_res *res,
  27.      IN nfs41_abs_path *path,
  28. @@ -107,7 +108,10 @@ static void init_component_args(
  29.          | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_CREATE
  30.          | FATTR4_WORD1_TIME_MODIFY
  31.          | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP;
  32. -    args->attr_request.arr[2] = FATTR4_WORD2_OFFLINE;
  33. +    args->attr_request.arr[2] = 0;
  34. +    if (session->client->root->nfsminorvers >= 2) {
  35. +        args->attr_request.arr[2] |= FATTR4_WORD2_OFFLINE;
  36. +    }
  37.  
  38.      args->getrootattr.attr_request = &args->attr_request;
  39.      res->root.path = path;
  40. @@ -357,7 +361,7 @@ static int server_lookup_loop(
  41.      uint32_t count;
  42.      int status = NO_ERROR;
  43.  
  44. -    init_component_args(&args, &res, path, referral);
  45. +    init_component_args(session, &args, &res, path, referral);
  46.      parent = NULL;
  47.      target = NULL;
  48.  
  49. diff --git a/daemon/nfs41_superblock.c b/daemon/nfs41_superblock.c
  50. index 8777feb..7722048 100644
  51. --- a/daemon/nfs41_superblock.c
  52. +++ b/daemon/nfs41_superblock.c
  53. @@ -169,7 +169,7 @@ static int get_superblock_attrs(
  54.          superblock->time_delta.seconds = 1;
  55.  
  56.      /* initialize the default getattr mask */
  57. -    superblock->default_getattr.count = 2;
  58. +    superblock->default_getattr.count = 3;
  59.      superblock->default_getattr.arr[0] = FATTR4_WORD0_TYPE
  60.          | FATTR4_WORD0_CHANGE | FATTR4_WORD0_SIZE
  61.          | FATTR4_WORD0_FSID | FATTR4_WORD0_FILEID
  62. @@ -179,7 +179,10 @@ static int get_superblock_attrs(
  63.          | FATTR4_WORD1_SYSTEM
  64.          | FATTR4_WORD1_TIME_ACCESS | FATTR4_WORD1_TIME_CREATE
  65.          | FATTR4_WORD1_TIME_MODIFY;
  66. -    superblock->default_getattr.arr[2] = FATTR4_WORD2_OFFLINE;
  67. +    superblock->default_getattr.arr[2] = 0;
  68. +    if (root->nfsminorvers >= 2) {
  69. +        superblock->default_getattr.arr[2] |= FATTR4_WORD2_OFFLINE;
  70. +    }
  71.  
  72.      nfs41_superblock_supported_attrs(superblock, &superblock->default_getattr);
  73.  
  74. --
  75. 2.51.0
  76.  
  77. From 057d57883c3bcdfcb9b59b3f5281f053804e61cd Mon Sep 17 00:00:00 2001
  78. From: Roland Mainz <roland.mainz@nrubsig.org>
  79. Date: Wed, 5 Nov 2025 12:58:10 +0100
  80. Subject: [PATCH 2/5] tests: winoffloadcopyfile should delete destination file
  81.  on failure
  82.  
  83. winoffloadcopyfile should delete destination file on failure.
  84.  
  85. Reported-by: Lionel Cons <lionelcons1972@gmail.com>
  86. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  87. ---
  88. tests/winoffloadcopyfile/winoffloadcopyfile.c | 13 +++++++++++++
  89.  1 file changed, 13 insertions(+)
  90.  
  91. diff --git a/tests/winoffloadcopyfile/winoffloadcopyfile.c b/tests/winoffloadcopyfile/winoffloadcopyfile.c
  92. index 5669140..05ccf6a 100644
  93. --- a/tests/winoffloadcopyfile/winoffloadcopyfile.c
  94. +++ b/tests/winoffloadcopyfile/winoffloadcopyfile.c
  95. @@ -307,6 +307,19 @@ int main(int ac, char *av[])
  96.      retval = EXIT_SUCCESS;
  97.  
  98.  cleanup:
  99. +    if ((retval != EXIT_SUCCESS) && (hDest != INVALID_HANDLE_VALUE)) {
  100. +        (void)printf("# Failure, deleting destination file...\n");
  101. +
  102. +        FILE_DISPOSITION_INFO di = { .DeleteFile = TRUE };
  103. +        bResult = SetFileInformationByHandle(hDest,
  104. +            FileDispositionInfo, &di, sizeof(di));
  105. +        if (!bResult) {
  106. +            (void)fprintf(stderr,
  107. +                "Cannot mark destination file for deletion, lasterr=%d\n",
  108. +                (int)GetLastError());
  109. +        }
  110. +    }
  111. +
  112.      if (hSrc != INVALID_HANDLE_VALUE) {
  113.          (void)CloseHandle(hSrc);
  114.      }
  115. --
  116. 2.51.0
  117.  
  118. From 3ab905ee89516ed05c3a21c4c4f2946984917eb0 Mon Sep 17 00:00:00 2001
  119. From: Roland Mainz <roland.mainz@nrubsig.org>
  120. Date: Wed, 5 Nov 2025 13:10:28 +0100
  121. Subject: [PATCH 3/5] daemon: Only query |FATTR4_WORD2_CLONE_BLKSIZE| if we
  122.  want to do a NFSv4.2 CLONE
  123.  
  124. Only query |FATTR4_WORD2_CLONE_BLKSIZE| if we want to do a NFSv4.2 CLONE.
  125.  
  126. Reported-by: Lionel Cons <lionelcons1972@gmail.com>
  127. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  128. ---
  129. daemon/fsctl.c | 7 ++++++-
  130.  1 file changed, 6 insertions(+), 1 deletion(-)
  131.  
  132. diff --git a/daemon/fsctl.c b/daemon/fsctl.c
  133. index 44f2f57..a8353c1 100644
  134. --- a/daemon/fsctl.c
  135. +++ b/daemon/fsctl.c
  136. @@ -796,8 +796,13 @@ int handle_duplicatedata(void *daemon_context,
  137.          .count = 3,
  138.          .arr[0] = FATTR4_WORD0_SIZE|FATTR4_WORD0_FSID,
  139.          .arr[1] = 0UL,
  140. -        .arr[2] = FATTR4_WORD2_CLONE_BLKSIZE
  141. +        .arr[2] = 0UL
  142.      };
  143. +
  144. +    if (upcall->opcode == NFS41_SYSOP_FSCTL_DUPLICATE_DATA) {
  145. +        dst_attr_request.arr[2] |= FATTR4_WORD2_CLONE_BLKSIZE;
  146. +    }
  147. +
  148.      (void)memset(&info, 0, sizeof(info));
  149.      status = nfs41_getattr(dst_session, dst_file, &dst_attr_request,
  150.          &info);
  151. --
  152. 2.51.0
  153.  
  154. From 2343f98303012e2b661623e6f5fc88ee3b8a738f Mon Sep 17 00:00:00 2001
  155. From: Roland Mainz <roland.mainz@nrubsig.org>
  156. Date: Wed, 5 Nov 2025 13:20:46 +0100
  157. Subject: [PATCH 4/5] daemon: |get_superblock_attrs()| should report
  158.  |FATTR4_WORD2_OFFLINE| support
  159.  
  160. |get_superblock_attrs()| should report |FATTR4_WORD2_OFFLINE| support.
  161.  
  162. Reported-by: Lionel Cons <lionelcons1972@gmail.com>
  163. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  164. ---
  165. daemon/nfs41_superblock.c | 5 +++++
  166.  1 file changed, 5 insertions(+)
  167.  
  168. diff --git a/daemon/nfs41_superblock.c b/daemon/nfs41_superblock.c
  169. index 7722048..3e64444 100644
  170. --- a/daemon/nfs41_superblock.c
  171. +++ b/daemon/nfs41_superblock.c
  172. @@ -237,6 +237,11 @@ static int get_superblock_attrs(
  173.              *is++ = ',';
  174.          is = stpcpy(is, "SYSTEM");
  175.      }
  176. +    if (bitmap_isset(&superblock->supported_attrs, 2, FATTR4_WORD2_OFFLINE)) {
  177. +        if (is != infobuff)
  178. +            *is++ = ',';
  179. +        is = stpcpy(is, "OFFLINE");
  180. +    }
  181.      logprintf("get_superblock_attrs(fsid=(%llu,%llu)): "
  182.          "Supported Windows/DOS attributes: { %s }\n",
  183.          superblock->fsid.major, superblock->fsid.minor,
  184. --
  185. 2.51.0
  186.  
  187. From a4f6da897b0dcdd98d98b3b5fc7cfd374edf90a4 Mon Sep 17 00:00:00 2001
  188. From: Roland Mainz <roland.mainz@nrubsig.org>
  189. Date: Wed, 5 Nov 2025 13:41:37 +0100
  190. Subject: [PATCH 5/5] daemon: Cygwin idmapper should catch empty/invalid
  191.  passwd+group names early
  192.  
  193. Cygwin idmapper should catch empty/invalid passwd+group names early.
  194.  
  195. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  196. ---
  197. daemon/idmap_cygwin.c | 16 ++++++++++++++++
  198.  1 file changed, 16 insertions(+)
  199.  
  200. diff --git a/daemon/idmap_cygwin.c b/daemon/idmap_cygwin.c
  201. index d7b4fd4..64ede3a 100644
  202. --- a/daemon/idmap_cygwin.c
  203. +++ b/daemon/idmap_cygwin.c
  204. @@ -69,6 +69,14 @@ int cygwin_getent_passwd(const char *name, char *res_loginname, uid_t *res_uid,
  205.          ("--> cygwin_getent_passwd(name='%s')\n",
  206.          name));
  207.  
  208. +    if (name[0] == '\0') {
  209. +        DPRINTF(0,
  210. +            ("cygwin_getent_passwd(name='%s'): "
  211. +            "ERROR: Empty user name.\n",
  212. +            name));
  213. +        goto fail;
  214. +    }
  215. +
  216.      /* fixme: better quoting for |name| needed */
  217.      (void)snprintf(cmdbuff, sizeof(cmdbuff),
  218.          "%s nfsserver_owner2localaccount \"%s\"",
  219. @@ -215,6 +223,14 @@ int cygwin_getent_group(const char* name, char* res_group_name, gid_t* res_gid)
  220.          ("--> cygwin_getent_group(name='%s')\n",
  221.          name));
  222.  
  223. +    if (name[0] == '\0') {
  224. +        DPRINTF(0,
  225. +            ("cygwin_getent_group(name='%s'): "
  226. +            "ERROR: Empty group name.\n",
  227. +            name));
  228. +        goto fail;
  229. +    }
  230. +
  231.      /* fixme: better quoting for |name| needed */
  232.      (void)snprintf(cmdbuff, sizeof(cmdbuff),
  233.          "%s nfsserver_owner_group2localgroup \"%s\"",
  234. --
  235. 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