pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for debug messages, nfs4j server, NFSv4.2 error messages+misc, 2024-01-11
Posted by Anonymous on Thu 11th Jan 2024 13:40
raw | new post

  1. From 3c6459be95c9b4b7b1e83c8ace00fc9c831589b6 Mon Sep 17 00:00:00 2001
  2. From: Roland Mainz <roland.mainz@nrubsig.org>
  3. Date: Wed, 10 Jan 2024 02:20:58 +0100
  4. Subject: [PATCH 1/6] daemon: Reduce |ca_maxoperations| to a more reasonable
  5.  value
  6.  
  7. Reduce NFSv4.1 client |ca_maxoperations| from |0xffffffff| to |16384|.
  8. NFSv4.1 servers might want to allocate buffers based on this value,
  9. and |0xffffffff| causes issues with |signed int32_t| overflow.
  10.  
  11. Fixes issues that we could not mount a NFSv4.1 filesystem
  12. shared by a nfs4j/simple-nfs NFSv4.1 server, because the server
  13. tries to store |0xfffffff| (intended to be a |unsigned int32_t| by
  14. the NFSv4.1 protocol) in a JAVA |int|, which is a |signed int32_t|,
  15. which resulted in the value |-1|.
  16.  
  17. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  18. ---
  19. daemon/nfs41.h     | 13 +++++++++++++
  20.  daemon/nfs41_ops.c |  4 ++--
  21.  2 files changed, 15 insertions(+), 2 deletions(-)
  22.  
  23. diff --git a/daemon/nfs41.h b/daemon/nfs41.h
  24. index 48366d4..23731f6 100644
  25. --- a/daemon/nfs41.h
  26. +++ b/daemon/nfs41.h
  27. @@ -3,6 +3,7 @@
  28.   *
  29.   * Olga Kornievskaia <aglo@umich.edu>
  30.   * Casey Bodley <cbodley@umich.edu>
  31. + * Roland Mainz <roland.mainz@nrubsig.org>
  32.   *
  33.   * This library is free software; you can redistribute it and/or modify it
  34.   * under the terms of the GNU Lesser General Public License as published by
  35. @@ -227,6 +228,18 @@ typedef struct __nfs41_slot_table {
  36.      CONDITION_VARIABLE cond;
  37.  } nfs41_slot_table;
  38.  
  39. +/*
  40. + * NFS41_MAX_OPS_PER_COMPOUND - value |16384| is a compromise.
  41. + *
  42. + * Technically we can support |0xfffffff|, but that might cause
  43. + * trouble with |signed int| vs. |unisgned int|, and NFSv4.x
  44. + * server implementations might want to allocate static buffers
  45. + * based on what we return.
  46. + * Linux uses |#define NFSD_MAX_OPS_PER_COMPOUND 50| in
  47. + * linux-6.7/fs/nfsd/nfsd.h and Solaris uses a much higher value
  48. + * (see also https://bugzilla.kernel.org/show_bug.cgi?id=216383#c0).
  49. + */
  50. +#define NFS41_MAX_OPS_PER_COMPOUND 16384
  51.  typedef struct __nfs41_channel_attrs {
  52.      uint32_t                ca_headerpadsize;
  53.      uint32_t                ca_maxrequestsize;
  54. diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
  55. index fe3a74d..4ab8ffb 100644
  56. --- a/daemon/nfs41_ops.c
  57. +++ b/daemon/nfs41_ops.c
  58. @@ -77,7 +77,7 @@ static int set_fore_channel_attrs(
  59.      attrs->ca_maxrequestsize = rpc->wsize;
  60.      attrs->ca_maxresponsesize = rpc->rsize;
  61.      attrs->ca_maxresponsesize_cached = NFS41_MAX_SERVER_CACHE;
  62. -    attrs->ca_maxoperations = 0xffffffff;
  63. +    attrs->ca_maxoperations = NFS41_MAX_OPS_PER_COMPOUND;
  64.      attrs->ca_maxrequests = max_req;
  65.      attrs->ca_rdma_ird = NULL;
  66.      return 0;
  67. @@ -93,7 +93,7 @@ static int set_back_channel_attrs(
  68.      attrs->ca_maxrequestsize = rpc->wsize;
  69.      attrs->ca_maxresponsesize = rpc->rsize;
  70.      attrs->ca_maxresponsesize_cached = NFS41_MAX_SERVER_CACHE;
  71. -    attrs->ca_maxoperations = 0xffffffff;
  72. +    attrs->ca_maxoperations = NFS41_MAX_OPS_PER_COMPOUND;
  73.      attrs->ca_maxrequests = max_req;
  74.      attrs->ca_rdma_ird = NULL;
  75.      return 0;
  76. --
  77. 2.42.1
  78.  
  79. From 3153d833dbba5000f54bea82a5b57f088f63a9bd Mon Sep 17 00:00:00 2001
  80. From: Roland Mainz <roland.mainz@nrubsig.org>
  81. Date: Wed, 10 Jan 2024 02:55:42 +0100
  82. Subject: [PATCH 2/6] daemon: Demote some debug output to make startup less
  83.  noisy
  84.  
  85. Demote some debug output to make damon startup less noisy.
  86.  
  87. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  88. ---
  89. daemon/nfs41_daemon.c | 5 ++---
  90.  daemon/sid.c          | 2 +-
  91.  2 files changed, 3 insertions(+), 4 deletions(-)
  92.  
  93. diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
  94. index f6d00fd..9a06c44 100644
  95. --- a/daemon/nfs41_daemon.c
  96. +++ b/daemon/nfs41_daemon.c
  97. @@ -450,7 +450,7 @@ void nfsd_crt_debug_init(void)
  98.      int crtsetdbgflags = nfs41_dg.crtdbgmem_flags;
  99.  
  100.      if (crtsetdbgflags == NFS41D_GLOBALS_CRTDBGMEM_FLAGS_NOT_SET) {
  101. -        dprintf(0, "crtsetdbgflags not set, using defaults\n");
  102. +        dprintf(1, "crtsetdbgflags not set, using defaults\n");
  103.          crtsetdbgflags = 0;
  104.  
  105.          crtsetdbgflags |= _CRTDBG_ALLOC_MEM_DF;
  106. @@ -537,7 +537,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  107.       * inversion
  108.       */
  109.      if(SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS)) {
  110. -        dprintf(0, "Running as HIGH_PRIORITY_CLASS\n");
  111. +        dprintf(1, "Running as HIGH_PRIORITY_CLASS\n");
  112.      }
  113.      else {
  114.          eprintf("Failed to enter HIGH_PRIORITY_CLASS mode\n");
  115. @@ -546,7 +546,6 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
  116.  #ifdef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
  117.      /* force enable for cygwin getent passwd/group testing */
  118.      cmd_args.ldap_enable = TRUE;
  119. -    DASSERT(0/* test asserts*/, 0);
  120.  #endif /* NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
  121.  
  122.      nfs41_server_list_init();
  123. diff --git a/daemon/sid.c b/daemon/sid.c
  124. index 21d9732..412b33f 100644
  125. --- a/daemon/sid.c
  126. +++ b/daemon/sid.c
  127. @@ -205,7 +205,7 @@ sidcache user_sidcache = { 0 };
  128.  
  129.  void sidcache_init(void)
  130.  {
  131. -    dprintf(0, "SID cache init\n");
  132. +    dprintf(1, "SID cache init\n");
  133.      InitializeCriticalSection(&user_sidcache.lock);
  134.  }
  135.  
  136. --
  137. 2.42.1
  138.  
  139. From 22177bc090260a4c056f93d40a6c6fa73938ca77 Mon Sep 17 00:00:00 2001
  140. From: Roland Mainz <roland.mainz@nrubsig.org>
  141. Date: Wed, 10 Jan 2024 04:26:21 +0100
  142. Subject: [PATCH 3/6] daemon: Log mount/umount by default so the admin can see
  143.  them
  144.  
  145. Log mount and umount by default, so the admin can clearly see
  146. what is when happening.
  147.  
  148. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  149. ---
  150. daemon/mount.c | 15 +++++++++++++++
  151.  1 file changed, 15 insertions(+)
  152.  
  153. diff --git a/daemon/mount.c b/daemon/mount.c
  154. index 6e5f46b..9561b8b 100644
  155. --- a/daemon/mount.c
  156. +++ b/daemon/mount.c
  157. @@ -154,6 +154,18 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
  158.      upcall->root_ref = root;
  159.      args->lease_time = client->session->lease_time;
  160.  out:
  161. +    if (status == 0) {
  162. +        dprintf(0, "# mount(hostport='%s', path='%s') success, root=0x%p\n",
  163. +            args->hostport?args->hostport:"<NULL>",
  164. +            args->path?args->path:"<NULL>",
  165. +            root);
  166. +    }
  167. +    else {
  168. +        dprintf(0, "# mount(hostport='%s', path='%s') failed, status=%d\n",
  169. +            args->hostport?args->hostport:"<NULL>",
  170. +            args->path?args->path:"<NULL>",
  171. +            (int)status);
  172. +    }
  173.      return status;
  174.  
  175.  out_err:
  176. @@ -204,6 +216,9 @@ static int handle_unmount(void *daemon_context, nfs41_upcall *upcall)
  177.  {
  178.      /* release the original reference from nfs41_root_create() */
  179.      nfs41_root_deref(upcall->root_ref);
  180. +
  181. +    dprintf(0, "# umount(root='0x%p') success\n", upcall->root_ref);
  182. +
  183.      return ERROR_SUCCESS;
  184.  }
  185.  
  186. --
  187. 2.42.1
  188.  
  189. From 3f9441a481a4959ea4c9f523a05cf17a0ddb4a28 Mon Sep 17 00:00:00 2001
  190. From: Roland Mainz <roland.mainz@nrubsig.org>
  191. Date: Wed, 10 Jan 2024 05:07:00 +0100
  192. Subject: [PATCH 4/6] daemon: Provide |logprintf()| for
  193.  access/audit/adminstrative logging
  194.  
  195. Provide |logprintf()| for access/audit/adminstrative logging,
  196. independent from debug and error logs. Events are always tagged
  197. with a timestamp.
  198.  
  199. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  200. ---
  201. daemon/daemon_debug.c | 21 +++++++++++++++++++++
  202.  daemon/daemon_debug.h |  1 +
  203.  daemon/mount.c        |  4 ++--
  204.  3 files changed, 24 insertions(+), 2 deletions(-)
  205.  
  206. diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
  207. index f7ea74e..20120dc 100644
  208. --- a/daemon/daemon_debug.c
  209. +++ b/daemon/daemon_debug.c
  210. @@ -83,6 +83,27 @@ void dprintf(int level, LPCSTR format, ...)
  211.      }
  212.  }
  213.  
  214. +/* log events (mount, umount, auth, ...) */
  215. +void logprintf(LPCSTR format, ...)
  216. +{
  217. +    SYSTEMTIME stime;
  218. +    GetLocalTime(&stime);
  219. +
  220. +    va_list args;
  221. +    va_start(args, format);
  222. +    (void)fprintf(dlog_file, "# LOG: ts=%04d-%02d-%02d_%02d:%02d:%02d:%04d"
  223. +        " thr=%04x msg=",
  224. +        (int)stime.wYear, (int)stime.wMonth, (int)stime.wDay,
  225. +        (int)stime.wHour, (int)stime.wMinute, (int)stime.wSecond,
  226. +        (int)stime.wMilliseconds,
  227. +        (int)GetCurrentThreadId());
  228. +    (void)vfprintf(dlog_file, format, args);
  229. +#ifndef STANDALONE_NFSD
  230. +    (void)fflush(dlog_file);
  231. +#endif
  232. +    va_end(args);
  233. +}
  234. +
  235.  void eprintf(LPCSTR format, ...)
  236.  {
  237.      va_list args;
  238. diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
  239. index 0d1f39e..660628a 100644
  240. --- a/daemon/daemon_debug.h
  241. +++ b/daemon/daemon_debug.h
  242. @@ -67,6 +67,7 @@
  243.  
  244.  /* daemon_debug.h */
  245.  void set_debug_level(int level);
  246. +void logprintf(LPCSTR format, ...);
  247.  void dprintf(int level, LPCSTR format, ...);
  248.  void eprintf(LPCSTR format, ...);
  249.  
  250. diff --git a/daemon/mount.c b/daemon/mount.c
  251. index 9561b8b..67df748 100644
  252. --- a/daemon/mount.c
  253. +++ b/daemon/mount.c
  254. @@ -155,13 +155,13 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
  255.      args->lease_time = client->session->lease_time;
  256.  out:
  257.      if (status == 0) {
  258. -        dprintf(0, "# mount(hostport='%s', path='%s') success, root=0x%p\n",
  259. +        logprintf("mount(hostport='%s', path='%s') success, root=0x%p\n",
  260.              args->hostport?args->hostport:"<NULL>",
  261.              args->path?args->path:"<NULL>",
  262.              root);
  263.      }
  264.      else {
  265. -        dprintf(0, "# mount(hostport='%s', path='%s') failed, status=%d\n",
  266. +        logprintf("mount(hostport='%s', path='%s') failed, status=%d\n",
  267.              args->hostport?args->hostport:"<NULL>",
  268.              args->path?args->path:"<NULL>",
  269.              (int)status);
  270. --
  271. 2.42.1
  272.  
  273. From 7604afb587ab97ca8ef7e190236f4d4547f6d16e Mon Sep 17 00:00:00 2001
  274. From: Roland Mainz <roland.mainz@nrubsig.org>
  275. Date: Wed, 10 Jan 2024 05:27:25 +0100
  276. Subject: [PATCH 5/6] daemon: umount should use |logprintf()|
  277.  
  278. |handle_unmount()| should use |logprintf()|
  279.  
  280. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  281. ---
  282. daemon/mount.c | 2 +-
  283.  1 file changed, 1 insertion(+), 1 deletion(-)
  284.  
  285. diff --git a/daemon/mount.c b/daemon/mount.c
  286. index 67df748..8a85081 100644
  287. --- a/daemon/mount.c
  288. +++ b/daemon/mount.c
  289. @@ -217,7 +217,7 @@ static int handle_unmount(void *daemon_context, nfs41_upcall *upcall)
  290.      /* release the original reference from nfs41_root_create() */
  291.      nfs41_root_deref(upcall->root_ref);
  292.  
  293. -    dprintf(0, "# umount(root='0x%p') success\n", upcall->root_ref);
  294. +    logprintf("umount(root='0x%p') success\n", upcall->root_ref);
  295.  
  296.      return ERROR_SUCCESS;
  297.  }
  298. --
  299. 2.42.1
  300.  
  301. From 0413ef867cdb64fad31d1d6881e057bc0b5e1b6c Mon Sep 17 00:00:00 2001
  302. From: Roland Mainz <roland.mainz@nrubsig.org>
  303. Date: Wed, 10 Jan 2024 12:53:34 +0100
  304. Subject: [PATCH 6/6] daemon: Add NFS4ERR_* codes for NFSv4.2+xattr
  305.  
  306. Add NFS4ERR_* codes for NFSv4.2+xattr (RFC 8276).
  307.  
  308. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  309. ---
  310. daemon/daemon_debug.c     | 219 ++++++++++++++++++++------------------
  311.  daemon/nfs41_const.h      |  18 +++-
  312.  daemon/nfs41_superblock.c |   5 +-
  313.  3 files changed, 134 insertions(+), 108 deletions(-)
  314.  
  315. diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
  316. index 20120dc..8943802 100644
  317. --- a/daemon/daemon_debug.c
  318. +++ b/daemon/daemon_debug.c
  319. @@ -3,6 +3,7 @@
  320.   *
  321.   * Olga Kornievskaia <aglo@umich.edu>
  322.   * Casey Bodley <cbodley@umich.edu>
  323. + * Roland Mainz <roland.mainz@nrubsig.org>
  324.   *
  325.   * This library is free software; you can redistribute it and/or modify it
  326.   * under the terms of the GNU Lesser General Public License as published by
  327. @@ -400,110 +401,120 @@ const char* nfs_error_string(int status)
  328.  {
  329.      switch (status)
  330.      {
  331. -    case NFS4_OK: return "NFS4_OK";
  332. -    case NFS4ERR_PERM: return "NFS4ERR_PERM";
  333. -    case NFS4ERR_NOENT: return "NFS4ERR_NOENT";
  334. -    case NFS4ERR_IO: return "NFS4ERR_IO";
  335. -    case NFS4ERR_NXIO: return "NFS4ERR_NXIO";
  336. -    case NFS4ERR_ACCESS: return "NFS4ERR_ACCESS";
  337. -    case NFS4ERR_EXIST: return "NFS4ERR_EXIST";
  338. -    case NFS4ERR_XDEV: return "NFS4ERR_XDEV";
  339. -    case NFS4ERR_NOTDIR: return "NFS4ERR_NOTDIR";
  340. -    case NFS4ERR_ISDIR: return "NFS4ERR_ISDIR";
  341. -    case NFS4ERR_INVAL: return "NFS4ERR_INVAL";
  342. -    case NFS4ERR_FBIG: return "NFS4ERR_FBIG";
  343. -    case NFS4ERR_NOSPC: return "NFS4ERR_NOSPC";
  344. -    case NFS4ERR_ROFS: return "NFS4ERR_ROFS";
  345. -    case NFS4ERR_MLINK: return "NFS4ERR_MLINK";
  346. -    case NFS4ERR_NAMETOOLONG: return "NFS4ERR_NAMETOOLONG";
  347. -    case NFS4ERR_NOTEMPTY: return "NFS4ERR_NOTEMPTY";
  348. -    case NFS4ERR_DQUOT: return "NFS4ERR_DQUOT";
  349. -    case NFS4ERR_STALE: return "NFS4ERR_STALE";
  350. -    case NFS4ERR_BADHANDLE: return "NFS4ERR_BADHANDLE";
  351. -    case NFS4ERR_BAD_COOKIE: return "NFS4ERR_BAD_COOKIE";
  352. -    case NFS4ERR_NOTSUPP: return "NFS4ERR_NOTSUPP";
  353. -    case NFS4ERR_TOOSMALL: return "NFS4ERR_TOOSMALL";
  354. -    case NFS4ERR_SERVERFAULT: return "NFS4ERR_SERVERFAULT";
  355. -    case NFS4ERR_BADTYPE: return "NFS4ERR_BADTYPE";
  356. -    case NFS4ERR_DELAY: return "NFS4ERR_DELAY";
  357. -    case NFS4ERR_SAME: return "NFS4ERR_SAME";
  358. -    case NFS4ERR_DENIED: return "NFS4ERR_DENIED";
  359. -    case NFS4ERR_EXPIRED: return "NFS4ERR_EXPIRED";
  360. -    case NFS4ERR_LOCKED: return "NFS4ERR_LOCKED";
  361. -    case NFS4ERR_GRACE: return "NFS4ERR_GRACE";
  362. -    case NFS4ERR_FHEXPIRED: return "NFS4ERR_FHEXPIRED";
  363. -    case NFS4ERR_SHARE_DENIED: return "NFS4ERR_SHARE_DENIED";
  364. -    case NFS4ERR_WRONGSEC: return "NFS4ERR_WRONGSEC";
  365. -    case NFS4ERR_CLID_INUSE: return "NFS4ERR_CLID_INUSE";
  366. -    case NFS4ERR_RESOURCE: return "NFS4ERR_RESOURCE";
  367. -    case NFS4ERR_MOVED: return "NFS4ERR_MOVED";
  368. -    case NFS4ERR_NOFILEHANDLE: return "NFS4ERR_NOFILEHANDLE";
  369. -    case NFS4ERR_MINOR_VERS_MISMATCH: return "NFS4ERR_MINOR_VERS_MISMATCH";
  370. -    case NFS4ERR_STALE_CLIENTID: return "NFS4ERR_STALE_CLIENTID";
  371. -    case NFS4ERR_STALE_STATEID: return "NFS4ERR_STALE_STATEID";
  372. -    case NFS4ERR_OLD_STATEID: return "NFS4ERR_OLD_STATEID";
  373. -    case NFS4ERR_BAD_STATEID: return "NFS4ERR_BAD_STATEID";
  374. -    case NFS4ERR_BAD_SEQID: return "NFS4ERR_BAD_SEQID";
  375. -    case NFS4ERR_NOT_SAME: return "NFS4ERR_NOT_SAME";
  376. -    case NFS4ERR_LOCK_RANGE: return "NFS4ERR_LOCK_RANGE";
  377. -    case NFS4ERR_SYMLINK: return "NFS4ERR_SYMLINK";
  378. -    case NFS4ERR_RESTOREFH: return "NFS4ERR_RESTOREFH";
  379. -    case NFS4ERR_LEASE_MOVED: return "NFS4ERR_LEASE_MOVED";
  380. -    case NFS4ERR_ATTRNOTSUPP: return "NFS4ERR_ATTRNOTSUPP";
  381. -    case NFS4ERR_NO_GRACE: return "NFS4ERR_NO_GRACE";
  382. -    case NFS4ERR_RECLAIM_BAD: return "NFS4ERR_RECLAIM_BAD";
  383. -    case NFS4ERR_RECLAIM_CONFLICT: return "NFS4ERR_RECLAIM_CONFLICT";
  384. -    case NFS4ERR_BADXDR: return "NFS4ERR_BADXDR";
  385. -    case NFS4ERR_LOCKS_HELD: return "NFS4ERR_LOCKS_HELD";
  386. -    case NFS4ERR_OPENMODE: return "NFS4ERR_OPENMODE";
  387. -    case NFS4ERR_BADOWNER: return "NFS4ERR_BADOWNER";
  388. -    case NFS4ERR_BADCHAR: return "NFS4ERR_BADCHAR";
  389. -    case NFS4ERR_BADNAME: return "NFS4ERR_BADNAME";
  390. -    case NFS4ERR_BAD_RANGE: return "NFS4ERR_BAD_RANGE";
  391. -    case NFS4ERR_LOCK_NOTSUPP: return "NFS4ERR_LOCK_NOTSUPP";
  392. -    case NFS4ERR_OP_ILLEGAL: return "NFS4ERR_OP_ILLEGAL";
  393. -    case NFS4ERR_DEADLOCK: return "NFS4ERR_DEADLOCK";
  394. -    case NFS4ERR_FILE_OPEN: return "NFS4ERR_FILE_OPEN";
  395. -    case NFS4ERR_ADMIN_REVOKED: return "NFS4ERR_ADMIN_REVOKED";
  396. -    case NFS4ERR_CB_PATH_DOWN: return "NFS4ERR_CB_PATH_DOWN";
  397. -    case NFS4ERR_BADIOMODE: return "NFS4ERR_BADIOMODE";
  398. -    case NFS4ERR_BADLAYOUT: return "NFS4ERR_BADLAYOUT";
  399. -    case NFS4ERR_BAD_SESSION_DIGEST: return "NFS4ERR_BAD_SESSION_DIGEST";
  400. -    case NFS4ERR_BADSESSION: return "NFS4ERR_BADSESSION";
  401. -    case NFS4ERR_BADSLOT: return "NFS4ERR_BADSLOT";
  402. -    case NFS4ERR_COMPLETE_ALREADY: return "NFS4ERR_COMPLETE_ALREADY";
  403. -    case NFS4ERR_CONN_NOT_BOUND_TO_SESSION: return "NFS4ERR_CONN_NOT_BOUND_TO_SESSION";
  404. -    case NFS4ERR_DELEG_ALREADY_WANTED: return "NFS4ERR_DELEG_ALREADY_WANTED";
  405. -    case NFS4ERR_BACK_CHAN_BUSY: return "NFS4ERR_BACK_CHAN_BUSY";
  406. -    case NFS4ERR_LAYOUTTRYLATER: return "NFS4ERR_LAYOUTTRYLATER";
  407. -    case NFS4ERR_LAYOUTUNAVAILABLE: return "NFS4ERR_LAYOUTUNAVAILABLE";
  408. -    case NFS4ERR_NOMATCHING_LAYOUT: return "NFS4ERR_NOMATCHING_LAYOUT";
  409. -    case NFS4ERR_RECALLCONFLICT: return "NFS4ERR_RECALLCONFLICT";
  410. -    case NFS4ERR_UNKNOWN_LAYOUTTYPE: return "NFS4ERR_UNKNOWN_LAYOUTTYPE";
  411. -    case NFS4ERR_SEQ_MISORDERED: return "NFS4ERR_SEQ_MISORDERED";
  412. -    case NFS4ERR_SEQUENCE_POS: return "NFS4ERR_SEQUENCE_POS";
  413. -    case NFS4ERR_REQ_TOO_BIG: return "NFS4ERR_REQ_TOO_BIG";
  414. -    case NFS4ERR_REP_TOO_BIG: return "NFS4ERR_REP_TOO_BIG";
  415. -    case NFS4ERR_REP_TOO_BIG_TO_CACHE: return "NFS4ERR_REP_TOO_BIG_TO_CACHE";
  416. -    case NFS4ERR_RETRY_UNCACHED_REP: return "NFS4ERR_RETRY_UNCACHED_REP";
  417. -    case NFS4ERR_UNSAFE_COMPOUND: return "NFS4ERR_UNSAFE_COMPOUND";
  418. -    case NFS4ERR_TOO_MANY_OPS: return "NFS4ERR_TOO_MANY_OPS";
  419. -    case NFS4ERR_OP_NOT_IN_SESSION: return "NFS4ERR_OP_NOT_IN_SESSION";
  420. -    case NFS4ERR_HASH_ALG_UNSUPP: return "NFS4ERR_HASH_ALG_UNSUPP";
  421. -    case NFS4ERR_CLIENTID_BUSY: return "NFS4ERR_CLIENTID_BUSY";
  422. -    case NFS4ERR_PNFS_IO_HOLE: return "NFS4ERR_PNFS_IO_HOLE";
  423. -    case NFS4ERR_SEQ_FALSE_RETRY: return "NFS4ERR_SEQ_FALSE_RETRY";
  424. -    case NFS4ERR_BAD_HIGH_SLOT: return "NFS4ERR_BAD_HIGH_SLOT";
  425. -    case NFS4ERR_DEADSESSION: return "NFS4ERR_DEADSESSION";
  426. -    case NFS4ERR_ENCR_ALG_UNSUPP: return "NFS4ERR_ENCR_ALG_UNSUPP";
  427. -    case NFS4ERR_PNFS_NO_LAYOUT: return "NFS4ERR_PNFS_NO_LAYOUT";
  428. -    case NFS4ERR_NOT_ONLY_OP: return "NFS4ERR_NOT_ONLY_OP";
  429. -    case NFS4ERR_WRONG_CRED: return "NFS4ERR_WRONG_CRED";
  430. -    case NFS4ERR_WRONG_TYPE: return "NFS4ERR_WRONG_TYPE";
  431. -    case NFS4ERR_DIRDELEG_UNAVAIL: return "NFS4ERR_DIRDELEG_UNAVAIL";
  432. -    case NFS4ERR_REJECT_DELEG: return "NFS4ERR_REJECT_DELEG";
  433. -    case NFS4ERR_RETURNCONFLICT: return "NFS4ERR_RETURNCONFLICT";
  434. -    case NFS4ERR_DELEG_REVOKED: return "NFS4ERR_DELEG_REVOKED";
  435. +#define NFSERR_TO_STRLITERAL(e) case e: return #e;
  436. +    NFSERR_TO_STRLITERAL(NFS4_OK)
  437. +    NFSERR_TO_STRLITERAL(NFS4ERR_PERM)
  438. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOENT)
  439. +    NFSERR_TO_STRLITERAL(NFS4ERR_IO)
  440. +    NFSERR_TO_STRLITERAL(NFS4ERR_NXIO)
  441. +    NFSERR_TO_STRLITERAL(NFS4ERR_ACCESS)
  442. +    NFSERR_TO_STRLITERAL(NFS4ERR_EXIST)
  443. +    NFSERR_TO_STRLITERAL(NFS4ERR_XDEV)
  444. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOTDIR)
  445. +    NFSERR_TO_STRLITERAL(NFS4ERR_ISDIR)
  446. +    NFSERR_TO_STRLITERAL(NFS4ERR_INVAL)
  447. +    NFSERR_TO_STRLITERAL(NFS4ERR_FBIG)
  448. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOSPC)
  449. +    NFSERR_TO_STRLITERAL(NFS4ERR_ROFS)
  450. +    NFSERR_TO_STRLITERAL(NFS4ERR_MLINK)
  451. +    NFSERR_TO_STRLITERAL(NFS4ERR_NAMETOOLONG)
  452. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOTEMPTY)
  453. +    NFSERR_TO_STRLITERAL(NFS4ERR_DQUOT)
  454. +    NFSERR_TO_STRLITERAL(NFS4ERR_STALE)
  455. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADHANDLE)
  456. +    NFSERR_TO_STRLITERAL(NFS4ERR_BAD_COOKIE)
  457. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOTSUPP)
  458. +    NFSERR_TO_STRLITERAL(NFS4ERR_TOOSMALL)
  459. +    NFSERR_TO_STRLITERAL(NFS4ERR_SERVERFAULT)
  460. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADTYPE)
  461. +    NFSERR_TO_STRLITERAL(NFS4ERR_DELAY)
  462. +    NFSERR_TO_STRLITERAL(NFS4ERR_SAME)
  463. +    NFSERR_TO_STRLITERAL(NFS4ERR_DENIED)
  464. +    NFSERR_TO_STRLITERAL(NFS4ERR_EXPIRED)
  465. +    NFSERR_TO_STRLITERAL(NFS4ERR_LOCKED)
  466. +    NFSERR_TO_STRLITERAL(NFS4ERR_GRACE)
  467. +    NFSERR_TO_STRLITERAL(NFS4ERR_FHEXPIRED)
  468. +    NFSERR_TO_STRLITERAL(NFS4ERR_SHARE_DENIED)
  469. +    NFSERR_TO_STRLITERAL(NFS4ERR_WRONGSEC)
  470. +    NFSERR_TO_STRLITERAL(NFS4ERR_CLID_INUSE)
  471. +    NFSERR_TO_STRLITERAL(NFS4ERR_RESOURCE)
  472. +    NFSERR_TO_STRLITERAL(NFS4ERR_MOVED)
  473. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOFILEHANDLE)
  474. +    NFSERR_TO_STRLITERAL(NFS4ERR_MINOR_VERS_MISMATCH)
  475. +    NFSERR_TO_STRLITERAL(NFS4ERR_STALE_CLIENTID)
  476. +    NFSERR_TO_STRLITERAL(NFS4ERR_STALE_STATEID)
  477. +    NFSERR_TO_STRLITERAL(NFS4ERR_OLD_STATEID)
  478. +    NFSERR_TO_STRLITERAL(NFS4ERR_BAD_STATEID)
  479. +    NFSERR_TO_STRLITERAL(NFS4ERR_BAD_SEQID)
  480. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOT_SAME)
  481. +    NFSERR_TO_STRLITERAL(NFS4ERR_LOCK_RANGE)
  482. +    NFSERR_TO_STRLITERAL(NFS4ERR_SYMLINK)
  483. +    NFSERR_TO_STRLITERAL(NFS4ERR_RESTOREFH)
  484. +    NFSERR_TO_STRLITERAL(NFS4ERR_LEASE_MOVED)
  485. +    NFSERR_TO_STRLITERAL(NFS4ERR_ATTRNOTSUPP)
  486. +    NFSERR_TO_STRLITERAL(NFS4ERR_NO_GRACE)
  487. +    NFSERR_TO_STRLITERAL(NFS4ERR_RECLAIM_BAD)
  488. +    NFSERR_TO_STRLITERAL(NFS4ERR_RECLAIM_CONFLICT)
  489. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADXDR)
  490. +    NFSERR_TO_STRLITERAL(NFS4ERR_LOCKS_HELD)
  491. +    NFSERR_TO_STRLITERAL(NFS4ERR_OPENMODE)
  492. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADOWNER)
  493. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADCHAR)
  494. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADNAME)
  495. +    NFSERR_TO_STRLITERAL(NFS4ERR_BAD_RANGE)
  496. +    NFSERR_TO_STRLITERAL(NFS4ERR_LOCK_NOTSUPP)
  497. +    NFSERR_TO_STRLITERAL(NFS4ERR_OP_ILLEGAL)
  498. +    NFSERR_TO_STRLITERAL(NFS4ERR_DEADLOCK)
  499. +    NFSERR_TO_STRLITERAL(NFS4ERR_FILE_OPEN)
  500. +    NFSERR_TO_STRLITERAL(NFS4ERR_ADMIN_REVOKED)
  501. +    NFSERR_TO_STRLITERAL(NFS4ERR_CB_PATH_DOWN)
  502. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADIOMODE)
  503. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADLAYOUT)
  504. +    NFSERR_TO_STRLITERAL(NFS4ERR_BAD_SESSION_DIGEST)
  505. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADSESSION)
  506. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADSLOT)
  507. +    NFSERR_TO_STRLITERAL(NFS4ERR_COMPLETE_ALREADY)
  508. +    NFSERR_TO_STRLITERAL(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
  509. +    NFSERR_TO_STRLITERAL(NFS4ERR_DELEG_ALREADY_WANTED)
  510. +    NFSERR_TO_STRLITERAL(NFS4ERR_BACK_CHAN_BUSY)
  511. +    NFSERR_TO_STRLITERAL(NFS4ERR_LAYOUTTRYLATER)
  512. +    NFSERR_TO_STRLITERAL(NFS4ERR_LAYOUTUNAVAILABLE)
  513. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOMATCHING_LAYOUT)
  514. +    NFSERR_TO_STRLITERAL(NFS4ERR_RECALLCONFLICT)
  515. +    NFSERR_TO_STRLITERAL(NFS4ERR_UNKNOWN_LAYOUTTYPE)
  516. +    NFSERR_TO_STRLITERAL(NFS4ERR_SEQ_MISORDERED)
  517. +    NFSERR_TO_STRLITERAL(NFS4ERR_SEQUENCE_POS)
  518. +    NFSERR_TO_STRLITERAL(NFS4ERR_REQ_TOO_BIG)
  519. +    NFSERR_TO_STRLITERAL(NFS4ERR_REP_TOO_BIG)
  520. +    NFSERR_TO_STRLITERAL(NFS4ERR_REP_TOO_BIG_TO_CACHE)
  521. +    NFSERR_TO_STRLITERAL(NFS4ERR_RETRY_UNCACHED_REP)
  522. +    NFSERR_TO_STRLITERAL(NFS4ERR_UNSAFE_COMPOUND)
  523. +    NFSERR_TO_STRLITERAL(NFS4ERR_TOO_MANY_OPS)
  524. +    NFSERR_TO_STRLITERAL(NFS4ERR_OP_NOT_IN_SESSION)
  525. +    NFSERR_TO_STRLITERAL(NFS4ERR_HASH_ALG_UNSUPP)
  526. +    NFSERR_TO_STRLITERAL(NFS4ERR_CLIENTID_BUSY)
  527. +    NFSERR_TO_STRLITERAL(NFS4ERR_PNFS_IO_HOLE)
  528. +    NFSERR_TO_STRLITERAL(NFS4ERR_SEQ_FALSE_RETRY)
  529. +    NFSERR_TO_STRLITERAL(NFS4ERR_BAD_HIGH_SLOT)
  530. +    NFSERR_TO_STRLITERAL(NFS4ERR_DEADSESSION)
  531. +    NFSERR_TO_STRLITERAL(NFS4ERR_ENCR_ALG_UNSUPP)
  532. +    NFSERR_TO_STRLITERAL(NFS4ERR_PNFS_NO_LAYOUT)
  533. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOT_ONLY_OP)
  534. +    NFSERR_TO_STRLITERAL(NFS4ERR_WRONG_CRED)
  535. +    NFSERR_TO_STRLITERAL(NFS4ERR_WRONG_TYPE)
  536. +    NFSERR_TO_STRLITERAL(NFS4ERR_DIRDELEG_UNAVAIL)
  537. +    NFSERR_TO_STRLITERAL(NFS4ERR_REJECT_DELEG)
  538. +    NFSERR_TO_STRLITERAL(NFS4ERR_RETURNCONFLICT)
  539. +    NFSERR_TO_STRLITERAL(NFS4ERR_DELEG_REVOKED)
  540. +    NFSERR_TO_STRLITERAL(NFS4ERR_PARTNER_NOTSUPP)
  541. +    NFSERR_TO_STRLITERAL(NFS4ERR_PARTNER_NO_AUTH)
  542. +    NFSERR_TO_STRLITERAL(NFS4ERR_UNION_NOTSUPP)
  543. +    NFSERR_TO_STRLITERAL(NFS4ERR_OFFLOAD_DENIED)
  544. +    NFSERR_TO_STRLITERAL(NFS4ERR_WRONG_LFS)
  545. +    NFSERR_TO_STRLITERAL(NFS4ERR_BADLABEL)
  546. +    NFSERR_TO_STRLITERAL(NFS4ERR_OFFLOAD_NO_REQS)
  547. +    NFSERR_TO_STRLITERAL(NFS4ERR_NOXATTR)
  548. +    NFSERR_TO_STRLITERAL(NFS4ERR_XATTR2BIG)
  549.      default: return "invalid nfs error code";
  550.      }
  551.  }
  552. diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
  553. index b6e05bf..8a68314 100644
  554. --- a/daemon/nfs41_const.h
  555. +++ b/daemon/nfs41_const.h
  556. @@ -3,6 +3,7 @@
  557.   *
  558.   * Olga Kornievskaia <aglo@umich.edu>
  559.   * Casey Bodley <cbodley@umich.edu>
  560. + * Roland Mainz <roland.mainz@nrubsig.org>
  561.   *
  562.   * This library is free software; you can redistribute it and/or modify it
  563.   * under the terms of the GNU Lesser General Public License as published by
  564. @@ -166,7 +167,7 @@ enum nfsstat4 {
  565.      NFS4ERR_ADMIN_REVOKED       = 10047,    /* lockowner state revoked */
  566.      NFS4ERR_CB_PATH_DOWN        = 10048,    /* callback path down      */
  567.  
  568. -    /* NFSv4.1 errors start here. */
  569. +    /* NFSv4.1 errors start here... */
  570.      NFS4ERR_BADIOMODE           = 10049,
  571.      NFS4ERR_BADLAYOUT           = 10050,
  572.      NFS4ERR_BAD_SESSION_DIGEST  = 10051,
  573. @@ -205,7 +206,20 @@ enum nfsstat4 {
  574.      NFS4ERR_DIRDELEG_UNAVAIL    = 10084,    /* delegation not avail.   */
  575.      NFS4ERR_REJECT_DELEG        = 10085,    /* cb rejected delegation  */
  576.      NFS4ERR_RETURNCONFLICT      = 10086,    /* layout get before return*/
  577. -    NFS4ERR_DELEG_REVOKED       = 10087     /* deleg./layout revoked   */
  578. +    NFS4ERR_DELEG_REVOKED       = 10087,    /* deleg./layout revoked   */
  579. +
  580. +    /* NFSv4.2 errors start here... */
  581. +    NFS4ERR_PARTNER_NOTSUPP     = 10088,
  582. +    NFS4ERR_PARTNER_NO_AUTH     = 10089,
  583. +    NFS4ERR_UNION_NOTSUPP       = 10090,
  584. +    NFS4ERR_OFFLOAD_DENIED      = 10091,
  585. +    NFS4ERR_WRONG_LFS           = 10092,
  586. +    NFS4ERR_BADLABEL            = 10093,
  587. +    NFS4ERR_OFFLOAD_NO_REQS     = 10094,
  588. +
  589. +    /* NFSv4 xattr (RFC 8276) error codes start here... */
  590. +    NFS4ERR_NOXATTR             = 10095,
  591. +    NFS4ERR_XATTR2BIG           = 10096
  592.  };
  593.  
  594.  #define MAKE_WORD0(XXX) (1 << XXX)
  595. diff --git a/daemon/nfs41_superblock.c b/daemon/nfs41_superblock.c
  596. index 585613e..891371a 100644
  597. --- a/daemon/nfs41_superblock.c
  598. +++ b/daemon/nfs41_superblock.c
  599. @@ -98,8 +98,9 @@ static int get_superblock_attrs(
  600.      status = nfs41_superblock_getattr(session, file,
  601.          &attr_request, &info, &supports_named_attrs);
  602.      if (status) {
  603. -        eprintf("nfs41_superblock_getattr() failed with %s when fetching "
  604. -            "attributes for fsid(%llu,%llu)\n", nfs_error_string(status),
  605. +        eprintf("nfs41_superblock_getattr() failed with '%s'/%d when "
  606. +            "fetching attributes for fsid(%llu,%llu)\n",
  607. +            nfs_error_string(status), status,
  608.              superblock->fsid.major, superblock->fsid.minor);
  609.          goto out;
  610.      }
  611. --
  612. 2.42.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