From 0ce3456c6b4bf63e84573708dd7e82622bd0d70b Mon Sep 17 00:00:00 2001 From: rmacklem Date: Wed, 10 May 2017 01:39:21 +0000 Subject: [PATCH] MFC: r317465 Fix handling of a NFSv4.1 callback reply from the session cache. The nfsv4_seqsession() call returns NFSERR_REPLYFROMCACHE when it has a reply in the session, due to a requestor retry. The code erroneously assumed a return of 0 for this case. This patch fixes this and adds a KASSERT(). This would be an extremely rare occurrence. It was found during code inspection during the pNFS server development. git-svn-id: svn://svn.freebsd.org/base/stable/10@318128 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/fs/nfsclient/nfs_clstate.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 6712f264d..d68b3cb77 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3560,9 +3560,18 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) tsep->nfsess_backslots); } NFSUNLOCKCLSTATE(); - if (error == 0) { + if (error == 0 || error == NFSERR_REPLYFROMCACHE) { gotseq_ok = 1; if (rep != NULL) { + /* + * Handle a reply for a retried + * callback. The reply will be + * re-inserted in the session cache + * by the nfsv4_seqsess_cacherep() call + * after out: + */ + KASSERT(error == NFSERR_REPLYFROMCACHE, + ("cbsequence: non-NULL rep")); NFSCL_DEBUG(4, "Got cbretry\n"); m_freem(nd->nd_mreq); nd->nd_mreq = rep; -- 2.45.0