git: 057409d0259f - stable/14 - nfscl: Return appropriate reply status for NFSv4.1 callbacks

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Wed, 05 Mar 2025 03:31:50 UTC
The branch stable/14 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=057409d0259f9b3f4ae46c1eccc1e9227502c2ec

commit 057409d0259f9b3f4ae46c1eccc1e9227502c2ec
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2025-02-19 23:34:53 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2025-03-05 03:30:00 +0000

    nfscl: Return appropriate reply status for NFSv4.1 callbacks
    
    Certain NFSv4.1 callbacks are not currently supported/used
    by the FreeBSD client.  Without this patch, NFS4ERR_NOTSUPP
    is replied for the callbacks.  Since NFSv4.1 does not specify
    all of these callbacks as optional, I think it is preferable
    to reply NFS_OK or NFS4ERR_REJECT_DELEG instead of NFS4ERR_NOTSUPP.
    
    This patch changes the reply status for these unsupported
    callbacks, which the client has no use for.
    
    I am not aware of any NFSv4.1 servers that will perform
    any of these callbacks against the FreeBSD client at this time.
    
    (cherry picked from commit 56c8c19046c46cb9e89c2a3967f8cf2cd0ace428)
---
 sys/fs/nfsclient/nfs_clstate.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index b00de78ef591..af8297b68c0e 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -3993,6 +3993,25 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p)
 				NFSUNLOCKCLSTATE();
 			}
 			break;
+		case NFSV4OP_CBNOTIFY:
+		case NFSV4OP_CBRECALLOBJAVAIL:
+		case NFSV4OP_CBNOTIFYLOCK:
+			/*
+			 * These callbacks are not necessarily optional,
+			 * so I think it is better to reply NFS_OK than
+			 * NFSERR_NOTSUPP.
+			 * All provide information for which the FreeBSD client
+			 * does not currently have a use.
+			 * I am not sure if any of these could be generated
+			 * by a NFSv4.1/4.2 server for this client?
+			 */
+			error = 0;
+			NFSCL_DEBUG(1, "unsupp callback %d\n", op);
+			break;
+		case NFSV4OP_CBPUSHDELEG:
+			error = NFSERR_REJECTDELEG;
+			NFSCL_DEBUG(1, "unsupp callback %d\n", op);
+			break;
 		default:
 			if (i == 0 && minorvers != NFSV4_MINORVERSION)
 				error = NFSERR_OPNOTINSESS;