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
*** 16,29 ****
--- 16,34 ----
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
+
/*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+ /*
+ * Copyright 2018 Nexenta Systems, Inc.
+ */
+
#include <sys/cred.h>
#include <sys/cmn_err.h>
#include <sys/debug.h>
#include <sys/systm.h>
#include <sys/kmem.h>
*** 41,52 ****
#include <nfs/nfs_log.h>
#define NUM_RECORDS_TO_WRITE 256
#define NUM_BYTES_TO_WRITE 65536
- extern krwlock_t exported_lock;
-
static int nfslog_num_records_to_write = NUM_RECORDS_TO_WRITE;
static int nfslog_num_bytes_to_write = NUM_BYTES_TO_WRITE;
/*
* This struct is used to 'hide' the details of managing the log
--- 46,55 ----
*** 593,606 ****
*
* nfslog_record_put() must be used to 'free' this record or allocation.
*/
/* ARGSUSED */
void *
! nfslog_record_alloc(
! struct exportinfo *exi,
! int alloc_indx,
! void **cookie,
int flags)
{
struct lr_alloc *lrp;
lrp = (struct lr_alloc *)
--- 596,606 ----
*
* nfslog_record_put() must be used to 'free' this record or allocation.
*/
/* ARGSUSED */
void *
! nfslog_record_alloc(struct exportinfo *exi, int alloc_indx, void **cookie,
int flags)
{
struct lr_alloc *lrp;
lrp = (struct lr_alloc *)
*** 766,777 ****
* Take care of writing the provided log record(s) to the log file.
* We group the log records with an iovec and use VOP_WRITE to append
* them to the end of the log file.
*/
static int
! nfslog_write_logrecords(struct log_file *lfp,
! struct lr_alloc *lrp_writers, int num_recs)
{
struct uio uio;
struct iovec *iovp;
int size_iovecs;
vnode_t *vp;
--- 766,777 ----
* Take care of writing the provided log record(s) to the log file.
* We group the log records with an iovec and use VOP_WRITE to append
* them to the end of the log file.
*/
static int
! nfslog_write_logrecords(struct log_file *lfp, struct lr_alloc *lrp_writers,
! int num_recs)
{
struct uio uio;
struct iovec *iovp;
int size_iovecs;
vnode_t *vp;
*** 1159,1170 ****
kmem_free(tparams, sizeof (*tparams));
} else {
/*
* Do the work asynchronously
*/
! (void) thread_create(NULL, 0, nfslog_do_flush,
! tparams, 0, &p0, TS_RUN, minclsyspri);
}
return (error);
}
--- 1159,1170 ----
kmem_free(tparams, sizeof (*tparams));
} else {
/*
* Do the work asynchronously
*/
! (void) zthread_create(NULL, 0, nfslog_do_flush,
! tparams, 0, minclsyspri);
}
return (error);
}
*** 1247,1258 ****
* no longer waiting for us.
* Free the thread arguments and exit.
*/
kmem_free(args->buff, args->buff_len);
kmem_free(tparams, sizeof (*tparams));
! thread_exit();
! /* NOTREACHED */
}
tparams->tp_error = error;
}
--- 1247,1257 ----
* no longer waiting for us.
* Free the thread arguments and exit.
*/
kmem_free(args->buff, args->buff_len);
kmem_free(tparams, sizeof (*tparams));
! zthread_exit();
}
tparams->tp_error = error;
}
*** 1527,1536 ****
--- 1526,1536 ----
* multicomponent lookup and its semantics of crossing file system
* boundaries add to the complexity. See the comments below...
*/
struct exportinfo *
nfslog_get_exi(
+ nfs_export_t *ne,
struct exportinfo *exi,
struct svc_req *req,
caddr_t res,
unsigned int *nfslog_rec_id)
{
*** 1558,1568 ****
*/
exi_hold(exi);
return (exi);
}
! if (exi != exi_public)
return (NULL);
/*
* Here we have an exi that is not marked for logging.
* It is possible that this request is a multicomponent lookup
--- 1558,1568 ----
*/
exi_hold(exi);
return (exi);
}
! if (exi != ne->exi_public)
return (NULL);
/*
* Here we have an exi that is not marked for logging.
* It is possible that this request is a multicomponent lookup
*** 1762,1782 ****
}
static char *
get_publicfh_path(int *alloc_length)
{
- extern struct exportinfo *exi_public;
char *pubpath;
! rw_enter(&exported_lock, RW_READER);
! *alloc_length = exi_public->exi_export.ex_pathlen + 1;
pubpath = kmem_alloc(*alloc_length, KM_SLEEP);
! (void) strcpy(pubpath, exi_public->exi_export.ex_path);
! rw_exit(&exported_lock);
return (pubpath);
}
static void
--- 1762,1782 ----
}
static char *
get_publicfh_path(int *alloc_length)
{
char *pubpath;
+ nfs_export_t *ne = nfs_get_export();
! rw_enter(&ne->exported_lock, RW_READER);
! *alloc_length = ne->exi_public->exi_export.ex_pathlen + 1;
pubpath = kmem_alloc(*alloc_length, KM_SLEEP);
! (void) strcpy(pubpath, ne->exi_public->exi_export.ex_path);
! rw_exit(&ne->exported_lock);
return (pubpath);
}
static void
*** 1868,1881 ****
(caddr_t)exi, (caddr_t)&res, cr, &nb, 0, NFSLOG_ONE_BUFFER);
}
void
! nfslog_getfh(struct exportinfo *exi,
! fhandle *fh,
! char *fname,
! enum uio_seg seg,
cred_t *cr)
{
struct svc_req req;
int res = 0;
struct netbuf nb = {0, 0, NULL};
--- 1868,1878 ----
(caddr_t)exi, (caddr_t)&res, cr, &nb, 0, NFSLOG_ONE_BUFFER);
}
void
! nfslog_getfh(struct exportinfo *exi, fhandle *fh, char *fname, enum uio_seg seg,
cred_t *cr)
{
struct svc_req req;
int res = 0;
struct netbuf nb = {0, 0, NULL};