aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2022-07-09 15:02:14 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2022-07-25 21:05:45 +0000
commit488f9d852787dd03126d7fac8d76316ecb86da84 (patch)
treeddfe91ae8fa6a35ab8a9fdaf32f714bb9ddbb5e8
parent516998709ade4cf551660fa572ed7c5aa0a7fcff (diff)
downloadsrc-488f9d852787dd03126d7fac8d76316ecb86da84.tar.gz
src-488f9d852787dd03126d7fac8d76316ecb86da84.zip
nfscl: Move nfsrpc_destroysession into nfscommon
This patch moves nfsrpc_destroysession() into nfscommon.ko and also modifies its arguments slightly. This will allow the function to be called from nfsv4_sequencelookup() in a future commit. This patch should not result in a semantics change. PR: 260011 (cherry picked from commit dff31ae1c59cab9437e88bfd0f2abd35ddaa98f1)
-rw-r--r--sys/fs/nfs/nfs_commonsubs.c28
-rw-r--r--sys/fs/nfs/nfs_var.h4
-rw-r--r--sys/fs/nfsclient/nfs_clrpcops.c28
-rw-r--r--sys/fs/nfsclient/nfs_clstate.c6
4 files changed, 33 insertions, 33 deletions
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c
index 8c72f684a06c..bae4c82a998b 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -4989,3 +4989,31 @@ nfsm_add_ext_pgs(struct mbuf *m, int maxextsiz, int *bextpg)
}
return (mp);
}
+
+/*
+ * Do the NFSv4.1 Destroy Session.
+ */
+int
+nfsrpc_destroysession(struct nfsmount *nmp, struct nfsclsession *tsep,
+ struct ucred *cred, NFSPROC_T *p)
+{
+ uint32_t *tl;
+ struct nfsrv_descript nfsd;
+ struct nfsrv_descript *nd = &nfsd;
+ int error;
+
+ nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0,
+ 0, NULL);
+ NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID);
+ if (tsep == NULL)
+ tsep = nfsmnt_mdssession(nmp);
+ bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID);
+ nd->nd_flag |= ND_USEGSSNAME;
+ error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred,
+ NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL);
+ if (error != 0)
+ return (error);
+ error = nd->nd_repstat;
+ m_freem(nd->nd_mrep);
+ return (error);
+}
diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h
index b493ee509440..cf963691109b 100644
--- a/sys/fs/nfs/nfs_var.h
+++ b/sys/fs/nfs/nfs_var.h
@@ -364,6 +364,8 @@ struct ucred *nfsrv_getgrpscred(struct ucred *);
struct nfsdevice *nfsv4_findmirror(struct nfsmount *);
void nfsm_set(struct nfsrv_descript *, u_int);
struct mbuf *nfsm_add_ext_pgs(struct mbuf *, int, int *);
+int nfsrpc_destroysession(struct nfsmount *, struct nfsclsession *,
+ struct ucred *, NFSPROC_T *);
/* nfs_clcomsubs.c */
void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int);
@@ -530,8 +532,6 @@ int nfsrpc_exchangeid(struct nfsmount *, struct nfsclclient *,
int nfsrpc_createsession(struct nfsmount *, struct nfsclsession *,
struct nfssockreq *, struct nfsclds *, uint32_t, int, struct ucred *,
NFSPROC_T *);
-int nfsrpc_destroysession(struct nfsmount *, struct nfsclclient *,
- struct ucred *, NFSPROC_T *);
int nfsrpc_destroyclient(struct nfsmount *, struct nfsclclient *,
struct ucred *, NFSPROC_T *);
int nfsrpc_getdeviceinfo(struct nfsmount *, uint8_t *, int, uint32_t *,
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 45aa2a8b4d6d..29e069f9d334 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -5062,34 +5062,6 @@ nfsmout:
}
/*
- * Do the NFSv4.1 Destroy Session.
- */
-int
-nfsrpc_destroysession(struct nfsmount *nmp, struct nfsclclient *clp,
- struct ucred *cred, NFSPROC_T *p)
-{
- uint32_t *tl;
- struct nfsrv_descript nfsd;
- struct nfsrv_descript *nd = &nfsd;
- int error;
- struct nfsclsession *tsep;
-
- nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0,
- 0, NULL);
- NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID);
- tsep = nfsmnt_mdssession(nmp);
- bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID);
- nd->nd_flag |= ND_USEGSSNAME;
- error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred,
- NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL);
- if (error != 0)
- return (error);
- error = nd->nd_repstat;
- m_freem(nd->nd_mrep);
- return (error);
-}
-
-/*
* Do the NFSv4.1 Destroy Client.
*/
int
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 9d4fe1d1cd7f..3779a323e04c 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -2089,10 +2089,10 @@ nfscl_umount(struct nfsmount *nmp, NFSPROC_T *p, struct nfscldeleghead *dhp)
nfscl_delegreturnall(clp, p, dhp);
cred = newnfs_getcred();
if (NFSHASNFSV4N(nmp)) {
- (void)nfsrpc_destroysession(nmp, clp, cred, p);
- (void)nfsrpc_destroyclient(nmp, clp, cred, p);
+ nfsrpc_destroysession(nmp, NULL, cred, p);
+ nfsrpc_destroyclient(nmp, clp, cred, p);
} else
- (void)nfsrpc_setclient(nmp, clp, 0, NULL, cred, p);
+ nfsrpc_setclient(nmp, clp, 0, NULL, cred, p);
nfscl_cleanclient(clp);
nmp->nm_clp = NULL;
NFSFREECRED(cred);