pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patch for sec=none support, better debug/error messages, docs+misc, 2025-05-05
Posted by Anonymous on Mon 5th May 2025 18:31
raw | new post

  1. From 0673e13270dd980faf8983cc798c14802404c78f Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Mon, 5 May 2025 12:51:17 +0200
  4. Subject: [PATCH 1/6] daemon: Make sure |FSCTL_DUPLICATE_EXTENTS_TO_FILE| src
  5.  and dst are on the same filesystem
  6.  
  7. Make sure that |FSCTL_DUPLICATE_EXTENTS_TO_FILE| source and dest are
  8. on the same filesystem (by comparing the values of
  9. |FATTR4_WORD0_FSID|).
  10.  
  11. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  12. ---
  13. daemon/fsctl.c | 69 ++++++++++++++++++++++++++++++++++++++++++--------
  14.  1 file changed, 59 insertions(+), 10 deletions(-)
  15.  
  16. diff --git a/daemon/fsctl.c b/daemon/fsctl.c
  17. index 80a4e02..200ae9d 100644
  18. --- a/daemon/fsctl.c
  19. +++ b/daemon/fsctl.c
  20. @@ -646,15 +646,15 @@ int handle_duplicatedata(void *daemon_context,
  21.      duplicatedata_upcall_args *args = &upcall->args.duplicatedata;
  22.      nfs41_open_state *src_state = args->src_state;
  23.      nfs41_open_state *dst_state = upcall->state_ref;
  24. -    nfs41_session *session = dst_state->session;
  25. +    nfs41_session *src_session = src_state->session;
  26. +    nfs41_session *dst_session = dst_state->session;
  27. +    nfs41_path_fh *src_file = &src_state->file;
  28.      nfs41_path_fh *dst_file = &dst_state->file;
  29.      nfs41_file_info info;
  30.      stateid_arg src_stateid;
  31.      stateid_arg dst_stateid;
  32.      int64_t bytecount;
  33.  
  34. -    (void)memset(&info, 0, sizeof(info));
  35. -
  36.      DPRINTF(DDLVL,
  37.          ("--> handle_duplicatedata("
  38.              "dst_state->path.path='%s', "
  39. @@ -663,17 +663,17 @@ int handle_duplicatedata(void *daemon_context,
  40.              src_state->path.path));
  41.  
  42.      /* NFS SEEK supported ? */
  43. -    if (session->client->root->supports_nfs42_seek == false) {
  44. +    if (src_session->client->root->supports_nfs42_seek == false) {
  45.          status = ERROR_NOT_SUPPORTED;
  46.          goto out;
  47.      }
  48.      /* NFS CLONE supported ? */
  49. -    if (session->client->root->supports_nfs42_clone == false) {
  50. +    if (src_session->client->root->supports_nfs42_clone == false) {
  51.          status = ERROR_NOT_SUPPORTED;
  52.          goto out;
  53.      }
  54.      /* NFS DEALLOCATE supported ? */
  55. -    if (session->client->root->supports_nfs42_deallocate == false) {
  56. +    if (src_session->client->root->supports_nfs42_deallocate == false) {
  57.          status = ERROR_NOT_SUPPORTED;
  58.          goto out;
  59.      }
  60. @@ -681,6 +681,31 @@ int handle_duplicatedata(void *daemon_context,
  61.      nfs41_open_stateid_arg(src_state, &src_stateid);
  62.      nfs41_open_stateid_arg(dst_state, &dst_stateid);
  63.  
  64. +    /*
  65. +     * Get src file fsid
  66. +     */
  67. +    bitmap4 src_attr_request = {
  68. +        .count = 1,
  69. +        .arr[0] = FATTR4_WORD0_FSID,
  70. +    };
  71. +    (void)memset(&info, 0, sizeof(info));
  72. +    status = nfs41_getattr(src_session, src_file, &src_attr_request,
  73. +        &info);
  74. +    if (status) {
  75. +        eprintf("handle_duplicatedata: "
  76. +            "nfs41_getattr(src_state->path.path='%s') "
  77. +            "failed with '%s'\n",
  78. +            src_state->path.path,
  79. +            nfs_error_string(status));
  80. +        status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
  81. +        goto out;
  82. +    }
  83. +
  84. +    EASSERT(bitmap_isset(&info.attrmask, 0, FATTR4_WORD0_FSID));
  85. +
  86. +    nfs41_fsid src_file_fsid;
  87. +    (void)memcpy(&src_file_fsid, &info.fsid, sizeof(src_file_fsid));
  88. +
  89.      /*
  90.       * Get destination file size
  91.       * Callers will set the file size before calling
  92. @@ -693,21 +718,45 @@ int handle_duplicatedata(void *daemon_context,
  93.       * size to clamp |args->bytecount|.
  94.       */
  95.      int64_t dst_file_size;
  96. -    bitmap4 attr_request = {
  97. +    bitmap4 dst_attr_request = {
  98.          .count = 3,
  99. -        .arr[0] = FATTR4_WORD0_SIZE,
  100. +        .arr[0] = FATTR4_WORD0_SIZE|FATTR4_WORD0_FSID,
  101.          .arr[1] = 0UL,
  102.          .arr[2] = FATTR4_WORD2_CLONE_BLKSIZE
  103.      };
  104. -    status = nfs41_getattr(session, dst_file, &attr_request, &info);
  105. +    (void)memset(&info, 0, sizeof(info));
  106. +    status = nfs41_getattr(dst_session, dst_file, &dst_attr_request,
  107. +        &info);
  108.      if (status) {
  109.          eprintf("handle_duplicatedata: "
  110. -            "nfs41_getattr() failed with '%s'\n",
  111. +            "nfs41_getattr(dst_state->path.path='%s') "
  112. +            "failed with '%s'\n",
  113. +            dst_state->path.path,
  114.              nfs_error_string(status));
  115.          status = nfs_to_windows_error(status, ERROR_BAD_NET_RESP);
  116.          goto out;
  117.      }
  118.  
  119. +    EASSERT(bitmap_isset(&info.attrmask, 0, FATTR4_WORD0_FSID));
  120. +
  121. +    /*
  122. +     * Check whether source and destination files are on the same
  123. +     * filesystem
  124. +     */
  125. +    if (memcmp(&src_file_fsid, &info.fsid,
  126. +        sizeof(src_file_fsid)) != 0) {
  127. +        DPRINTF(DDLVL,
  128. +            ("handle_duplicatedata: "
  129. +            "src_file_fsid(major=%llu,minor=%llu) != "
  130. +            "dst_file_fsid(major=%llu,minor=%llu)\n",
  131. +            (unsigned long long)src_file_fsid.major,
  132. +            (unsigned long long)src_file_fsid.minor,
  133. +            (unsigned long long)info.fsid.major,
  134. +            (unsigned long long)info.fsid.minor));
  135. +        status = ERROR_NOT_SAME_DEVICE;
  136. +        goto out;
  137. +    }
  138. +
  139.      EASSERT(bitmap_isset(&info.attrmask, 0, FATTR4_WORD0_SIZE));
  140.  
  141.      if (bitmap_isset(&info.attrmask, 2, FATTR4_WORD2_CLONE_BLKSIZE)) {
  142. --
  143. 2.45.1
  144.  
  145. From 8966bc708f28074856107d0e92cba65a3f374ef5 Mon Sep 17 00:00:00 2001
  146. From: Roland Mainz <roland.mainz@nrubsig.org>
  147. Date: Mon, 5 May 2025 12:56:07 +0200
  148. Subject: [PATCH 2/6] cygwin: Document block cloning support in
  149.  README.bintarball.txt
  150.  
  151. Document block cloning support (via |FSCTL_DUPLICATE_EXTENTS_TO_FILE|)
  152. in README.bintarball.txt.
  153.  
  154. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  155. ---
  156. cygwin/README.bintarball.txt | 16 ++++++++++++++++
  157.  1 file changed, 16 insertions(+)
  158.  
  159. diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
  160. index 21b6e38..e7b9d79 100644
  161. --- a/cygwin/README.bintarball.txt
  162. +++ b/cygwin/README.bintarball.txt
  163. @@ -90,6 +90,22 @@ NFSv4.2/NFSv4.1 filesystem driver for Windows 10/11&Windows Server 2019+2022
  164.        Requires on Win11 >= 22H2 because it relies on |CopyFile2()|
  165.        flag |COPY_FILE_ENABLE_SPARSE_COPY|.
  166.  
  167. +- Block cloning support
  168. +    - Implmenented via Win32 |FSCTL_DUPLICATE_EXTENTS_TO_FILE| to
  169. +      clone file blocks from src to dst within the same
  170. +      filesystem.
  171. +    - Requires NFSv4.2 server which supports the NFSv4.2
  172. +      operations "CLONE", "DEALLOCATE", "SEEK", and exports
  173. +      a filesystem which supports block cloning (e.g. Linux BTRFS+XFS,
  174. +      but NOT Linux tmpfs)
  175. +    - Sparse files are correctly cloned, including all hole and data
  176. +      ranges
  177. +    - /usr/bin/winclonefile.exe can be used to clone a file
  178. +    - Windows 11 |CopyFile2()| API uses
  179. +      |FSCTL_DUPLICATE_EXTENTS_TO_FILE| by default
  180. +    - Windows 11 tools like xcopy.exe, robocopy etc. all use
  181. +      |CopyFile2()|, and therefore file cloning by default
  182. +
  183.  - Symlink reparse and translation support
  184.      - Translates Win32/NT symlink syntax (e.g.
  185.        $ mklink /D ... Y:\tmp\ #) to NFS/POSIX syntax (e.g.
  186. --
  187. 2.45.1
  188.  
  189. From aad8ce4814e469694c38796e721e7df811fedcc9 Mon Sep 17 00:00:00 2001
  190. From: Roland Mainz <roland.mainz@nrubsig.org>
  191. Date: Mon, 5 May 2025 18:08:46 +0200
  192. Subject: [PATCH 3/6] cygwin,daemon,include,mount,sys: Implement nfs_mount -o
  193.  sec=none (AUTH_NONE)
  194.  
  195. Implement nfs_mount -o sec=none (AUTH_NONE).
  196.  
  197. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  198. ---
  199. cygwin/README.bintarball.txt |  6 ++++++
  200.  daemon/daemon_debug.c        |  2 ++
  201.  daemon/nfs41_compound.c      | 19 ++++++++++++++++++-
  202.  daemon/nfs41_ops.h           |  2 +-
  203.  daemon/nfs41_rpc.c           | 28 +++++++++++++++++++++++-----
  204.  include/nfs41_driver.h       |  2 ++
  205.  mount/mount.c                |  6 ++++--
  206.  sys/nfs41sys_driver.c        |  3 ++-
  207.  sys/nfs41sys_driver.h        |  2 ++
  208.  sys/nfs41sys_mount.c         | 34 +++++++++++++++++++++++++++-------
  209.  10 files changed, 87 insertions(+), 17 deletions(-)
  210.  
  211. diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
  212. index e7b9d79..7b5fb9b 100644
  213. --- a/cygwin/README.bintarball.txt
  214. +++ b/cygwin/README.bintarball.txt
  215. @@ -563,6 +563,12 @@ $ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
  216.    user+groups to a small script for the NFSv4 server to set-up
  217.    these accounts on the server side.
  218.  
  219. +- nfs_mount -o sec=none ... # works with Solaris 11.4 nfsd, but
  220. +  might require Linux kernel commit
  221. +  https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git/patch/?id=bb4f07f2409c26c01e97e6f9b432545f353e3b66
  222. +  ("nfsd: Fix NFSD_MAY_BYPASS_GSS and NFSD_MAY_BYPASS_GSS_ON_ROOT") to
  223. +  work.
  224. +
  225.  
  226.  #
  227.  # 11. Known issues:
  228. diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
  229. index 7d81b9c..674bec5 100644
  230. --- a/daemon/daemon_debug.c
  231. +++ b/daemon/daemon_debug.c
  232. @@ -867,6 +867,8 @@ const char* secflavorop2name(DWORD sec_flavor)
  233.  {
  234.      switch(sec_flavor) {
  235.  #define RPCSEC_AUTH_TO_STRLITERAL(e) case e: return #e;
  236. +        RPCSEC_AUTH_TO_STRLITERAL(RPCSEC_AUTH_UNDEFINED)
  237. +        RPCSEC_AUTH_TO_STRLITERAL(RPCSEC_AUTH_NONE)
  238.          RPCSEC_AUTH_TO_STRLITERAL(RPCSEC_AUTH_SYS)
  239.          RPCSEC_AUTH_TO_STRLITERAL(RPCSEC_AUTHGSS_KRB5)
  240.          RPCSEC_AUTH_TO_STRLITERAL(RPCSEC_AUTHGSS_KRB5I)
  241. diff --git a/daemon/nfs41_compound.c b/daemon/nfs41_compound.c
  242. index 908f170..497dd87 100644
  243. --- a/daemon/nfs41_compound.c
  244. +++ b/daemon/nfs41_compound.c
  245. @@ -111,7 +111,16 @@ static int create_new_rpc_auth(nfs41_session *session, uint32_t op,
  246.                  continue;
  247.              }
  248.              sec_flavor = secinfo[i].type;
  249. -        } else {
  250. +        }
  251. +        else if (secinfo[i].sec_flavor == AUTH_NONE) {
  252. +            auth = authnone_create();
  253. +            if (auth == NULL) {
  254. +                eprintf("create_new_rpc_auth: authnone_create failed\n");
  255. +                continue;
  256. +            }
  257. +            sec_flavor = AUTH_NONE;
  258. +        }
  259. +        else if (secinfo[i].sec_flavor == AUTH_SYS) {
  260.              char machname[MAXHOSTNAMELEN + 1];
  261.              gid_t aup_gids[RPC_AUTHUNIX_AUP_MAX_NUM_GIDS];
  262.              int num_aup_gids = 0;
  263. @@ -138,6 +147,14 @@ static int create_new_rpc_auth(nfs41_session *session, uint32_t op,
  264.              }
  265.              sec_flavor = AUTH_SYS;
  266.          }
  267. +        else {
  268. +            eprintf("create_new_rpc_auth: "
  269. +                "Unknown secinfo[i(=%d)].sec_flavor=%ld",
  270. +                i,
  271. +                (long)secinfo[i].sec_flavor);
  272. +            continue;
  273. +        }
  274. +
  275.          AcquireSRWLockExclusive(&session->client->rpc->lock);
  276.          session->client->rpc->sec_flavor = sec_flavor;
  277.          session->client->rpc->rpc->cl_auth = auth;
  278. diff --git a/daemon/nfs41_ops.h b/daemon/nfs41_ops.h
  279. index d49346b..26b3afe 100644
  280. --- a/daemon/nfs41_ops.h
  281. +++ b/daemon/nfs41_ops.h
  282. @@ -1022,7 +1022,7 @@ typedef struct __nfs41_secinfo_args {
  283.      const nfs41_component   *name;
  284.  } nfs41_secinfo_args;
  285.  
  286. -#define MAX_SECINFOS 6
  287. +#define MAX_SECINFOS 7
  288.  
  289.  /* OP_SECINFO_NO_NAME */
  290.  enum secinfo_no_name_type {
  291. diff --git a/daemon/nfs41_rpc.c b/daemon/nfs41_rpc.c
  292. index 6bf9d3a..17e37de 100644
  293. --- a/daemon/nfs41_rpc.c
  294. +++ b/daemon/nfs41_rpc.c
  295. @@ -1,5 +1,6 @@
  296.  /* NFSv4.1 client for Windows
  297. - * Copyright (C) 2012 The Regents of the University of Michigan
  298. + * Copyright (C) 2012 The Regents of the University of Michigan
  299. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  300.   *
  301.   * Olga Kornievskaia <aglo@umich.edu>
  302.   * Casey Bodley <cbodley@umich.edu>
  303. @@ -25,7 +26,8 @@
  304.  #include "daemon_debug.h"
  305.  #include "nfs41_xdr.h"
  306.  #include "nfs41_callback.h"
  307. -#include "nfs41_driver.h" /* for AUTH_SYS, AUTHGSS_KRB5s defines */
  308. +/* for AUTH_NONE, AUTH_SYS, AUTHGSS_KRB5s defines */
  309. +#include "nfs41_driver.h"
  310.  
  311.  #include "rpc/rpc.h"
  312.  #define SECURITY_WIN32
  313. @@ -191,7 +193,15 @@ int nfs41_rpc_clnt_create(
  314.      }
  315.  
  316.      rpc->sec_flavor = sec_flavor;
  317. -    if (sec_flavor == RPCSEC_AUTH_SYS) {
  318. +    if (sec_flavor == RPCSEC_AUTH_NONE) {
  319. +        client->cl_auth = authnone_create();
  320. +        if (client->cl_auth == NULL) {
  321. +            eprintf("nfs41_rpc_clnt_create: failed to create rpc authnone\n");
  322. +            status = ERROR_NETWORK_UNREACHABLE;
  323. +            goto out_err_client;
  324. +        }
  325. +    }
  326. +    else if (sec_flavor == RPCSEC_AUTH_SYS) {
  327.          gid_t aup_gids[RPC_AUTHUNIX_AUP_MAX_NUM_GIDS];
  328.          int num_aup_gids = 0;
  329.  
  330. @@ -218,6 +228,10 @@ int nfs41_rpc_clnt_create(
  331.              goto out_err_client;
  332.          }
  333.      } else {
  334. +        /*
  335. +         * FIXME: We should test for |RPCSEC_GSS|, and the |else|
  336. +         * branch should return an error
  337. +         */
  338.          status = create_rpcsec_auth_client(sec_flavor, rpc->server_name, client);
  339.          if (status) {
  340.              eprintf("nfs41_rpc_clnt_create: failed to establish security "
  341. @@ -306,8 +320,10 @@ static int rpc_reconnect(
  342.      if (status)
  343.          goto out_unlock;
  344.  
  345. -    if(rpc->sec_flavor == RPCSEC_AUTH_SYS)
  346. +    if((rpc->sec_flavor == RPCSEC_AUTH_NONE) ||
  347. +        (rpc->sec_flavor == RPCSEC_AUTH_SYS)) {
  348.          client->cl_auth = rpc->rpc->cl_auth;
  349. +    }
  350.      else {
  351.          auth_destroy(rpc->rpc->cl_auth);
  352.          status = create_rpcsec_auth_client(rpc->sec_flavor, rpc->server_name, client);
  353. @@ -395,7 +411,9 @@ int nfs41_send_compound(
  354.                  goto try_again;
  355.              }
  356.              rpc_renew_in_progress(rpc, &one);
  357. -            if (rpc_status == RPC_AUTHERROR && rpc->sec_flavor != RPCSEC_AUTH_SYS) {
  358. +            if ((rpc_status == RPC_AUTHERROR) &&
  359. +                (rpc->sec_flavor != RPCSEC_AUTH_NONE) &&
  360. +                (rpc->sec_flavor != RPCSEC_AUTH_SYS)) {
  361.                  AcquireSRWLockExclusive(&rpc->lock);
  362.                  auth_destroy(rpc->rpc->cl_auth);
  363.                  status = create_rpcsec_auth_client(rpc->sec_flavor,
  364. diff --git a/include/nfs41_driver.h b/include/nfs41_driver.h
  365. index 3837793..3257937 100644
  366. --- a/include/nfs41_driver.h
  367. +++ b/include/nfs41_driver.h
  368. @@ -104,6 +104,8 @@ typedef enum _nfs41_sysop_open_symlinktarget_type {
  369.  } nfs41_sysop_open_symlinktarget_type;
  370.  
  371.  enum rpcsec_flavors {
  372. +    RPCSEC_AUTH_UNDEFINED = 0,
  373. +    RPCSEC_AUTH_NONE,
  374.      RPCSEC_AUTH_SYS,
  375.      RPCSEC_AUTHGSS_KRB5,
  376.      RPCSEC_AUTHGSS_KRB5I,
  377. diff --git a/mount/mount.c b/mount/mount.c
  378. index c3d0487..99a43ff 100644
  379. --- a/mount/mount.c
  380. +++ b/mount/mount.c
  381. @@ -1,5 +1,6 @@
  382.  /* NFSv4.1 client for Windows
  383. - * Copyright (C) 2012 The Regents of the University of Michigan
  384. + * Copyright (C) 2012 The Regents of the University of Michigan
  385. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  386.   *
  387.   * Olga Kornievskaia <aglo@umich.edu>
  388.   * Casey Bodley <cbodley@umich.edu>
  389. @@ -134,7 +135,8 @@ void PrintMountUsage(LPWSTR pProcess)
  390.              "\t\tsuitable version with the server, trying version 4.2 and then 4.1\n"
  391.          "\trsize=#\tread buffer size in bytes\n"
  392.          "\twsize=#\twrite buffer size in bytes\n"
  393. -        "\tsec=sys:krb5:krb5i:krb5p\tspecify (gss) security flavor\n"
  394. +        "\tsec=none:sys:krb5:krb5i:krb5p\tspecify (gss) security flavor "
  395. +            "(defaults to 'sys')\n"
  396.          "\twritethru\tturns off rdbss caching for writes\n"
  397.          "\tnowritethru\tturns on rdbss caching for writes (default)\n"
  398.          "\tcache\tturns on rdbss caching (default)\n"
  399. diff --git a/sys/nfs41sys_driver.c b/sys/nfs41sys_driver.c
  400. index 687ca93..43f0706 100644
  401. --- a/sys/nfs41sys_driver.c
  402. +++ b/sys/nfs41sys_driver.c
  403. @@ -1,6 +1,6 @@
  404.  /* NFSv4.1 client for Windows
  405.   * Copyright (C) 2012 The Regents of the University of Michigan
  406. - * Copyright (C) 2023-2024 Roland Mainz <roland.mainz@nrubsig.org>
  407. + * Copyright (C) 2023-2025 Roland Mainz <roland.mainz@nrubsig.org>
  408.   *
  409.   * Olga Kornievskaia <aglo@umich.edu>
  410.   * Casey Bodley <cbodley@umich.edu>
  411. @@ -77,6 +77,7 @@
  412.   */
  413.  DECLARE_CONST_UNICODE_STRING(NfsPrefix, L"\\nfs4");
  414.  DECLARE_CONST_UNICODE_STRING(PubNfsPrefix, L"\\pubnfs4");
  415. +DECLARE_CONST_UNICODE_STRING(AUTH_NONE_NAME, L"none");
  416.  DECLARE_CONST_UNICODE_STRING(AUTH_SYS_NAME, L"sys");
  417.  DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5_NAME, L"krb5");
  418.  DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5I_NAME, L"krb5i");
  419. diff --git a/sys/nfs41sys_driver.h b/sys/nfs41sys_driver.h
  420. index a237071..d6aef7c 100644
  421. --- a/sys/nfs41sys_driver.h
  422. +++ b/sys/nfs41sys_driver.h
  423. @@ -107,6 +107,7 @@ typedef struct __nfs41_timings {
  424.  
  425.  DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(NfsPrefix);
  426.  DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(PubNfsPrefix);
  427. +DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(AUTH_NONE_NAME);
  428.  DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(AUTH_SYS_NAME);
  429.  DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5_NAME);
  430.  DECLARE_EXTERN_DECLARE_CONST_UNICODE_STRING(AUTHGSS_KRB5I_NAME);
  431. @@ -334,6 +335,7 @@ typedef struct _NFS41_MOUNT_CONFIG {
  432.  typedef struct _nfs41_mount_entry {
  433.      LIST_ENTRY next;
  434.      LUID login_id;
  435. +    HANDLE authnone_session;
  436.      HANDLE authsys_session;
  437.      HANDLE gss_session;
  438.      HANDLE gssi_session;
  439. diff --git a/sys/nfs41sys_mount.c b/sys/nfs41sys_mount.c
  440. index e672c0a..5a78eb8 100644
  441. --- a/sys/nfs41sys_mount.c
  442. +++ b/sys/nfs41sys_mount.c
  443. @@ -82,10 +82,12 @@ static const char *secflavorop2name(
  444.      DWORD sec_flavor)
  445.  {
  446.      switch(sec_flavor) {
  447. -    case RPCSEC_AUTH_SYS:      return "AUTH_SYS";
  448. -    case RPCSEC_AUTHGSS_KRB5:  return "AUTHGSS_KRB5";
  449. -    case RPCSEC_AUTHGSS_KRB5I: return "AUTHGSS_KRB5I";
  450. -    case RPCSEC_AUTHGSS_KRB5P: return "AUTHGSS_KRB5P";
  451. +    case RPCSEC_AUTH_UNDEFINED: return "Undefined AUTH_*";
  452. +    case RPCSEC_AUTH_NONE:      return "AUTH_NONE";
  453. +    case RPCSEC_AUTH_SYS:       return "AUTH_SYS";
  454. +    case RPCSEC_AUTHGSS_KRB5:   return "AUTHGSS_KRB5";
  455. +    case RPCSEC_AUTHGSS_KRB5I:  return "AUTHGSS_KRB5I";
  456. +    case RPCSEC_AUTHGSS_KRB5P:  return "AUTHGSS_KRB5P";
  457.      }
  458.  
  459.      return "UNKNOWN FLAVOR";
  460. @@ -673,7 +675,9 @@ NTSTATUS map_sec_flavor(
  461.      IN PUNICODE_STRING sec_flavor_name,
  462.      OUT PDWORD sec_flavor)
  463.  {
  464. -    if (RtlCompareUnicodeString(sec_flavor_name, &AUTH_SYS_NAME, FALSE) == 0)
  465. +    if (RtlCompareUnicodeString(sec_flavor_name, &AUTH_NONE_NAME, FALSE) == 0)
  466. +        *sec_flavor = RPCSEC_AUTH_NONE;
  467. +    else if (RtlCompareUnicodeString(sec_flavor_name, &AUTH_SYS_NAME, FALSE) == 0)
  468.          *sec_flavor = RPCSEC_AUTH_SYS;
  469.      else if (RtlCompareUnicodeString(sec_flavor_name, &AUTHGSS_KRB5_NAME, FALSE) == 0)
  470.          *sec_flavor = RPCSEC_AUTHGSS_KRB5;
  471. @@ -1100,6 +1104,11 @@ NTSTATUS nfs41_CreateVNetRoot(
  472.  #endif
  473.                  found_existing_mount = TRUE;
  474.                  switch(pVNetRootContext->sec_flavor) {
  475. +                case RPCSEC_AUTH_NONE:
  476. +                    if (existing_mount->authnone_session != INVALID_HANDLE_VALUE)
  477. +                        pVNetRootContext->session =
  478. +                            existing_mount->authnone_session;
  479. +                    break;
  480.                  case RPCSEC_AUTH_SYS:
  481.                      if (existing_mount->authsys_session != INVALID_HANDLE_VALUE)
  482.                          pVNetRootContext->session =
  483. @@ -1158,9 +1167,12 @@ NTSTATUS nfs41_CreateVNetRoot(
  484.              status = STATUS_INSUFFICIENT_RESOURCES;
  485.              goto out_free;
  486.          }
  487. -        entry->authsys_session = entry->gss_session =
  488. -            entry->gssi_session = entry->gssp_session = INVALID_HANDLE_VALUE;
  489. +        entry->authnone_session = entry->authsys_session =
  490. +            entry->gss_session = entry->gssi_session =
  491. +            entry->gssp_session = INVALID_HANDLE_VALUE;
  492.          switch (pVNetRootContext->sec_flavor) {
  493. +        case RPCSEC_AUTH_NONE:
  494. +            entry->authnone_session = pVNetRootContext->session; break;
  495.          case RPCSEC_AUTH_SYS:
  496.              entry->authsys_session = pVNetRootContext->session; break;
  497.          case RPCSEC_AUTHGSS_KRB5:
  498. @@ -1186,6 +1198,8 @@ NTSTATUS nfs41_CreateVNetRoot(
  499.              (int)pVNetRootContext->sec_flavor);
  500.  #endif
  501.          switch (pVNetRootContext->sec_flavor) {
  502. +        case RPCSEC_AUTH_NONE:
  503. +            existing_mount->authnone_session = pVNetRootContext->session; break;
  504.          case RPCSEC_AUTH_SYS:
  505.              existing_mount->authsys_session = pVNetRootContext->session; break;
  506.          case RPCSEC_AUTHGSS_KRB5:
  507. @@ -1348,6 +1362,12 @@ NTSTATUS nfs41_FinalizeNetRoot(
  508.              (long)mount_tmp->login_id.HighPart,
  509.              (long)mount_tmp->login_id.LowPart);
  510.  #endif
  511. +        if (mount_tmp->authnone_session != INVALID_HANDLE_VALUE) {
  512. +            status = nfs41_unmount(mount_tmp->authnone_session,
  513. +                pNetRootContext->nfs41d_version, UPCALL_TIMEOUT_DEFAULT);
  514. +            if (status)
  515. +                print_error("nfs41_unmount AUTH_NONE failed with %d\n", status);
  516. +        }
  517.          if (mount_tmp->authsys_session != INVALID_HANDLE_VALUE) {
  518.              status = nfs41_unmount(mount_tmp->authsys_session,
  519.                  pNetRootContext->nfs41d_version, UPCALL_TIMEOUT_DEFAULT);
  520. --
  521. 2.45.1
  522.  
  523. From 12505745a9a2cd20f839897cc787f6b22c566e1d Mon Sep 17 00:00:00 2001
  524. From: Roland Mainz <roland.mainz@nrubsig.org>
  525. Date: Mon, 5 May 2025 18:11:58 +0200
  526. Subject: [PATCH 4/6] daemon: |create_rpcsec_auth_client() should be |static|
  527.  
  528. |create_rpcsec_auth_client() should be |static|
  529.  
  530. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  531. ---
  532. daemon/nfs41_rpc.c | 1 +
  533.  1 file changed, 1 insertion(+)
  534.  
  535. diff --git a/daemon/nfs41_rpc.c b/daemon/nfs41_rpc.c
  536. index 17e37de..ce47125 100644
  537. --- a/daemon/nfs41_rpc.c
  538. +++ b/daemon/nfs41_rpc.c
  539. @@ -106,6 +106,7 @@ static int get_client_for_multi_addr(
  540.      return status;
  541.  }
  542.  
  543. +static
  544.  int create_rpcsec_auth_client(
  545.      IN uint32_t sec_flavor,
  546.      IN char *server_name,
  547. --
  548. 2.45.1
  549.  
  550. From bda556fba2f401ef986a251fdb0147b5542cff2b Mon Sep 17 00:00:00 2001
  551. From: Roland Mainz <roland.mainz@nrubsig.org>
  552. Date: Mon, 5 May 2025 18:25:20 +0200
  553. Subject: [PATCH 5/6] daemon: |eprintf()| in auth/rpc codepaths should always
  554.  use the function name as prefix
  555.  
  556. |eprintf()| in auth/rpc codepaths should always use the (correct)
  557. function name as prefix
  558.  
  559. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  560. ---
  561. daemon/nfs41_compound.c | 48 +++++++++++++++++++++++++------------
  562.  daemon/nfs41_rpc.c      | 53 ++++++++++++++++++++++++++---------------
  563.  2 files changed, 67 insertions(+), 34 deletions(-)
  564.  
  565. diff --git a/daemon/nfs41_compound.c b/daemon/nfs41_compound.c
  566. index 497dd87..b9ed5df 100644
  567. --- a/daemon/nfs41_compound.c
  568. +++ b/daemon/nfs41_compound.c
  569. @@ -106,8 +106,10 @@ static int create_new_rpc_auth(nfs41_session *session, uint32_t op,
  570.              auth = authsspi_create_default(session->client->rpc->rpc,
  571.                          session->client->rpc->server_name, secinfo[i].type);
  572.              if (auth == NULL) {
  573. -                eprintf("handle_wrongsecinfo_noname: authsspi_create_default for "
  574. -                        "gsstype %s failed\n", gssauth_string(secinfo[i].type));
  575. +                eprintf("create_new_rpc_auth: "
  576. +                    "authsspi_create_default for "
  577. +                    "gsstype %s failed\n",
  578. +                    gssauth_string(secinfo[i].type));
  579.                  continue;
  580.              }
  581.              sec_flavor = secinfo[i].type;
  582. @@ -115,7 +117,8 @@ static int create_new_rpc_auth(nfs41_session *session, uint32_t op,
  583.          else if (secinfo[i].sec_flavor == AUTH_NONE) {
  584.              auth = authnone_create();
  585.              if (auth == NULL) {
  586. -                eprintf("create_new_rpc_auth: authnone_create failed\n");
  587. +                eprintf("create_new_rpc_auth: "
  588. +                    "authnone_create failed\n");
  589.                  continue;
  590.              }
  591.              sec_flavor = AUTH_NONE;
  592. @@ -133,7 +136,7 @@ static int create_new_rpc_auth(nfs41_session *session, uint32_t op,
  593.              }
  594.  
  595.              if (gethostname(machname, sizeof(machname)) == -1) {
  596. -                eprintf("nfs41_rpc_clnt_create: gethostname failed\n");
  597. +                eprintf("create_new_rpc_auth: gethostname failed\n");
  598.                  continue;
  599.              }
  600.              machname[sizeof(machname) - 1] = '\0';
  601. @@ -142,7 +145,8 @@ static int create_new_rpc_auth(nfs41_session *session, uint32_t op,
  602.                  session->client->rpc->gid,
  603.                  num_aup_gids, aup_gids);
  604.              if (auth == NULL) {
  605. -                eprintf("handle_wrongsecinfo_noname: authsys_create failed\n");
  606. +                eprintf("create_new_rpc_auth: "
  607. +                    "authsys_create failed\n");
  608.                  continue;
  609.              }
  610.              sec_flavor = AUTH_SYS;
  611. @@ -197,15 +201,18 @@ retry:
  612.          if (seq->sr_status == NFS4_OK) {
  613.              // returned slotid must be the same we sent
  614.              if (seq->sr_resok4.sr_slotid != args->sa_slotid) {
  615. -                eprintf("[session] sr_slotid=%d != sa_slotid=%d\n",
  616. -                    seq->sr_resok4.sr_slotid, args->sa_slotid);
  617. +                eprintf("compound_encode_send_decode: "
  618. +                    "[session] sr_slotid=%d != sa_slotid=%d\n",
  619. +                    seq->sr_resok4.sr_slotid,
  620. +                    args->sa_slotid);
  621.                  status = NFS4ERR_IO;
  622.                  goto out_free_slot;
  623.              }
  624.              // returned sessionid must be the same we sent
  625.              if (memcmp(seq->sr_resok4.sr_sessionid, args->sa_sessionid,
  626.                      NFS4_SESSIONID_SIZE)) {
  627. -                eprintf("[session] sr_sessionid != sa_sessionid\n");
  628. +                eprintf("compound_encode_send_decode: "
  629. +                    "[session] sr_sessionid != sa_sessionid\n");
  630.                  if (DPRINTF_LEVEL_ENABLED(1)) {
  631.                      print_hexbuf("sr_sessionid",
  632.                          seq->sr_resok4.sr_sessionid, NFS4_SESSIONID_SIZE);
  633. @@ -229,8 +236,11 @@ retry:
  634.      }
  635.  
  636.      if (status) {
  637. -        eprintf("nfs41_send_compound failed %d for seqid=%d, slotid=%d\n",
  638. -            status, args->sa_sequenceid, args->sa_slotid);
  639. +        eprintf("compound_encode_send_decode: "
  640. +            "nfs41_send_compound failed %d for seqid=%d, slotid=%d\n",
  641. +            status,
  642. +            args->sa_sequenceid,
  643. +            args->sa_slotid);
  644.          status = NFS4ERR_IO;
  645.          goto out_free_slot;
  646.      }
  647. @@ -253,7 +263,9 @@ retry:
  648.  
  649.          nfs41_recovery_finish(session->client);
  650.          if (status) {
  651. -            eprintf("nfs41_client_renew() failed with %d\n", status);
  652. +            eprintf("compound_encode_send_decode: "
  653. +                "nfs41_client_renew() failed with %d\n",
  654. +                status);
  655.              status = ERROR_BAD_NET_RESP;
  656.              goto out;
  657.          }
  658. @@ -277,7 +289,9 @@ retry:
  659.  
  660.          nfs41_recovery_finish(session->client);
  661.          if (status) {
  662. -            eprintf("nfs41_recover_session() failed with %d\n", status);
  663. +            eprintf("compound_encode_send_decode: "
  664. +                "nfs41_recover_session() failed with %d\n",
  665. +                status);
  666.              status = ERROR_BAD_NET_RESP;
  667.              goto out;
  668.          }
  669. @@ -397,7 +411,8 @@ retry:
  670.                          (argarray[1].op == OP_PUTROOTFH)) &&
  671.                          ((argarray[2].op == OP_SECINFO_NO_NAME) ||
  672.                          (argarray[2].op == OP_SECINFO))) {
  673. -                    eprintf("SECINFO: BROKEN SERVER\n");
  674. +                    eprintf("compound_encode_send_decode: "
  675. +                        "SECINFO: BROKEN SERVER\n");
  676.                      goto out;
  677.                  }
  678.                  if (!try_recovery)
  679. @@ -436,7 +451,9 @@ retry:
  680.                      }
  681.                      secinfo_status = nfs41_secinfo(session, file, name, secinfo);
  682.                      if (secinfo_status) {
  683. -                        eprintf("nfs41_secinfo failed with %d\n", secinfo_status);
  684. +                        eprintf("compound_encode_send_decode: "
  685. +                            "nfs41_secinfo failed with %d\n",
  686. +                            secinfo_status);
  687.                          nfs41_recovery_finish(session->client);
  688.                          if (secinfo_status == NFS4ERR_BADSESSION) {
  689.                              if (op1 == OP_SEQUENCE)
  690. @@ -453,7 +470,8 @@ retry:
  691.                      }
  692.                      secinfo_status = nfs41_secinfo_noname(session, file, secinfo);
  693.                      if (secinfo_status) {
  694. -                        eprintf("nfs41_secinfo_noname failed with %d\n",
  695. +                        eprintf("compound_encode_send_decode: "
  696. +                            "nfs41_secinfo_noname failed with %d\n",
  697.                              secinfo_status);
  698.                          nfs41_recovery_finish(session->client);
  699.                          if (op1 == OP_SEQUENCE)
  700. diff --git a/daemon/nfs41_rpc.c b/daemon/nfs41_rpc.c
  701. index ce47125..8efaf67 100644
  702. --- a/daemon/nfs41_rpc.c
  703. +++ b/daemon/nfs41_rpc.c
  704. @@ -129,17 +129,18 @@ int create_rpcsec_auth_client(
  705.              RPCSEC_SSPI_SVC_PRIVACY);
  706.          break;
  707.      default:
  708. -        eprintf("create_rpc_auth_client: unknown rpcsec flavor %d\n",
  709. -                sec_flavor);
  710. +        eprintf("create_rpcsec_auth_client: unknown rpcsec flavor %d\n",
  711. +            sec_flavor);
  712.          client->cl_auth = NULL;
  713.      }
  714.  
  715.      if (client->cl_auth == NULL) {
  716. -        eprintf("nfs41_rpc_clnt_create: failed to create '%s'\n",
  717. -                secflavorop2name(sec_flavor));
  718. +        eprintf("create_rpcsec_auth_client: failed to create '%s'\n",
  719. +            secflavorop2name(sec_flavor));
  720.          goto out;
  721.      } else {
  722. -        DPRINTF(1, ("nfs41_rpc_clnt_create: successfully created '%s'\n",
  723. +        DPRINTF(1,
  724. +            ("create_rpcsec_auth_client: successfully created '%s'\n",
  725.              secflavorop2name(sec_flavor)));
  726.      }
  727.      status = 0;
  728. @@ -177,7 +178,8 @@ int nfs41_rpc_clnt_create(
  729.      rpc->cond = CreateEvent(NULL, TRUE, FALSE, NULL);
  730.      if (rpc->cond == NULL) {
  731.          status = GetLastError();
  732. -        eprintf("CreateEvent failed %d\n", status);
  733. +        eprintf("nfs41_rpc_clnt_create: CreateEvent failed %d\n",
  734. +            status);
  735.          goto out_free_rpc_clnt;
  736.      }
  737.      status = get_client_for_multi_addr(addrs, wsize, rsize, needcb?rpc:NULL,
  738. @@ -197,7 +199,8 @@ int nfs41_rpc_clnt_create(
  739.      if (sec_flavor == RPCSEC_AUTH_NONE) {
  740.          client->cl_auth = authnone_create();
  741.          if (client->cl_auth == NULL) {
  742. -            eprintf("nfs41_rpc_clnt_create: failed to create rpc authnone\n");
  743. +            eprintf("nfs41_rpc_clnt_create: "
  744. +                "failed to create rpc authnone\n");
  745.              status = ERROR_NETWORK_UNREACHABLE;
  746.              goto out_err_client;
  747.          }
  748. @@ -224,7 +227,8 @@ int nfs41_rpc_clnt_create(
  749.              uid, gid,
  750.              num_aup_gids, aup_gids);
  751.          if (client->cl_auth == NULL) {
  752. -            eprintf("nfs41_rpc_clnt_create: failed to create rpc authsys\n");
  753. +            eprintf("nfs41_rpc_clnt_create: "
  754. +                "failed to create rpc authsys\n");
  755.              status = ERROR_NETWORK_UNREACHABLE;
  756.              goto out_err_client;
  757.          }
  758. @@ -235,8 +239,10 @@ int nfs41_rpc_clnt_create(
  759.           */
  760.          status = create_rpcsec_auth_client(sec_flavor, rpc->server_name, client);
  761.          if (status) {
  762. -            eprintf("nfs41_rpc_clnt_create: failed to establish security "
  763. -                    "context with %s\n", rpc->server_name);
  764. +            eprintf("nfs41_rpc_clnt_create: "
  765. +                "failed to establish security "
  766. +                "context with %s\n",
  767. +                rpc->server_name);
  768.              status = ERROR_NETWORK_UNREACHABLE;
  769.              goto out_err_client;
  770.          } else
  771. @@ -329,7 +335,8 @@ static int rpc_reconnect(
  772.          auth_destroy(rpc->rpc->cl_auth);
  773.          status = create_rpcsec_auth_client(rpc->sec_flavor, rpc->server_name, client);
  774.          if (status) {
  775. -            eprintf("Failed to reestablish security context\n");
  776. +            eprintf("rpc_reconnect: "
  777. +                "Failed to reestablish security context\n");
  778.              status = ERROR_NETWORK_UNREACHABLE;
  779.              goto out_err_client;
  780.          }
  781. @@ -344,7 +351,7 @@ static int rpc_reconnect(
  782.      rpc->rpc = client;
  783.      rpc->addr_index = addr_index;
  784.      rpc->version++;
  785. -    DPRINTF(1, ("nfs41_send_compound: reestablished RPC connection\n"));
  786. +    DPRINTF(1, ("rpc_reconnect: reestablished RPC connection\n"));
  787.  
  788.  out_unlock:
  789.      ReleaseSRWLockExclusive(&rpc->lock);
  790. @@ -356,7 +363,8 @@ out_unlock:
  791.          status = nfs41_bind_conn_to_session(rpc,
  792.              rpc->client->session->session_id, CDFC4_BACK_OR_BOTH);
  793.          if (status)
  794. -            eprintf("nfs41_bind_conn_to_session() failed with '%s'\n",
  795. +            eprintf("rpc_reconnect: "
  796. +                "nfs41_bind_conn_to_session() failed with '%s'\n",
  797.                  nfs_error_string(status));
  798.          status = NFS4_OK;
  799.      }
  800. @@ -387,7 +395,8 @@ int nfs41_send_compound(
  801.      ReleaseSRWLockShared(&rpc->lock);
  802.  
  803.      if (rpc_status != RPC_SUCCESS) {
  804. -        eprintf("clnt_call returned rpc_status = '%s'\n",
  805. +        eprintf("nfs41_send_compound: "
  806. +            "clnt_call returned rpc_status = '%s'\n",
  807.              rpc_error_string(rpc_status));
  808.          switch(rpc_status) {
  809.          case RPC_CANTRECV:
  810. @@ -403,7 +412,9 @@ int nfs41_send_compound(
  811.              while (rpc_renew_in_progress(rpc, NULL)) {
  812.                  status = WaitForSingleObjectEx(rpc->cond, INFINITE, FALSE);
  813.                  if (status != WAIT_OBJECT_0) {
  814. -                    eprintf("rpc_renew_in_progress: WaitForSingleObjectEx() failed\n");
  815. +                    eprintf("nfs41_send_compound: "
  816. +                        "rpc_renew_in_progress: "
  817. +                        "WaitForSingleObjectEx() failed\n");
  818.                      print_condwait_status(0, status);
  819.                      status = ERROR_LOCK_VIOLATION;
  820.                      goto out;
  821. @@ -421,18 +432,22 @@ int nfs41_send_compound(
  822.                              rpc->server_name, rpc->rpc);
  823.                  ReleaseSRWLockExclusive(&rpc->lock);
  824.                  if (status) {
  825. -                    eprintf("Failed to reestablish security context\n");
  826. +                    eprintf("nfs41_send_compound: "
  827. +                        "Failed to reestablish security context\n");
  828.                      status = ERROR_NETWORK_UNREACHABLE;
  829.                      goto out;
  830.                  }
  831.              } else
  832.                  if (rpc_reconnect(rpc))
  833. -                    eprintf("rpc_reconnect: Failed to reconnect!\n");
  834. +                    eprintf("nfs41_send_compound: rpc_reconnect: "
  835. +                        "Failed to reconnect!\n");
  836.              rpc_renew_in_progress(rpc, &zero);
  837.              goto try_again;
  838.          default:
  839. -            eprintf("UNHANDLED RPC_ERROR: %d\n", rpc_status);
  840. -                       status = ERROR_NETWORK_UNREACHABLE;
  841. +            eprintf("nfs41_send_compound: "
  842. +                "UNHANDLED RPC_ERROR: %d\n",
  843. +                rpc_status);
  844. +            status = ERROR_NETWORK_UNREACHABLE;
  845.              goto out;
  846.          }
  847.          goto out;
  848. --
  849. 2.45.1
  850.  
  851. From ba151ec7ff884b23a9f3501382749f85a99cb5d1 Mon Sep 17 00:00:00 2001
  852. From: Roland Mainz <roland.mainz@nrubsig.org>
  853. Date: Mon, 5 May 2025 19:00:02 +0200
  854. Subject: [PATCH 6/6] daemon: |eprintf()| in |handle_open()| should print the
  855.  file name
  856.  
  857. |eprintf()| in |handle_open()| should print the file name which
  858. the caller tries to open().
  859.  
  860. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  861. ---
  862. daemon/open.c | 43 +++++++++++++++++++++++++++++++------------
  863.  1 file changed, 31 insertions(+), 12 deletions(-)
  864.  
  865. diff --git a/daemon/open.c b/daemon/open.c
  866. index 905ed5d..56343cf 100644
  867. --- a/daemon/open.c
  868. +++ b/daemon/open.c
  869. @@ -846,7 +846,9 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  870.  
  871.      status = create_open_state(args->path, args->open_owner_id, &state);
  872.      if (status) {
  873. -        eprintf("create_open_state(%d) failed with %d\n",
  874. +        eprintf("handle_open(args->path='%s'): "
  875. +            "create_open_state(%d) failed with %d\n",
  876. +            args->path,
  877.              args->open_owner_id, status);
  878.          goto out;
  879.      }
  880. @@ -876,7 +878,11 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  881.                  &state->parent, &state->path);
  882.              if (status) {
  883.                  /* can't do the reparse if we can't get the target */
  884. -                eprintf("nfs41_symlink_target() failed with %d\n", status);
  885. +                eprintf("handle_open(args->path='%s'): "
  886. +                    "nfs41_symlink_target() "
  887. +                    "failed with %d\n",
  888. +                    args->path,
  889. +                    status);
  890.                  goto out_free_state;
  891.              }
  892.  
  893. @@ -950,8 +956,10 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  894.                  status = nfs41_symlink_target(state->session,
  895.                      &state->file, &args->symlink);
  896.                  if (status) {
  897. -                    eprintf("nfs41_symlink_target() for '%s' failed with %d\n",
  898. -                        args->path, status);
  899. +                    eprintf("handle_open(args->path='%s'): "
  900. +                        "nfs41_symlink_target() failed with %d\n",
  901. +                        args->path,
  902. +                        status);
  903.                  } else {
  904.                      symlink2ntpath(&args->symlink, &args->symlinktarget_type);
  905.                      /* tell the driver to call RxPrepareToReparseSymbolicLink() */
  906. @@ -1008,8 +1016,11 @@ static int handle_open(void *daemon_context, nfs41_upcall *upcall)
  907.          status = nfs41_create(state->session, NF4LNK, &createattrs,
  908.              args->symlink.path, &state->parent, &state->file, &info);
  909.          if (status) {
  910. -            eprintf("nfs41_create() for symlink='%s' failed with '%s'\n",
  911. -                args->symlink.path, nfs_error_string(status));
  912. +            eprintf("handle_open(args->path='%s'): "
  913. +                "nfs41_create() for symlink='%s' failed with '%s'\n",
  914. +                args->path,
  915. +                args->symlink.path,
  916. +                nfs_error_string(status));
  917.              status = map_symlink_errors(status);
  918.              goto out_free_state;
  919.          }
  920. @@ -1149,23 +1160,31 @@ supersede_retry:
  921.                  /* fixme: we should store the |owner_group| name in |upcall| */
  922.                  if (!get_token_primarygroup_name(upcall->currentthread_token,
  923.                      createchgrpattrs.owner_group)) {
  924. -                    eprintf("handle_open(): OPEN4_CREATE: "
  925. -                        "get_token_primarygroup_name() failed.\n");
  926. +                    eprintf("handle_open(args->path='%s'): "
  927. +                        "OPEN4_CREATE: "
  928. +                        "get_token_primarygroup_name() failed.\n",
  929. +                        args->path);
  930.                      goto create_chgrp_out;
  931.                  }
  932.                  s = createchgrpattrs.owner_group+strlen(createchgrpattrs.owner_group);
  933.                  s = stpcpy(s, "@");
  934.                  (void)stpcpy(s, nfs41dg->localdomain_name);
  935. -                DPRINTF(1, ("handle_open(): OPEN4_CREATE: owner_group='%s'\n",
  936. +                DPRINTF(1, ("handle_open(state->file.name.name='%s'): "
  937. +                    "OPEN4_CREATE: owner_group='%s'\n",
  938. +                    state->file.name.name,
  939.                      createchgrpattrs.owner_group));
  940.  
  941.                  nfs41_open_stateid_arg(state, &stateid);
  942.                  chgrp_status = nfs41_setattr(state->session,
  943.                      &state->file, &stateid, &createchgrpattrs);
  944.                  if (chgrp_status) {
  945. -                    eprintf("handle_open(): OPEN4_CREATE: "
  946. -                        "nfs41_setattr(owner_group='%s') failed with error '%s'.\n",
  947. -                        createchgrpattrs.owner_group, nfs_error_string(chgrp_status));
  948. +                    eprintf("handle_open(args->path='%s'): "
  949. +                        "OPEN4_CREATE: "
  950. +                        "nfs41_setattr(owner_group='%s') "
  951. +                        "failed with error '%s'.\n",
  952. +                        args->path,
  953. +                        createchgrpattrs.owner_group,
  954. +                        nfs_error_string(chgrp_status));
  955.                  }
  956.  create_chgrp_out:
  957.                  ;
  958. --
  959. 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