- From 3c6459be95c9b4b7b1e83c8ace00fc9c831589b6 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 10 Jan 2024 02:20:58 +0100
- Subject: [PATCH 1/6] daemon: Reduce |ca_maxoperations| to a more reasonable
- value
- Reduce NFSv4.1 client |ca_maxoperations| from |0xffffffff| to |16384|.
- NFSv4.1 servers might want to allocate buffers based on this value,
- and |0xffffffff| causes issues with |signed int32_t| overflow.
- Fixes issues that we could not mount a NFSv4.1 filesystem
- shared by a nfs4j/simple-nfs NFSv4.1 server, because the server
- tries to store |0xfffffff| (intended to be a |unsigned int32_t| by
- the NFSv4.1 protocol) in a JAVA |int|, which is a |signed int32_t|,
- which resulted in the value |-1|.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/nfs41.h | 13 +++++++++++++
- daemon/nfs41_ops.c | 4 ++--
- 2 files changed, 15 insertions(+), 2 deletions(-)
- diff --git a/daemon/nfs41.h b/daemon/nfs41.h
- index 48366d4..23731f6 100644
- --- a/daemon/nfs41.h
- +++ b/daemon/nfs41.h
- @@ -3,6 +3,7 @@
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -227,6 +228,18 @@ typedef struct __nfs41_slot_table {
- CONDITION_VARIABLE cond;
- } nfs41_slot_table;
- +/*
- + * NFS41_MAX_OPS_PER_COMPOUND - value |16384| is a compromise.
- + *
- + * Technically we can support |0xfffffff|, but that might cause
- + * trouble with |signed int| vs. |unisgned int|, and NFSv4.x
- + * server implementations might want to allocate static buffers
- + * based on what we return.
- + * Linux uses |#define NFSD_MAX_OPS_PER_COMPOUND 50| in
- + * linux-6.7/fs/nfsd/nfsd.h and Solaris uses a much higher value
- + * (see also https://bugzilla.kernel.org/show_bug.cgi?id=216383#c0).
- + */
- +#define NFS41_MAX_OPS_PER_COMPOUND 16384
- typedef struct __nfs41_channel_attrs {
- uint32_t ca_headerpadsize;
- uint32_t ca_maxrequestsize;
- diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
- index fe3a74d..4ab8ffb 100644
- --- a/daemon/nfs41_ops.c
- +++ b/daemon/nfs41_ops.c
- @@ -77,7 +77,7 @@ static int set_fore_channel_attrs(
- attrs->ca_maxrequestsize = rpc->wsize;
- attrs->ca_maxresponsesize = rpc->rsize;
- attrs->ca_maxresponsesize_cached = NFS41_MAX_SERVER_CACHE;
- - attrs->ca_maxoperations = 0xffffffff;
- + attrs->ca_maxoperations = NFS41_MAX_OPS_PER_COMPOUND;
- attrs->ca_maxrequests = max_req;
- attrs->ca_rdma_ird = NULL;
- return 0;
- @@ -93,7 +93,7 @@ static int set_back_channel_attrs(
- attrs->ca_maxrequestsize = rpc->wsize;
- attrs->ca_maxresponsesize = rpc->rsize;
- attrs->ca_maxresponsesize_cached = NFS41_MAX_SERVER_CACHE;
- - attrs->ca_maxoperations = 0xffffffff;
- + attrs->ca_maxoperations = NFS41_MAX_OPS_PER_COMPOUND;
- attrs->ca_maxrequests = max_req;
- attrs->ca_rdma_ird = NULL;
- return 0;
- --
- 2.42.1
- From 3153d833dbba5000f54bea82a5b57f088f63a9bd Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 10 Jan 2024 02:55:42 +0100
- Subject: [PATCH 2/6] daemon: Demote some debug output to make startup less
- noisy
- Demote some debug output to make damon startup less noisy.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/nfs41_daemon.c | 5 ++---
- daemon/sid.c | 2 +-
- 2 files changed, 3 insertions(+), 4 deletions(-)
- diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
- index f6d00fd..9a06c44 100644
- --- a/daemon/nfs41_daemon.c
- +++ b/daemon/nfs41_daemon.c
- @@ -450,7 +450,7 @@ void nfsd_crt_debug_init(void)
- int crtsetdbgflags = nfs41_dg.crtdbgmem_flags;
- if (crtsetdbgflags == NFS41D_GLOBALS_CRTDBGMEM_FLAGS_NOT_SET) {
- - dprintf(0, "crtsetdbgflags not set, using defaults\n");
- + dprintf(1, "crtsetdbgflags not set, using defaults\n");
- crtsetdbgflags = 0;
- crtsetdbgflags |= _CRTDBG_ALLOC_MEM_DF;
- @@ -537,7 +537,7 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- * inversion
- */
- if(SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS)) {
- - dprintf(0, "Running as HIGH_PRIORITY_CLASS\n");
- + dprintf(1, "Running as HIGH_PRIORITY_CLASS\n");
- }
- else {
- eprintf("Failed to enter HIGH_PRIORITY_CLASS mode\n");
- @@ -546,7 +546,6 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
- #ifdef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
- /* force enable for cygwin getent passwd/group testing */
- cmd_args.ldap_enable = TRUE;
- - DASSERT(0/* test asserts*/, 0);
- #endif /* NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
- nfs41_server_list_init();
- diff --git a/daemon/sid.c b/daemon/sid.c
- index 21d9732..412b33f 100644
- --- a/daemon/sid.c
- +++ b/daemon/sid.c
- @@ -205,7 +205,7 @@ sidcache user_sidcache = { 0 };
- void sidcache_init(void)
- {
- - dprintf(0, "SID cache init\n");
- + dprintf(1, "SID cache init\n");
- InitializeCriticalSection(&user_sidcache.lock);
- }
- --
- 2.42.1
- From 22177bc090260a4c056f93d40a6c6fa73938ca77 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 10 Jan 2024 04:26:21 +0100
- Subject: [PATCH 3/6] daemon: Log mount/umount by default so the admin can see
- them
- Log mount and umount by default, so the admin can clearly see
- what is when happening.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/mount.c | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
- diff --git a/daemon/mount.c b/daemon/mount.c
- index 6e5f46b..9561b8b 100644
- --- a/daemon/mount.c
- +++ b/daemon/mount.c
- @@ -154,6 +154,18 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
- upcall->root_ref = root;
- args->lease_time = client->session->lease_time;
- out:
- + if (status == 0) {
- + dprintf(0, "# mount(hostport='%s', path='%s') success, root=0x%p\n",
- + args->hostport?args->hostport:"<NULL>",
- + args->path?args->path:"<NULL>",
- + root);
- + }
- + else {
- + dprintf(0, "# mount(hostport='%s', path='%s') failed, status=%d\n",
- + args->hostport?args->hostport:"<NULL>",
- + args->path?args->path:"<NULL>",
- + (int)status);
- + }
- return status;
- out_err:
- @@ -204,6 +216,9 @@ static int handle_unmount(void *daemon_context, nfs41_upcall *upcall)
- {
- /* release the original reference from nfs41_root_create() */
- nfs41_root_deref(upcall->root_ref);
- +
- + dprintf(0, "# umount(root='0x%p') success\n", upcall->root_ref);
- +
- return ERROR_SUCCESS;
- }
- --
- 2.42.1
- From 3f9441a481a4959ea4c9f523a05cf17a0ddb4a28 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 10 Jan 2024 05:07:00 +0100
- Subject: [PATCH 4/6] daemon: Provide |logprintf()| for
- access/audit/adminstrative logging
- Provide |logprintf()| for access/audit/adminstrative logging,
- independent from debug and error logs. Events are always tagged
- with a timestamp.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/daemon_debug.c | 21 +++++++++++++++++++++
- daemon/daemon_debug.h | 1 +
- daemon/mount.c | 4 ++--
- 3 files changed, 24 insertions(+), 2 deletions(-)
- diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
- index f7ea74e..20120dc 100644
- --- a/daemon/daemon_debug.c
- +++ b/daemon/daemon_debug.c
- @@ -83,6 +83,27 @@ void dprintf(int level, LPCSTR format, ...)
- }
- }
- +/* log events (mount, umount, auth, ...) */
- +void logprintf(LPCSTR format, ...)
- +{
- + SYSTEMTIME stime;
- + GetLocalTime(&stime);
- +
- + va_list args;
- + va_start(args, format);
- + (void)fprintf(dlog_file, "# LOG: ts=%04d-%02d-%02d_%02d:%02d:%02d:%04d"
- + " thr=%04x msg=",
- + (int)stime.wYear, (int)stime.wMonth, (int)stime.wDay,
- + (int)stime.wHour, (int)stime.wMinute, (int)stime.wSecond,
- + (int)stime.wMilliseconds,
- + (int)GetCurrentThreadId());
- + (void)vfprintf(dlog_file, format, args);
- +#ifndef STANDALONE_NFSD
- + (void)fflush(dlog_file);
- +#endif
- + va_end(args);
- +}
- +
- void eprintf(LPCSTR format, ...)
- {
- va_list args;
- diff --git a/daemon/daemon_debug.h b/daemon/daemon_debug.h
- index 0d1f39e..660628a 100644
- --- a/daemon/daemon_debug.h
- +++ b/daemon/daemon_debug.h
- @@ -67,6 +67,7 @@
- /* daemon_debug.h */
- void set_debug_level(int level);
- +void logprintf(LPCSTR format, ...);
- void dprintf(int level, LPCSTR format, ...);
- void eprintf(LPCSTR format, ...);
- diff --git a/daemon/mount.c b/daemon/mount.c
- index 9561b8b..67df748 100644
- --- a/daemon/mount.c
- +++ b/daemon/mount.c
- @@ -155,13 +155,13 @@ static int handle_mount(void *daemon_context, nfs41_upcall *upcall)
- args->lease_time = client->session->lease_time;
- out:
- if (status == 0) {
- - dprintf(0, "# mount(hostport='%s', path='%s') success, root=0x%p\n",
- + logprintf("mount(hostport='%s', path='%s') success, root=0x%p\n",
- args->hostport?args->hostport:"<NULL>",
- args->path?args->path:"<NULL>",
- root);
- }
- else {
- - dprintf(0, "# mount(hostport='%s', path='%s') failed, status=%d\n",
- + logprintf("mount(hostport='%s', path='%s') failed, status=%d\n",
- args->hostport?args->hostport:"<NULL>",
- args->path?args->path:"<NULL>",
- (int)status);
- --
- 2.42.1
- From 7604afb587ab97ca8ef7e190236f4d4547f6d16e Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 10 Jan 2024 05:27:25 +0100
- Subject: [PATCH 5/6] daemon: umount should use |logprintf()|
- |handle_unmount()| should use |logprintf()|
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/mount.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/daemon/mount.c b/daemon/mount.c
- index 67df748..8a85081 100644
- --- a/daemon/mount.c
- +++ b/daemon/mount.c
- @@ -217,7 +217,7 @@ static int handle_unmount(void *daemon_context, nfs41_upcall *upcall)
- /* release the original reference from nfs41_root_create() */
- nfs41_root_deref(upcall->root_ref);
- - dprintf(0, "# umount(root='0x%p') success\n", upcall->root_ref);
- + logprintf("umount(root='0x%p') success\n", upcall->root_ref);
- return ERROR_SUCCESS;
- }
- --
- 2.42.1
- From 0413ef867cdb64fad31d1d6881e057bc0b5e1b6c Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 10 Jan 2024 12:53:34 +0100
- Subject: [PATCH 6/6] daemon: Add NFS4ERR_* codes for NFSv4.2+xattr
- Add NFS4ERR_* codes for NFSv4.2+xattr (RFC 8276).
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- daemon/daemon_debug.c | 219 ++++++++++++++++++++------------------
- daemon/nfs41_const.h | 18 +++-
- daemon/nfs41_superblock.c | 5 +-
- 3 files changed, 134 insertions(+), 108 deletions(-)
- diff --git a/daemon/daemon_debug.c b/daemon/daemon_debug.c
- index 20120dc..8943802 100644
- --- a/daemon/daemon_debug.c
- +++ b/daemon/daemon_debug.c
- @@ -3,6 +3,7 @@
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -400,110 +401,120 @@ const char* nfs_error_string(int status)
- {
- switch (status)
- {
- - case NFS4_OK: return "NFS4_OK";
- - case NFS4ERR_PERM: return "NFS4ERR_PERM";
- - case NFS4ERR_NOENT: return "NFS4ERR_NOENT";
- - case NFS4ERR_IO: return "NFS4ERR_IO";
- - case NFS4ERR_NXIO: return "NFS4ERR_NXIO";
- - case NFS4ERR_ACCESS: return "NFS4ERR_ACCESS";
- - case NFS4ERR_EXIST: return "NFS4ERR_EXIST";
- - case NFS4ERR_XDEV: return "NFS4ERR_XDEV";
- - case NFS4ERR_NOTDIR: return "NFS4ERR_NOTDIR";
- - case NFS4ERR_ISDIR: return "NFS4ERR_ISDIR";
- - case NFS4ERR_INVAL: return "NFS4ERR_INVAL";
- - case NFS4ERR_FBIG: return "NFS4ERR_FBIG";
- - case NFS4ERR_NOSPC: return "NFS4ERR_NOSPC";
- - case NFS4ERR_ROFS: return "NFS4ERR_ROFS";
- - case NFS4ERR_MLINK: return "NFS4ERR_MLINK";
- - case NFS4ERR_NAMETOOLONG: return "NFS4ERR_NAMETOOLONG";
- - case NFS4ERR_NOTEMPTY: return "NFS4ERR_NOTEMPTY";
- - case NFS4ERR_DQUOT: return "NFS4ERR_DQUOT";
- - case NFS4ERR_STALE: return "NFS4ERR_STALE";
- - case NFS4ERR_BADHANDLE: return "NFS4ERR_BADHANDLE";
- - case NFS4ERR_BAD_COOKIE: return "NFS4ERR_BAD_COOKIE";
- - case NFS4ERR_NOTSUPP: return "NFS4ERR_NOTSUPP";
- - case NFS4ERR_TOOSMALL: return "NFS4ERR_TOOSMALL";
- - case NFS4ERR_SERVERFAULT: return "NFS4ERR_SERVERFAULT";
- - case NFS4ERR_BADTYPE: return "NFS4ERR_BADTYPE";
- - case NFS4ERR_DELAY: return "NFS4ERR_DELAY";
- - case NFS4ERR_SAME: return "NFS4ERR_SAME";
- - case NFS4ERR_DENIED: return "NFS4ERR_DENIED";
- - case NFS4ERR_EXPIRED: return "NFS4ERR_EXPIRED";
- - case NFS4ERR_LOCKED: return "NFS4ERR_LOCKED";
- - case NFS4ERR_GRACE: return "NFS4ERR_GRACE";
- - case NFS4ERR_FHEXPIRED: return "NFS4ERR_FHEXPIRED";
- - case NFS4ERR_SHARE_DENIED: return "NFS4ERR_SHARE_DENIED";
- - case NFS4ERR_WRONGSEC: return "NFS4ERR_WRONGSEC";
- - case NFS4ERR_CLID_INUSE: return "NFS4ERR_CLID_INUSE";
- - case NFS4ERR_RESOURCE: return "NFS4ERR_RESOURCE";
- - case NFS4ERR_MOVED: return "NFS4ERR_MOVED";
- - case NFS4ERR_NOFILEHANDLE: return "NFS4ERR_NOFILEHANDLE";
- - case NFS4ERR_MINOR_VERS_MISMATCH: return "NFS4ERR_MINOR_VERS_MISMATCH";
- - case NFS4ERR_STALE_CLIENTID: return "NFS4ERR_STALE_CLIENTID";
- - case NFS4ERR_STALE_STATEID: return "NFS4ERR_STALE_STATEID";
- - case NFS4ERR_OLD_STATEID: return "NFS4ERR_OLD_STATEID";
- - case NFS4ERR_BAD_STATEID: return "NFS4ERR_BAD_STATEID";
- - case NFS4ERR_BAD_SEQID: return "NFS4ERR_BAD_SEQID";
- - case NFS4ERR_NOT_SAME: return "NFS4ERR_NOT_SAME";
- - case NFS4ERR_LOCK_RANGE: return "NFS4ERR_LOCK_RANGE";
- - case NFS4ERR_SYMLINK: return "NFS4ERR_SYMLINK";
- - case NFS4ERR_RESTOREFH: return "NFS4ERR_RESTOREFH";
- - case NFS4ERR_LEASE_MOVED: return "NFS4ERR_LEASE_MOVED";
- - case NFS4ERR_ATTRNOTSUPP: return "NFS4ERR_ATTRNOTSUPP";
- - case NFS4ERR_NO_GRACE: return "NFS4ERR_NO_GRACE";
- - case NFS4ERR_RECLAIM_BAD: return "NFS4ERR_RECLAIM_BAD";
- - case NFS4ERR_RECLAIM_CONFLICT: return "NFS4ERR_RECLAIM_CONFLICT";
- - case NFS4ERR_BADXDR: return "NFS4ERR_BADXDR";
- - case NFS4ERR_LOCKS_HELD: return "NFS4ERR_LOCKS_HELD";
- - case NFS4ERR_OPENMODE: return "NFS4ERR_OPENMODE";
- - case NFS4ERR_BADOWNER: return "NFS4ERR_BADOWNER";
- - case NFS4ERR_BADCHAR: return "NFS4ERR_BADCHAR";
- - case NFS4ERR_BADNAME: return "NFS4ERR_BADNAME";
- - case NFS4ERR_BAD_RANGE: return "NFS4ERR_BAD_RANGE";
- - case NFS4ERR_LOCK_NOTSUPP: return "NFS4ERR_LOCK_NOTSUPP";
- - case NFS4ERR_OP_ILLEGAL: return "NFS4ERR_OP_ILLEGAL";
- - case NFS4ERR_DEADLOCK: return "NFS4ERR_DEADLOCK";
- - case NFS4ERR_FILE_OPEN: return "NFS4ERR_FILE_OPEN";
- - case NFS4ERR_ADMIN_REVOKED: return "NFS4ERR_ADMIN_REVOKED";
- - case NFS4ERR_CB_PATH_DOWN: return "NFS4ERR_CB_PATH_DOWN";
- - case NFS4ERR_BADIOMODE: return "NFS4ERR_BADIOMODE";
- - case NFS4ERR_BADLAYOUT: return "NFS4ERR_BADLAYOUT";
- - case NFS4ERR_BAD_SESSION_DIGEST: return "NFS4ERR_BAD_SESSION_DIGEST";
- - case NFS4ERR_BADSESSION: return "NFS4ERR_BADSESSION";
- - case NFS4ERR_BADSLOT: return "NFS4ERR_BADSLOT";
- - case NFS4ERR_COMPLETE_ALREADY: return "NFS4ERR_COMPLETE_ALREADY";
- - case NFS4ERR_CONN_NOT_BOUND_TO_SESSION: return "NFS4ERR_CONN_NOT_BOUND_TO_SESSION";
- - case NFS4ERR_DELEG_ALREADY_WANTED: return "NFS4ERR_DELEG_ALREADY_WANTED";
- - case NFS4ERR_BACK_CHAN_BUSY: return "NFS4ERR_BACK_CHAN_BUSY";
- - case NFS4ERR_LAYOUTTRYLATER: return "NFS4ERR_LAYOUTTRYLATER";
- - case NFS4ERR_LAYOUTUNAVAILABLE: return "NFS4ERR_LAYOUTUNAVAILABLE";
- - case NFS4ERR_NOMATCHING_LAYOUT: return "NFS4ERR_NOMATCHING_LAYOUT";
- - case NFS4ERR_RECALLCONFLICT: return "NFS4ERR_RECALLCONFLICT";
- - case NFS4ERR_UNKNOWN_LAYOUTTYPE: return "NFS4ERR_UNKNOWN_LAYOUTTYPE";
- - case NFS4ERR_SEQ_MISORDERED: return "NFS4ERR_SEQ_MISORDERED";
- - case NFS4ERR_SEQUENCE_POS: return "NFS4ERR_SEQUENCE_POS";
- - case NFS4ERR_REQ_TOO_BIG: return "NFS4ERR_REQ_TOO_BIG";
- - case NFS4ERR_REP_TOO_BIG: return "NFS4ERR_REP_TOO_BIG";
- - case NFS4ERR_REP_TOO_BIG_TO_CACHE: return "NFS4ERR_REP_TOO_BIG_TO_CACHE";
- - case NFS4ERR_RETRY_UNCACHED_REP: return "NFS4ERR_RETRY_UNCACHED_REP";
- - case NFS4ERR_UNSAFE_COMPOUND: return "NFS4ERR_UNSAFE_COMPOUND";
- - case NFS4ERR_TOO_MANY_OPS: return "NFS4ERR_TOO_MANY_OPS";
- - case NFS4ERR_OP_NOT_IN_SESSION: return "NFS4ERR_OP_NOT_IN_SESSION";
- - case NFS4ERR_HASH_ALG_UNSUPP: return "NFS4ERR_HASH_ALG_UNSUPP";
- - case NFS4ERR_CLIENTID_BUSY: return "NFS4ERR_CLIENTID_BUSY";
- - case NFS4ERR_PNFS_IO_HOLE: return "NFS4ERR_PNFS_IO_HOLE";
- - case NFS4ERR_SEQ_FALSE_RETRY: return "NFS4ERR_SEQ_FALSE_RETRY";
- - case NFS4ERR_BAD_HIGH_SLOT: return "NFS4ERR_BAD_HIGH_SLOT";
- - case NFS4ERR_DEADSESSION: return "NFS4ERR_DEADSESSION";
- - case NFS4ERR_ENCR_ALG_UNSUPP: return "NFS4ERR_ENCR_ALG_UNSUPP";
- - case NFS4ERR_PNFS_NO_LAYOUT: return "NFS4ERR_PNFS_NO_LAYOUT";
- - case NFS4ERR_NOT_ONLY_OP: return "NFS4ERR_NOT_ONLY_OP";
- - case NFS4ERR_WRONG_CRED: return "NFS4ERR_WRONG_CRED";
- - case NFS4ERR_WRONG_TYPE: return "NFS4ERR_WRONG_TYPE";
- - case NFS4ERR_DIRDELEG_UNAVAIL: return "NFS4ERR_DIRDELEG_UNAVAIL";
- - case NFS4ERR_REJECT_DELEG: return "NFS4ERR_REJECT_DELEG";
- - case NFS4ERR_RETURNCONFLICT: return "NFS4ERR_RETURNCONFLICT";
- - case NFS4ERR_DELEG_REVOKED: return "NFS4ERR_DELEG_REVOKED";
- +#define NFSERR_TO_STRLITERAL(e) case e: return #e;
- + NFSERR_TO_STRLITERAL(NFS4_OK)
- + NFSERR_TO_STRLITERAL(NFS4ERR_PERM)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOENT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_IO)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NXIO)
- + NFSERR_TO_STRLITERAL(NFS4ERR_ACCESS)
- + NFSERR_TO_STRLITERAL(NFS4ERR_EXIST)
- + NFSERR_TO_STRLITERAL(NFS4ERR_XDEV)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOTDIR)
- + NFSERR_TO_STRLITERAL(NFS4ERR_ISDIR)
- + NFSERR_TO_STRLITERAL(NFS4ERR_INVAL)
- + NFSERR_TO_STRLITERAL(NFS4ERR_FBIG)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOSPC)
- + NFSERR_TO_STRLITERAL(NFS4ERR_ROFS)
- + NFSERR_TO_STRLITERAL(NFS4ERR_MLINK)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NAMETOOLONG)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOTEMPTY)
- + NFSERR_TO_STRLITERAL(NFS4ERR_DQUOT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_STALE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADHANDLE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BAD_COOKIE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOTSUPP)
- + NFSERR_TO_STRLITERAL(NFS4ERR_TOOSMALL)
- + NFSERR_TO_STRLITERAL(NFS4ERR_SERVERFAULT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADTYPE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_DELAY)
- + NFSERR_TO_STRLITERAL(NFS4ERR_SAME)
- + NFSERR_TO_STRLITERAL(NFS4ERR_DENIED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_EXPIRED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_LOCKED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_GRACE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_FHEXPIRED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_SHARE_DENIED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_WRONGSEC)
- + NFSERR_TO_STRLITERAL(NFS4ERR_CLID_INUSE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_RESOURCE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_MOVED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOFILEHANDLE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_MINOR_VERS_MISMATCH)
- + NFSERR_TO_STRLITERAL(NFS4ERR_STALE_CLIENTID)
- + NFSERR_TO_STRLITERAL(NFS4ERR_STALE_STATEID)
- + NFSERR_TO_STRLITERAL(NFS4ERR_OLD_STATEID)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BAD_STATEID)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BAD_SEQID)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOT_SAME)
- + NFSERR_TO_STRLITERAL(NFS4ERR_LOCK_RANGE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_SYMLINK)
- + NFSERR_TO_STRLITERAL(NFS4ERR_RESTOREFH)
- + NFSERR_TO_STRLITERAL(NFS4ERR_LEASE_MOVED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_ATTRNOTSUPP)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NO_GRACE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_RECLAIM_BAD)
- + NFSERR_TO_STRLITERAL(NFS4ERR_RECLAIM_CONFLICT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADXDR)
- + NFSERR_TO_STRLITERAL(NFS4ERR_LOCKS_HELD)
- + NFSERR_TO_STRLITERAL(NFS4ERR_OPENMODE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADOWNER)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADCHAR)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADNAME)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BAD_RANGE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_LOCK_NOTSUPP)
- + NFSERR_TO_STRLITERAL(NFS4ERR_OP_ILLEGAL)
- + NFSERR_TO_STRLITERAL(NFS4ERR_DEADLOCK)
- + NFSERR_TO_STRLITERAL(NFS4ERR_FILE_OPEN)
- + NFSERR_TO_STRLITERAL(NFS4ERR_ADMIN_REVOKED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_CB_PATH_DOWN)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADIOMODE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADLAYOUT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BAD_SESSION_DIGEST)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADSESSION)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADSLOT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_COMPLETE_ALREADY)
- + NFSERR_TO_STRLITERAL(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
- + NFSERR_TO_STRLITERAL(NFS4ERR_DELEG_ALREADY_WANTED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BACK_CHAN_BUSY)
- + NFSERR_TO_STRLITERAL(NFS4ERR_LAYOUTTRYLATER)
- + NFSERR_TO_STRLITERAL(NFS4ERR_LAYOUTUNAVAILABLE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOMATCHING_LAYOUT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_RECALLCONFLICT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_UNKNOWN_LAYOUTTYPE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_SEQ_MISORDERED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_SEQUENCE_POS)
- + NFSERR_TO_STRLITERAL(NFS4ERR_REQ_TOO_BIG)
- + NFSERR_TO_STRLITERAL(NFS4ERR_REP_TOO_BIG)
- + NFSERR_TO_STRLITERAL(NFS4ERR_REP_TOO_BIG_TO_CACHE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_RETRY_UNCACHED_REP)
- + NFSERR_TO_STRLITERAL(NFS4ERR_UNSAFE_COMPOUND)
- + NFSERR_TO_STRLITERAL(NFS4ERR_TOO_MANY_OPS)
- + NFSERR_TO_STRLITERAL(NFS4ERR_OP_NOT_IN_SESSION)
- + NFSERR_TO_STRLITERAL(NFS4ERR_HASH_ALG_UNSUPP)
- + NFSERR_TO_STRLITERAL(NFS4ERR_CLIENTID_BUSY)
- + NFSERR_TO_STRLITERAL(NFS4ERR_PNFS_IO_HOLE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_SEQ_FALSE_RETRY)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BAD_HIGH_SLOT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_DEADSESSION)
- + NFSERR_TO_STRLITERAL(NFS4ERR_ENCR_ALG_UNSUPP)
- + NFSERR_TO_STRLITERAL(NFS4ERR_PNFS_NO_LAYOUT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOT_ONLY_OP)
- + NFSERR_TO_STRLITERAL(NFS4ERR_WRONG_CRED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_WRONG_TYPE)
- + NFSERR_TO_STRLITERAL(NFS4ERR_DIRDELEG_UNAVAIL)
- + NFSERR_TO_STRLITERAL(NFS4ERR_REJECT_DELEG)
- + NFSERR_TO_STRLITERAL(NFS4ERR_RETURNCONFLICT)
- + NFSERR_TO_STRLITERAL(NFS4ERR_DELEG_REVOKED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_PARTNER_NOTSUPP)
- + NFSERR_TO_STRLITERAL(NFS4ERR_PARTNER_NO_AUTH)
- + NFSERR_TO_STRLITERAL(NFS4ERR_UNION_NOTSUPP)
- + NFSERR_TO_STRLITERAL(NFS4ERR_OFFLOAD_DENIED)
- + NFSERR_TO_STRLITERAL(NFS4ERR_WRONG_LFS)
- + NFSERR_TO_STRLITERAL(NFS4ERR_BADLABEL)
- + NFSERR_TO_STRLITERAL(NFS4ERR_OFFLOAD_NO_REQS)
- + NFSERR_TO_STRLITERAL(NFS4ERR_NOXATTR)
- + NFSERR_TO_STRLITERAL(NFS4ERR_XATTR2BIG)
- default: return "invalid nfs error code";
- }
- }
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index b6e05bf..8a68314 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -3,6 +3,7 @@
- *
- * Olga Kornievskaia <aglo@umich.edu>
- * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- @@ -166,7 +167,7 @@ enum nfsstat4 {
- NFS4ERR_ADMIN_REVOKED = 10047, /* lockowner state revoked */
- NFS4ERR_CB_PATH_DOWN = 10048, /* callback path down */
- - /* NFSv4.1 errors start here. */
- + /* NFSv4.1 errors start here... */
- NFS4ERR_BADIOMODE = 10049,
- NFS4ERR_BADLAYOUT = 10050,
- NFS4ERR_BAD_SESSION_DIGEST = 10051,
- @@ -205,7 +206,20 @@ enum nfsstat4 {
- NFS4ERR_DIRDELEG_UNAVAIL = 10084, /* delegation not avail. */
- NFS4ERR_REJECT_DELEG = 10085, /* cb rejected delegation */
- NFS4ERR_RETURNCONFLICT = 10086, /* layout get before return*/
- - NFS4ERR_DELEG_REVOKED = 10087 /* deleg./layout revoked */
- + NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
- +
- + /* NFSv4.2 errors start here... */
- + NFS4ERR_PARTNER_NOTSUPP = 10088,
- + NFS4ERR_PARTNER_NO_AUTH = 10089,
- + NFS4ERR_UNION_NOTSUPP = 10090,
- + NFS4ERR_OFFLOAD_DENIED = 10091,
- + NFS4ERR_WRONG_LFS = 10092,
- + NFS4ERR_BADLABEL = 10093,
- + NFS4ERR_OFFLOAD_NO_REQS = 10094,
- +
- + /* NFSv4 xattr (RFC 8276) error codes start here... */
- + NFS4ERR_NOXATTR = 10095,
- + NFS4ERR_XATTR2BIG = 10096
- };
- #define MAKE_WORD0(XXX) (1 << XXX)
- diff --git a/daemon/nfs41_superblock.c b/daemon/nfs41_superblock.c
- index 585613e..891371a 100644
- --- a/daemon/nfs41_superblock.c
- +++ b/daemon/nfs41_superblock.c
- @@ -98,8 +98,9 @@ static int get_superblock_attrs(
- status = nfs41_superblock_getattr(session, file,
- &attr_request, &info, &supports_named_attrs);
- if (status) {
- - eprintf("nfs41_superblock_getattr() failed with %s when fetching "
- - "attributes for fsid(%llu,%llu)\n", nfs_error_string(status),
- + eprintf("nfs41_superblock_getattr() failed with '%s'/%d when "
- + "fetching attributes for fsid(%llu,%llu)\n",
- + nfs_error_string(status), status,
- superblock->fsid.major, superblock->fsid.minor);
- goto out;
- }
- --
- 2.42.1
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
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.