Print this page
11083 support NFS server in zone
Portions contributed by: Dan Kruchinin <dan.kruchinin@nexenta.com>
Portions contributed by: Stepan Zastupov <stepan.zastupov@gmail.com>
Portions contributed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Portions contributed by: Mike Zeller <mike@mikezeller.net>
Portions contributed by: Dan McDonald <danmcd@joyent.com>
Portions contributed by: Gordon Ross <gordon.w.ross@gmail.com>
Portions contributed by: Vitaliy Gusev <gusev.vitaliy@gmail.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Jason King <jbk@joyent.com>
Reviewed by: C Fraire <cfraire@me.com>
Change-Id: I22f289d357503f9b48a0bc2482cc4328a6d43d16
@@ -22,10 +22,14 @@
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2018 Nexenta Systems, Inc.
+ */
+
#include <sys/systm.h>
#include <sys/sdt.h>
#include <rpc/types.h>
#include <rpc/auth.h>
#include <rpc/auth_unix.h>
@@ -37,15 +41,10 @@
#include <nfs/nfs4_drc.h>
#define NFS4_MAX_MINOR_VERSION 0
/*
- * This is the duplicate request cache for NFSv4
- */
-rfs4_drc_t *nfs4_drc = NULL;
-
-/*
* The default size of the duplicate request cache
*/
uint32_t nfs4_drc_max = 8 * 1024;
/*
@@ -92,16 +91,16 @@
/*
* Destroy a duplicate request cache.
*/
void
-rfs4_fini_drc(rfs4_drc_t *drc)
+rfs4_fini_drc(void)
{
+ nfs4_srv_t *nsrv4 = nfs4_get_srv();
+ rfs4_drc_t *drc = nsrv4->nfs4_drc;
rfs4_dupreq_t *drp, *drp_next;
- ASSERT(drc);
-
/* iterate over the dr_cache and free the enties */
for (drp = list_head(&(drc->dr_cache)); drp != NULL; drp = drp_next) {
if (drp->dr_state == NFS4_DUP_REPLAY)
rfs4_compound_free(&(drp->dr_res));
@@ -371,12 +370,12 @@
*
* drp is the duplicate request entry
*
*/
int
-rfs4_dispatch(struct rpcdisp *disp, struct svc_req *req,
- SVCXPRT *xprt, char *ap)
+rfs4_dispatch(struct rpcdisp *disp, struct svc_req *req, SVCXPRT *xprt,
+ char *ap)
{
COMPOUND4res res_buf;
COMPOUND4res *rbp;
COMPOUND4args *cap;
@@ -384,10 +383,12 @@
int error = 0;
int dis_flags = 0;
int dr_stat = NFS4_NOT_DUP;
rfs4_dupreq_t *drp = NULL;
int rv;
+ nfs4_srv_t *nsrv4 = nfs4_get_srv();
+ rfs4_drc_t *nfs4_drc = nsrv4->nfs4_drc;
ASSERT(disp);
/*
* Short circuit the RPC_NULL proc.
@@ -542,17 +543,21 @@
return (FALSE);
resp = &res_buf;
/*
- * Form a reply tag by copying over the reqeuest tag.
+ * Form a reply tag by copying over the request tag.
*/
+ resp->tag.utf8string_len = argsp->tag.utf8string_len;
+ if (argsp->tag.utf8string_len != 0) {
resp->tag.utf8string_val =
kmem_alloc(argsp->tag.utf8string_len, KM_SLEEP);
- resp->tag.utf8string_len = argsp->tag.utf8string_len;
bcopy(argsp->tag.utf8string_val, resp->tag.utf8string_val,
resp->tag.utf8string_len);
+ } else {
+ resp->tag.utf8string_val = NULL;
+ }
resp->array_len = 0;
resp->array = NULL;
resp->status = NFS4ERR_MINOR_VERS_MISMATCH;
if (!svc_sendreply(xprt, xdr_COMPOUND4res_srv, (char *)resp)) {
DTRACE_PROBE2(nfss__e__minorvers_mismatch,
@@ -573,15 +578,19 @@
rbp = &res_buf;
/*
* Form a reply tag by copying over the request tag.
*/
+ rbp->tag.utf8string_len = argsp->tag.utf8string_len;
+ if (argsp->tag.utf8string_len != 0) {
rbp->tag.utf8string_val =
kmem_alloc(argsp->tag.utf8string_len, KM_SLEEP);
- rbp->tag.utf8string_len = argsp->tag.utf8string_len;
bcopy(argsp->tag.utf8string_val, rbp->tag.utf8string_val,
rbp->tag.utf8string_len);
+ } else {
+ rbp->tag.utf8string_val = NULL;
+ }
rbp->array_len = 1;
rbp->array = kmem_zalloc(rbp->array_len * sizeof (nfs_resop4),
KM_SLEEP);
resop = &rbp->array[0];