summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McDonald <danmcd@mnx.io>2022-12-07 13:54:30 -0500
committerDan McDonald <danmcd@mnx.io>2022-12-07 13:54:30 -0500
commit3547bb669fbf4cedd7c88a4fe342f14b059fc311 (patch)
treec61dc1099a4998642c5bcade8bdeb6847635ddf6
parent519ebb012f55b339005b58a1bd1735e4969abf7e (diff)
parent3f3c90a958c5abf8ec0ed5d1fad2e40bd9905a50 (diff)
downloadillumos-joyent-3547bb669fbf4cedd7c88a4fe342f14b059fc311.tar.gz
[illumos-gate merge]
commit 3f3c90a958c5abf8ec0ed5d1fad2e40bd9905a50 15206 setcontext(2) should not restore %fsbase commit 7f5d80fd842f21a48514cca6718c3bbdaf592316 15184 SMB Service fails to restart 15185 SMB sessions linger after disconnect 15186 SMB use smb_llist_post in srv_oplock commit f92d0ef50ade5e261591e634cd91553a9658cf72 15191 Convert sharemgr(8) to mandoc Conflicts: usr/src/test/os-tests/tests/Makefile
-rw-r--r--usr/src/lib/libc/port/threads/sigaction.c12
-rw-r--r--usr/src/man/man2/getcontext.2218
-rw-r--r--usr/src/man/man8/sharemgr.82319
-rw-r--r--usr/src/pkg/manifests/system-test-ostest.p5m4
-rw-r--r--usr/src/test/os-tests/runfiles/default.run5
-rw-r--r--usr/src/test/os-tests/tests/Makefile4
-rw-r--r--usr/src/test/os-tests/tests/ucontext.c103
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_node.c24
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_server.c29
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_session.c42
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_srv_oplock.c82
11 files changed, 1495 insertions, 1347 deletions
diff --git a/usr/src/lib/libc/port/threads/sigaction.c b/usr/src/lib/libc/port/threads/sigaction.c
index 6a283be33b..8c48989a17 100644
--- a/usr/src/lib/libc/port/threads/sigaction.c
+++ b/usr/src/lib/libc/port/threads/sigaction.c
@@ -25,6 +25,10 @@
* Copyright 2015 Joyent, Inc.
*/
+/*
+ * Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
+ */
+
#include "lint.h"
#include <sys/feature_tests.h>
/*
@@ -601,7 +605,13 @@ setcontext(const ucontext_t *ucp)
#if defined(__sparc)
uc.uc_mcontext.gregs[REG_G7] = (greg_t)self;
#elif defined(__amd64)
- uc.uc_mcontext.gregs[REG_FS] = (greg_t)0; /* null for fsbase */
+ /*
+ * 64-bit processes must have a selector value of zero for %fs
+ * in order to use the 64-bit fs_base (the full 64-bit address
+ * range cannot be expressed in a long mode descriptor).
+ */
+ uc.uc_mcontext.gregs[REG_FS] = (greg_t)0;
+ uc.uc_mcontext.gregs[REG_FSBASE] = (greg_t)self;
#elif defined(__i386)
uc.uc_mcontext.gregs[GS] = (greg_t)LWPGS_SEL;
#else
diff --git a/usr/src/man/man2/getcontext.2 b/usr/src/man/man2/getcontext.2
index 5e12548f7c..80cf9b8c1f 100644
--- a/usr/src/man/man2/getcontext.2
+++ b/usr/src/man/man2/getcontext.2
@@ -43,98 +43,136 @@
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
.\" Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
.\"
-.TH GETCONTEXT 2 "May 13, 2017"
-.SH NAME
-getcontext, setcontext \- get and set current user context
-.SH SYNOPSIS
-.LP
-.nf
-#include <ucontext.h>
-
-\fBint\fR \fBgetcontext\fR(\fBucontext_t *\fR\fIucp\fR);
-.fi
-
-.LP
-.nf
-\fBint\fR \fBsetcontext\fR(\fBconst ucontext_t *\fR\fIucp\fR);
-.fi
-
-.SH DESCRIPTION
-.LP
-The \fBgetcontext()\fR function initializes the structure pointed to by
-\fIucp\fR to the current user context of the calling process. The
-\fBucontext_t\fR type that \fIucp\fR points to defines the user context and
-includes the contents of the calling process' machine registers, the signal
-mask, and the current execution stack.
-.sp
-.LP
-The \fBsetcontext()\fR function restores the user context pointed to by
-\fIucp\fR. A successful call to \fBsetcontext()\fR does not return; program
-execution resumes at the point specified by the \fIucp\fR argument passed to
-\fBsetcontext()\fR. The \fIucp\fR argument should be created either by a prior
-call to \fBgetcontext()\fR, or by being passed as an argument to a signal
-handler. If the \fIucp\fR argument was created with \fBgetcontext()\fR, program
-execution continues as if the corresponding call of \fBgetcontext()\fR had just
-returned. If the \fIucp\fR argument was created with \fBmakecontext\fR(3C),
-program execution continues with the function passed to \fBmakecontext\fR(3C).
+.Dd November 24, 2022
+.Dt GETCONTEXT 2
+.Os
+.Sh NAME
+.Nm getcontext ,
+.Nm setcontext
+.Nd get and set current user context
+.Sh SYNOPSIS
+.In ucontext.h
+.Ft int
+.Fo getcontext
+.Fa "ucontext_t *ucp"
+.Fc
+.Ft int
+.Fo setcontext
+.Fa "const ucontext_t *ucp"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn getcontext
+function initializes the structure pointed to by
+.Fa ucp
+to the current user context of the calling process.
+The
+.Vt ucontext_t
+type that
+.Fa ucp
+points to defines the user context and includes the contents of the calling
+process' machine registers, the signal mask, and the current execution stack.
+.Pp
+The
+.Fn setcontext
+function restores the user context pointed to by
+.Fa ucp .
+A successful call to
+.Fn setcontext
+does not return; program execution resumes at the point specified by the
+.Fa ucp
+argument passed to
+.Fn setcontext .
+The
+.Fa ucp
+argument should be created either by a prior call to
+.Fn getcontext ,
+or by being passed as an argument to a signal handler.
+If the
+.Fa ucp
+argument was created with
+.Fn getcontext ,
+program execution continues as if the corresponding call of
+.Fn getcontext
+had just returned.
+If the
+.Fa ucp
+argument was created with
+.Xr makecontext 3C ,
+program execution continues with the function passed to
+.Xr makecontext 3C .
When that function returns, the process continues as if after a call to
-\fBsetcontext()\fR with the \fIucp\fR argument that was input to
-\fBmakecontext\fR(3C). If the \fIucp\fR argument was passed to a signal
-handler, program execution continues with the program instruction following the
-instruction interrupted by the signal. If the \fBuc_link\fR member of the
-\fBucontext_t\fR structure pointed to by the \fIucp\fR argument is equal to 0,
-then this context is the main context, and the process will exit when this
-context returns. The effects of passing a \fIucp\fR argument obtained from any
-other source are unspecified.
-.SH RETURN VALUES
-.LP
-On successful completion, \fBsetcontext()\fR does not return and
-\fBgetcontext()\fR returns \fB0\fR. Otherwise, \fB\(mi1\fR is returned.
-.SH ERRORS
-.LP
+.Fn setcontext
+with the
+.Fa ucp
+argument that was input to
+.Xr makecontext 3C .
+If the
+.Fa ucp
+argument was passed to a signal handler, program execution continues with the
+program instruction following the instruction interrupted by the signal.
+If the
+.Fa uc_link
+member of the
+.Vt ucontext_t
+structure pointed to by the
+.Fa ucp
+argument is
+.Dv NULL ,
+then this context is the main context, and the process
+will exit when this context returns.
+The effects of passing a
+.Fa ucp
+argument obtained from any other source are unspecified.
+.Sh RETURN VALUES
+On successful completion,
+.Fn setcontext
+does not return and
+.Fn getcontext
+returns 0.
+Otherwise, -1 is returned.
+.Sh ERRORS
No errors are defined.
-.SH USAGE
-.LP
+.Sh USAGE
When a signal handler is executed, the current user context is saved and a new
-context is created. If the thread leaves the signal handler via
-\fBlongjmp\fR(3C), then it is unspecified whether the context at the time of
-the corresponding \fBsetjmp\fR(3C) call is restored and thus whether future
-calls to \fBgetcontext()\fR will provide an accurate representation of the
-current context, since the context restored by \fBlongjmp\fR(3C) may not
-contain all the information that \fBsetcontext()\fR requires. Signal handlers
-should use \fBsiglongjmp\fR(3C) instead.
-.sp
-.LP
-Portable applications should not modify or access the \fBuc_mcontext\fR member
-of \fBucontext_t\fR. A portable application cannot assume that context
-includes any process-wide static data, possibly including \fBerrno\fR. Users
-manipulating contexts should take care to handle these explicitly when
+context is created.
+If the thread leaves the signal handler via
+.Xr longjmp 3C ,
+then it is unspecified whether the context at the time of the corresponding
+.Xr setjmp 3C
+call is restored and thus whether future calls to
+.Fn getcontext
+will provide an accurate representation of the current context, since the
+context restored by
+.Xr longjmp 3C
+may not contain all the information that
+.Fn setcontext
+requires.
+Signal handlers should use
+.Xr siglongjmp 3C
+instead.
+.Pp
+Portable applications should not modify or access the
+.Fa uc_mcontext
+member of
+.Vt ucontext_t .
+A portable application cannot assume that context includes any process-wide
+static data, possibly including
+.Va errno .
+Users manipulating contexts should take care to handle these explicitly when
required.
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(7) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability Standard
-.TE
-
-.SH SEE ALSO
-.LP
-.BR sigaction (2),
-.BR sigaltstack (2),
-.BR sigprocmask (2),
-.BR bsd_signal (3C),
-.BR makecontext (3C),
-.BR setjmp (3C),
-.BR sigsetjmp (3C),
-.BR ucontext.h (3HEAD),
-.BR attributes (7),
-.BR standards (7)
+.Sh INTERFACE STABILITY
+.Sy Committed
+.Sh SEE ALSO
+.Xr sigaction 2 ,
+.Xr sigaltstack 2 ,
+.Xr sigprocmask 2 ,
+.Xr bsd_signal 3C ,
+.Xr makecontext 3C ,
+.Xr setjmp 3C ,
+.Xr sigsetjmp 3C ,
+.Xr ucontext.h 3HEAD ,
+.Xr attributes 7 ,
+.Xr standards 7
diff --git a/usr/src/man/man8/sharemgr.8 b/usr/src/man/man8/sharemgr.8
index ba49873211..2d66095c23 100644
--- a/usr/src/man/man8/sharemgr.8
+++ b/usr/src/man/man8/sharemgr.8
@@ -1,793 +1,835 @@
-'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright 2016 Nexenta Systems, Inc. All rights reserved.
-.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
-.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
-.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH SHAREMGR 8 "November 22, 2021"
-.SH NAME
-sharemgr \- configure and manage file sharing
-.SH SYNOPSIS
-.nf
-\fBsharemgr\fR \fIsubcommand\fR [\fIoptions\fR]
-.fi
-
-.LP
-.nf
-\fBadd-share\fR [\fB-nth\fR] [\fB-r\fR \fIresource-name\fR] [\fB-d\fR "\fIdescription text\fR"]
- \fB-s\fR \fIsharepath\fR \fIgroup\fR
-.fi
-
-.LP
-.nf
-\fBcreate\fR [\fB-nvh\fR] [\fB-P\fR \fIproto\fR [\fB-p\fR \fIproperty\fR=\fIvalue\fR]] \fIgroup\fR
-.fi
-
-.LP
-.nf
-\fBdelete\fR [\fB-nvh\fR] [\fB-P\fR \fIproto\fR] [\fB-f\fR] \fIgroup\fR
-.fi
-
-.LP
-.nf
-\fBdisable\fR [\fB-nvh\fR] [\fB-a\fR | \fIgroup\fR...]
-.fi
-
-.LP
-.nf
-\fBenable\fR [\fB-nvh\fR] [\fB-a\fR | \fIgroup\fR...]
-.fi
-
-.LP
-.nf
-\fBlist\fR [\fB-vh\fR] [\fB-P\fR \fIproto\fR]
-.fi
-
-.LP
-.nf
-\fBmove-share\fR [\fB-nv\fR] \fB-s\fR \fIsharepath\fR \fIdestination-group\fR
-.fi
-
-.LP
-.nf
-\fBremove-share\fR [\fB-fnvh\fR] \fB-s\fR \fIsharepath\fR \fIgroup\fR
-.fi
-
-.LP
-.nf
-\fBset\fR [\fB-nvh\fR] \fB-P\fR \fIproto\fR [\fB-p\fR \fIproperty\fR=\fIvalue\fR]... [\fB-S\fR \fIoptionset\fR]
- [\fB-s\fR \fIsharepath\fR] \fIgroup\fR
-.fi
-
-.LP
-.nf
-\fBset-share\fR [\fB-nh\fR] [\fB-r\fR \fIresource\fR] [\fB-d\fR "\fIdescription text\fR"]
- \fB-s\fR \fIsharepath\fR \fIgroup\fR
-.fi
-
-.LP
-.nf
-\fBshow\fR [\fB-pvxh\fR] [\fB-P\fR \fIproto\fR] [\fIgroup\fR]...
-.fi
-
-.LP
-.nf
-\fBunset\fR [\fB-nvh\fR] \fB-P\fR \fIproto\fR [\fB-S\fR \fIoptionset\fR] [\fB-p\fR \fIproperty\fR]...
- \fIgroup\fR
-.fi
-
-.LP
-.nf
-\fBshare\fR [\fB-F\fR \fIfstype\fR] [\fB-p\fR] [\fB-o\fR \fIoptionlist\fR] [\fB-d\fR \fIdescription\fR]
- [\fIpathname\fR [\fIresourcename\fR]]
-.fi
-
-.LP
-.nf
-\fBunshare\fR [\fB-F\fR \fIfstype\fR] [\fB-p\fR] [\fB-o\fR \fIoptionlist\fR] \fIsharepath\fR
-.fi
-
-.SH DESCRIPTION
-The \fBsharemgr\fR command configures share groups and the shares contained
-within them.
-.sp
-.LP
-A group name must conform to service management facility (SMF) (see
-\fBsmf\fR(7)) service-naming conventions, thus is limited to starting with an
+.\" Copyright 2022 Jason King
+.\"
+.\" The contents of this file are subject to the terms of the
+.\" Common Development and Distribution License (the "License").
+.\" You may not use this file except in compliance with the License.
+.\"
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+.\" or http://www.opensolaris.org/os/licensing.
+.\" See the License for the specific language governing permissions
+.\" and limitations under the License.
+.\"
+.\" When distributing Covered Code, include this CDDL HEADER in each
+.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+.\" If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying
+.\" information: Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.Dd October 10, 2022
+.Dt SHAREMGR 8
+.Os
+.Sh NAME
+.Nm sharemgr
+.Nd configure and manage file sharing
+.Sh SYNOPSIS
+.Nm Cm subcommand Op options
+.Nm Cm add-share \
+ Oo Fl nth Oc \
+ Oo Fl r Ar resource-name Oc \
+ Oo Fl d Ar \(dqdescription\0text\(dq Oc
+.Nm Cm create \
+ Oo Fl nvh Oc \
+ Oo Fl P Ar proto \
+ Oo Fl p Ar property Ns = Ns Ar value Oc \
+ Oc \
+ Ar group
+.Nm Cm delete \
+ Oo Fl nvh Oc \
+ Oo Fl P Ar proto Oc \
+ Oo Fl f Oc \
+ Ar group
+.Nm Cm disable \
+ Oo Fl nvh Oc \
+ Oo Fl a | Ar group Ns ... Oc
+.Nm Cm enable \
+ Oo Fl nvh Oc \
+ Oo Fl a | Ar group Ns ... Oc
+.Nm Cm list \
+ Oo Fl vh Oc \
+ Oo Fl P Ar proto Oc
+.Nm Cm move-share \
+ Oo Fl nv Oc \
+ Fl s Ar sharepath Ar destination-group
+.Nm Cm remove-share \
+ Oo Fl fnvh Oc \
+ Fl s Ar sharepath Ar group
+.Nm Cm set \
+ Oo Fl nvh Oc \
+ Fl P Ar proto \
+ Oo Fl p Ar property Ns = Ns Ar Value Oc Ns ... \
+ Oo Fl S Ar optionset Oc \
+ Oo Fl s Ar sharepath Oc \
+ Ar group
+.Nm Cm set-share \
+ Oo Fl nh Oc \
+ Oo Fl r Ar resource Oc \
+ Oo Fl d Ar \(dqdescription\0text\(dq Oc \
+ Fl s Ar sharepath \
+ Ar group
+.Nm Cm show \
+ Oo Fl pvxh Oc \
+ Oo Fl P Ar proto Oc \
+ Oo Ar group Ns ... Oc
+.Nm Cm unset \
+ Oo Fl nvh Oc \
+ Fl P Ar proto \
+ Oo Fl S Ar optionset Oc \
+ Oo Fl p Ar property Oc Ns ... \
+ Ar group
+.Nm Cm share \
+ Oo Fl F Ar fstype Oc \
+ Oo Fl p Oc \
+ Oo Fl o Ar optionlist Oc \
+ Oo Fl d Ar description Oc \
+ Oo Ar pathname Oo Ar resourcename Oc Oc
+.Nm Cm unshare \
+ Oo Fl F Ar fstype Oc \
+ Oo Fl p Oc \
+ Oo Fl o Ar optionlist Oc \
+ Ar sharepath
+.Sh DESCRIPTION
+The
+.Nm
+command configures share groups and the shares contained within them.
+.Pp
+A group name must conform to service management facility (SMF)
+.Po
+see
+.Xr smf 7
+.Pc
+service-naming conventions, thus is limited to starting with an
alphabetic character, with the rest of the name consisting only of alphanumeric
-characters plus \fB-\fR (hyphen) and \fB_\fR (underbar).
-.sp
-.LP
+characters plus
+.Ql \(hy
+(hyphen) and
+.Ql \(ru
+(underbar).
+.Pp
Subcommands that result in a configuration change support a dry-run option.
-When dry-run (\fB-n\fR) is specified, the syntax and validity of the command is
+When dry-run
+.Pq Fl n
+is specified, the syntax and validity of the command is
tested but the configuration is not actually updated.
-.sp
-.LP
-For all subcommands, the \fB-h\fR option lists usage and help information.
-.sp
-.LP
-For subcommands with the verbose (\fB-v\fR) option, additional information will
-be provided. For example, in conjunction with the \fB-n\fR option, verbose mode
-will also indicate whether the current user has sufficient permissions to
-accomplish the operation.
-.sp
-.LP
-There are two groups that are created automatically. The \fBdefault\fR group
-always exists and covers legacy NFS shares only. The \fBzfs\fR group will be
-created when ZFS shares are enabled.
-.sp
-.LP
-The options shown in the SYNOPSIS section are described in the context of each
-subcommand. All subcommands except \fBlist\fR and \fBshow\fR require root
-privileges or that you assume the Primary Administrator role.
-.SS "Subcommands"
-With no subcommand entered, a \fBsharemgr\fR command with the \fB-h\fR option
-displays a usage message for all subcommands.
-.sp
-.LP
-The following subcommands follow \fBsharemgr\fR on a command line. Commands
-take the form:
-.sp
-.in +2
-.nf
+.Pp
+For all subcommands, the
+.Fl h
+option lists usage and help information.
+.Pp
+For subcommands with the verbose
+.Pq Fl v
+option, additional information will be provided.
+For example, in conjunction with the
+.Fl n
+option, verbose mode will also indicate whether the current user has
+sufficient permissions to accomplish the operation.
+.Pp
+There are two groups that are created automatically.
+The
+.Sy default
+group always exists and covers legacy NFS shares only.
+The
+.Sy zfs
+group will be created when ZFS shares are enabled.
+.Pp
+The options shown in the
+.Sx SYNOPSIS
+section are described in the context of each subcommand.
+All subcommands except
+.Cm list
+and
+.Cm show
+require root privileges or that you assume the Primary Administrator role.
+.Ss "Subcommands"
+With no subcommand entered, a
+.Nm
+command with the
+.Fl h
+option displays a usage message for all subcommands.
+.Pp
+The following subcommands follow
+.Nm
+on a command line.
+Commands take the form:
+.Bd -literal -offset 2n
% \fBsharemgr \fI<subcommand>\fR [\fIoptions\fR]\fR
-.fi
-.in -2
-.sp
-
-.sp
-.ne 2
-.na
-\fB\fBcreate\fR \fB[-nvh] [-P \fIproto\fR [-p \fIproperty\fR=\fIvalue\fR]]
-\fIgroup\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Ed
+.Bl -tag -width "1"
+.It Cm create \
+ Oo Fl nvh Oc \
+ Oo Fl P Ar proto Oo \
+ Fl p Ar property Ns = Ns Ar value \
+ Oc Oc \
+ Ar group
+.Pp
Create a new group with specified name.
-.sp
-If \fB-n\fR is specified, the command checks only the validity of the command
+.Pp
+If
+.Fl n
+is specified, the command checks only the validity of the command
and that the group does not already exist.
-.sp
+.Pp
If no protocol is specified, all known protocols are enabled for the specified
-group. If a protocol is specified, only that protocol is enabled. You can
-specify properties for a specified protocol.
-.sp
-If \fIgroup\fR exists, use of \fB-P\fR adds the specified protocol to that
group.
-.sp
-As an example of the \fBcreate\fR subcommand, the following command creates a
-new group with the name \fBmygroup\fR.
-.sp
-.in +2
-.nf
+If a protocol is specified, only that protocol is enabled.
+You can specify properties for a specified protocol.
+.Pp
+If
+.Ar group
+exists, use of
+.Fl P
+adds the specified protocol to that group.
+.Pp
+As an example of the
+.Cm create
+subcommand, the following command creates a new group with the name
+.Ar mygroup .
+.Bd -literal -offset 2n
# \fBsharemgr create mygroup\fR
-.fi
-.in -2
-.sp
-
+.Ed
+.Pp
Because no protocol was specified in the preceding command, all defined
protocols will be enabled on the group.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBdelete\fR \fB[-nvh] [-P \fIproto\fR] [-f] \fIgroup\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Delete the specified group. If the group is not empty, you can use the \fB-f\fR
+.It Cm delete \
+ Oo Fl nvh Oc \
+ Oo Fl P Ar proto Oc \
+ Oo Fl f Oc \
+ Ar group
+.Pp
+Delete the specified group.
+If the group is not empty, you can use the
+.Fl f
option to force the deletion, which unshares and removes all shares from the
group before removing the group itself.
-.sp
+.Pp
If you specify a protocol, rather than deleting the whole group, this
subcommand deletes the protocol from the group.
-.sp
-The \fB-n\fR option can be used to test the syntax of the command.
-.sp
-As an example, the following command removes the group \fBmygroup\fR from the
-configuration if it is empty.
-.sp
-.in +2
-.nf
+.Pp
+The
+.Fl n
+option can be used to test the syntax of the command.
+.Pp
+As an example, the following command removes the group
+.Ar mygroup
+from the configuration if it is empty.
+.Bd -literal -offset 2n
# \fBsharemgr delete mygroup\fR
-.fi
-.in -2
-.sp
-
+.Ed
+.Pp
The following command removes any existing shares prior to removing the group.
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
# \fBsharemgr delete -f mygroup\fR
-.fi
-.in -2
-.sp
-
-Note the use of the force (\fB-f\fR) option, above.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBlist\fR \fB[-vh] [-P \fIproto\fR]\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Ed
+.Pp
+Note the use of the force
+.Pq Fl f
+option, above.
+.It Cm list \
+ Oo Fl vh Oc \
+ Oo Fl P Ar proto Oc
+.Pp
List the defined groups.
-.sp
+.Pp
If a protocol is specified, list only those groups that have the specified
protocol defined.
-.sp
+.Pp
If the verbose option is specified, the current state of the group and all
-protocols enabled on the group are listed as well. For example:
-.sp
-.in +2
-.nf
+protocols enabled on the group are listed as well.
+For example:
+.Bd -literal -offset 2n
# \fBsharemgr list -v\fR
mygroup enabled nfs
rdonlygrp disabled nfs
-.fi
-.in -2
-.sp
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBshow\fR \fB[-pvxh] [-P \fIproto\fR] [\fIgroup\fR...]\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Ed
+.It Cm show \
+ Oo Fl pvxh Oc \
+ Oo Fl P Ar proto Oc \
+ Oo Ar group Ns ... Oc
+.Pp
Shows the contents of the specified group(s).
-.sp
+.Pp
If the verbose option is specified, the resource name and description of each
-share is displayed if they are defined. Otherwise, only the share paths are
-displayed. Also, when temporary shares are listed, they are prefixed with an
-asterisk (\fB*\fR).
-.sp
-If the \fB-p\fR option is specified, all options defined for the protocols of
-the group are displayed, in addition to the display without options. If the
-\fB-P\fR option is used, the output is limited to those groups that have the
-specified protocol enabled. If the \fB-x\fR option is specified, output is in
-XML format and the \fB-p\fR and \fB-v\fR options are ignored, because all
-information is included in the XML.
-.sp
-The following example illustrates the use of the \fB-p\fR option.
-.sp
-.in +2
-.nf
+share is displayed if they are defined.
+Otherwise, only the share paths are
+displayed.
+Also, when temporary shares are listed, they are prefixed with an asterisk
+.Pq Ql * .
+.Pp
+If the
+.Fl p
+option is specified, all options defined for the protocols of
+the group are displayed, in addition to the display without options.
+If the
+.Fl P
+option is used, the output is limited to those groups that have the
+specified protocol enabled.
+If the
+.Fl x
+option is specified, output is in XML format and the
+.Fl p
+and
+.Fl v
+options are ignored, because all information is included in the XML.
+.Pp
+The following example illustrates the use of the
+.Fl p
+option.
+.Bd -literal -offset 2n
# \fBsharemgr show -p mygroup\fR
default nfs=()
* /data/backup
mygroup nfs=(nosuid=true)
/export/home/home0
/export/home/home1
-.fi
-.in -2
-.sp
-
-The following example illustrates the use of the \fB-v\fR option.
-.sp
-.in +2
-.nf
+.Ed
+.Pp
+The following example illustrates the use of the
+.Fl v
+option.
+.Bd -literal -offset 2n
# \fBsharemgr show -v mygroup\fR
mygroup
HOME0=/export/home/home0 "Home directory set 0"
HOME1=/export/home/home1 "Home directory set 1"
-.fi
-.in -2
-.sp
-
+.Ed
+.Pp
ZFS managed shares are handled in a way similar to the way NFS shares are
-handled. These shares appear as subgroups within the parent group \fBzfs\fR.
-The subgroups are always prefixed with \fBzfs/\fR and use the ZFS dataset name
-for the rest of the name. The mount point and any sub-mounts that inherit
-sharing are shown as the shares of the subgroup. For example:
-.sp
-.in +2
-.nf
+handled.
+These shares appear as subgroups within the parent group
+.Sy zfs .
+The subgroups are always prefixed with
+.Sy zfs/
+and use the ZFS dataset name for the rest of the name.
+The mount point and any sub-mounts that inherit
+sharing are shown as the shares of the subgroup.
+For example:
+.Bd -literal -offset 2n
# \fBsharemgr show -vp zfs\fR
zfs nfs=()
zfs/ztest
/ztest
/ztest/backups
-.fi
-.in -2
-.sp
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBset\fR \fB[-nvh] -P \fIproto\fR [-S \fIoptionset\fR] [-p
-\fIproperty\fR=\fIvalue\fR]* [-s \fIshare path\fR] \fIgroup\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Ed
+.It Cm set \
+ Oo Fl nvh Oc \
+ Fl P Ar proto \
+ Oo Fl S Ar optionset Oc \
+ Oo Fl p Ar property Ns = Ar value Oc Ns ... \
+ Oo Fl s Ar sharepath Oc \
+ Ar group
+.Pp
Set protocol-specific properties on the specified group.
-.sp
-The \fB-P\fR option is required and must specify a valid protocol.
-.sp
+.Pp
+The
+.Fl P
+option is required and must specify a valid protocol.
+.Pp
Optionsets are protocol-specific sets of properties that can be negotiated by
-the protocol client. For NFS, optionsets are equivalent to security modes as
-defined in \fBnfssec\fR(7). If \fB-S\fR \fIoptionset\fR is specified, the
-properties are applied to the selected optionset. Otherwise they are applied to
-the general optionset.
-.sp
-Together, \fB-P\fR and \fB-S\fR select a specific view of the group's options
-on which to work.
-.sp
-Property values are strings. A specified property is set to a new value if the
+the protocol client.
+For NFS, optionsets are equivalent to security modes as defined in
+.Xr nfssec 7 .
+If
+.Fl S Ar optionset
+is specified, the properties are applied to the selected optionset.
+Otherwise they are applied to the general optionset.
+.Pp
+Together,
+.Fl P
+and
+.Fl S
+select a specific view of the group's options on which to work.
+.Pp
+Property values are strings.
+A specified property is set to a new value if the
property already exists or is added to the protocol if it does not already
exist.
-.sp
-In the general case, at least one property must be set. If \fB-S\fR is
-specified, properties can be omitted and the specified optionset is enabled for
-the protocol.
-.sp
-The \fB-s\fR option allows setting properties on a per-share basis. While this
-is supported, it should be limited to managing legacy shares and to the
-occasional need for an override of a group-level property or placing an
+.Pp
+In the general case, at least one property must be set.
+If
+.Fl S
+is specified, properties can be omitted and the specified optionset is enabled
+for the protocol.
+.Pp
+The
+.Fl s
+option allows setting properties on a per-share basis.
+While this is supported, it should be limited to managing legacy shares and to
+the occasional need for an override of a group-level property or placing an
additional property on one share within a group.
-.sp
+.Pp
An example of this subcommand:
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
# \fBsharemgr set -P nfs -p anon=1234 mygroup\fR
-.fi
-.in -2
-.sp
-
-The preceding command adds the property \fBanon=1234\fR to the \fBnfs\fR view
-of group \fBmygroup\fR. If \fBmygroup\fR has existing shares, they will all be
-reshared with the new property value(s).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBunset\fR \fB[-nvh] -P proto [-S \fIoptionset\fR] [-p \fIproperty\fR]* [-s
-\fIsharepath\fR ] \fIgroup\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Ed
+.Pp
+The preceding command adds the property
+.Sy anon=1234
+to the
+.Sy nfs
+view of group
+.Ar mygroup .
+If
+.Ar mygroup
+has existing shares, they will all be reshared with the new property value(s).
+.It Cm unset \
+ Oo Fl nvh Oc \
+ Fl P Ar proto \
+ Oo Fl S Ar optionset Oc \
+ Oo Fl p Ar property Oc Ns ... \
+ Oo Fl s Ar sharepath Oc \
+ Ar group
+.Pp
Unset the specified properties for the protocol or for the specified
-\fIoptionset\fR of the protocol.
-.sp
-In the general case, at least one property must be set. If \fB-S\fR is
-specified, properties can be omitted and the specified optionset is removed
+.Ar optionset
+of the protocol.
+.Pp
+In the general case, at least one property must be set.
+If
+.Fl S
+is specified, properties can be omitted and the specified optionset is removed
from the protocol.
-.sp
-The \fB-s\fR option allows removing a share-specific property.
-.sp
+.Pp
+The
+.Fl s
+option allows removing a share-specific property.
+.Pp
An example of this subcommand:
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
# \fBsharemgr unset -P nfs -p anon mygroup\fR
-.fi
-.in -2
-.sp
-
-The preceding command removes the \fBanon=\fR property from the \fBnfs\fR view
-of group \fBmygroup\fR. If \fBmygroup\fR has existing shares, they will all be
-reshared with the new property value(s).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBadd-share\fR \fB[-nth] [-r \fIresource-name\fR] [-d "\fIdescription
-text\fR"] -s \fIsharepath\fR \fIgroup\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Ed
+.Pp
+The preceding command removes the
+.Ar anon=
+property from the
+.Sy nfs
+view of group
+.Ar mygroup .
+If
+.Ar mygroup
+has existing shares, they will all be reshared with the new property value(s).
+.It Cm add-share \
+ Oo Fl nth Oc \
+ Oo Fl r Ar resource-name Oc \
+ Oo Fl d Ar \(dqdescription text\(dq Oc \
+ Fl s Ar sharepath \
+ Ar group
+.Pp
Add a new share to the specified group.
-.sp
-The \fB-s\fR option is mandatory and takes a full directory path.
-.sp
-If either or both of \fB-d\fR and \fB-r\fR are specified, they specify values
-associated with the share. \fB-d\fR provides a description string to document
-the share and \fB-r\fR provides a protocol-independent resource name. Resource
-names are not used by NFS at this time but can be specified. These names
-currently follow the same naming rules as group names.
-.sp
-The temporary option (\fB-t\fR) results in the share being shared but not
-stored in the configuration repository. This option is intended for shares that
+.Pp
+The
+.Fl s
+option is mandatory and takes a full directory path.
+.Pp
+If either or both of
+.Fl d
+and
+.Fl r
+are specified, they specify values associated with the share.
+.Fl d
+provides a description string to document the share and
+.Fl r
+provides a protocol-independent resource name.
+Resource names are not used by NFS at this time but can be specified.
+These names currently follow the same naming rules as group names.
+.Pp
+The temporary option
+.Pq Fl t
+results in the share being shared but not
+stored in the configuration repository.
+This option is intended for shares that
should not survive a reboot or server restart, or for testing purposes.
-Temporary shares are indicated in the \fBshow\fR subcommand output with an
-asterisk (\fB*\fR) preceding the share.
-.sp
-If \fIsharepath\fR is a ZFS path and that path is added to the \fBzfs\fR group,
-\fBsharemgr\fR creates a new ZFS subgroup; the new share is added to that
-subgroup. Any ZFS sub-filesystems under the ZFS filesystem designated by
-\fIsharepath\fR will inherit the shared status of \fIsharepath\fR.
-.sp
-The effect of the \fBadd-share\fR subcommand on a ZFS dataset is determined by
-the values of the \fBsharesmb\fR and \fBsharenfs\fR properties of that dataset.
-.sp
-See \fBzfs\fR(8) for a description of the \fBsharesmb\fR and \fBsharenfs\fR
+Temporary shares are indicated in the
+.Cm show
+subcommand output with an asterisk
+.Pq Ql *
+preceding the share.
+.Pp
+If
+.Ar sharepath
+is a ZFS path and that path is added to the
+.Ar zfs
+group,
+.Nm
+creates a new ZFS subgroup; the new share is added to that subgroup.
+Any ZFS sub-filesystems under the ZFS filesystem designated by
+.Ar sharepath
+will inherit the shared status of
+.Ar sharepath .
+.Pp
+The effect of the
+.Cm add-share
+subcommand on a ZFS dataset is determined by the values of the
+.Sy sharesmb
+and
+.Sy sharenfs
+properties of that dataset.
+.Pp
+See
+.Xr zfs 8
+for a description of the
+.Sy sharesmb
+and
+.Sy sharenfs
properties.
-.sp
-The following are examples of the \fBadd-share\fR subcommand.
-.sp
-.in +2
-.nf
+.Pp
+The following are examples of the
+.Cm add-share
+subcommand.
+.Bd -literal -offset 2n
# \fBsharemgr add-share -s /export/home/home0 -d "home \e
directory set 0" -r HOME0 mygroup\fR
# \fBsharemgr add-share -s /export/home/home1 -d "home \e
directory set 1" -r HOME1 mygroup\fR
-.fi
-.in -2
-.sp
-
-The preceding commands add \fB/export/home/home0\fR and
-\fB/export/home/home1\fR to the group \fBmygroup\fR. A descriptive comment and
-a resource name are included.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBmove-share\fR \fB[-nvh] -s \fIsharepath\fR \fIdestination-group\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Ed
+.Pp
+The preceding commands add
+.Pa /export/home/home0
+and
+.Pa /export/home/home1
+to the group
+.Ar mygroup .
+A descriptive comment and a resource name are included.
+.It Cm move-share \
+ Oo Fl nvh Oc \
+ Fl s Ar sharepath \
+ Ar destination-group
+.Pp
Move the specified share from the group it is currently in to the specified
-destination group. The \fBmove-share\fR subcommand does not create a group. A
-specified group must exist for the command to succeed.
-.sp
+destination group.
+The
+.Cm move-share
+subcommand does not create a group.
+A specified group must exist for the command to succeed.
+.Pp
The following is an example of this subcommand.
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
# \fBsharemgr move-share -s /export/home/home1 newgroup\fR
-.fi
-.in -2
-.sp
-
-Assuming \fB/export/home/home1\fR is in the group \fBmygroup\fR, the preceding
-command moves \fB/export/home/home1\fR to the group \fBnewgroup\fR and unshares
-and then reshares the directory with the properties associated with
-\fBnewgroup\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBremove-share\fR \fB[-fnvh] -s \fIsharepath\fR \fIgroup\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Remove the specified share from the specified group. The force (\fB-f\fR)
+.Ed
+.Pp
+Assuming
+.Pa /export/home/home1
+is in the group
+.Ar mygroup ,
+the preceding command moves
+.Pa /export/home/home1
+to the group
+.Ar newgroup
+and unshares and then reshares the directory with the properties associated with
+.Ar newgroup .
+.It Cm remove-share \
+ Oo Fl fnvh Oc \
+ Fl s Ar sharepath \
+ Ar group
+.Pp
+Remove the specified share from the specified group.
+The force
+.Pq Fl f
option forces the share to be removed even if it is busy.
-.sp
-You must specify the full path for \fIsharepath\fR. For group, use the subgroup
-as displayed in the output of the \fBsharemgr show\fR command. Note that if
+.Pp
+You must specify the full path for
+.Ar sharepath .
+For group, use the subgroup as displayed in the output of the
+.Nm Cm show
+command.
+Note that if
there are subshares that were created by inheritance, these will be removed,
along with the parent shares.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBset-share\fR \fB[-nvh] [-r \fIresource\fR] [-d "\fIdescription text\fR"]
--s \fIsharepath\fR \fIgroup\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Set or change the specified share's description and resource values. One use of
-\fBset-share\fR is to rename a resource. The syntax for this use of the
-subcommand is:
-.sp
-.in +2
-.nf
+.It Cm set-share \
+ Oo Fl nvh Oc \
+ Oo Fl r resource Oc \
+ Oo Fl d Ar \(dqdescription text\(dq Oc \
+ Fl s Ar sharepath \
+ Ar group
+.Pp
+Set or change the specified share's description and resource values.
+One use of
+.Cm set-share
+is to rename a resource.
+The syntax for this use of the subcommand is:
+.Bd -literal -offset 2n
# \fBsharemgr set-share -r \fIcurrent_name\fR=\fInew_name\fR -s \fIsharepath\fR \fIgroup\fR\fR
-.fi
-.in -2
-.sp
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBenable\fR \fB[-nvh] [\fIgroup\fR... | -a]\fR\fR
-.ad
-.sp .6
-.RS 4n
-Enable the specified group(s), or (with \fB-a\fR) all groups, and start sharing
-the contained shares. This state persists across reboots.
-.sp
+.Ed
+.It Cm enable \
+ Oo Fl nvh Oc \
+ Oo Ar group Ns ... | Fl a Oc
+.Pp
+Enable the specified group(s), or
+.Po
+with
+.Fl a
+.Pc
+all groups, and start sharing the contained shares.
+This state persists across reboots.
+.Pp
An enabled group will be shared whenever the corresponding SMF service instance
-is enabled. \fBsharemgr\fR will start the SMF service instance if it is not
-currently online.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBdisable\fR \fB[-nvh] [\fIgroup\fR... | -a]\fR\fR
-.ad
-.sp .6
-.RS 4n
-Disable the specified group(s), or (with \fB-a\fR) all groups, and unshare the
-shares that they contain. This state persists across reboots.
-.sp
+is enabled.
+.Nm
+will start the SMF service instance if it is not currently online.
+.It Cm disable \
+ Oo Fl nvh Oc \
+ Oo Ar group Ns ... | Fl a Oc
+.Pp
+Disable the specified group(s), or
+.Po
+with
+.Fl a
+.Pc
+all groups, and unshare the shares that they contain.
+This state persists across reboots.
+.Pp
A disabled group will not be shared even if the corresponding SMF service
-instance is online. This feature is useful when you do not want a group of
+instance is online.
+This feature is useful when you do not want a group of
shares to be started at boot time.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBstart\fR \fB[-vh] [-P \fIproto\fR] [\fIgroup\fR... | -a]\fR\fR
-.ad
-.sp .6
-.RS 4n
-Start the specified group, or (with \fB-a\fR) all groups. The \fBstart\fR
-subcommand is similar to \fBenable\fR in that all shares are started, but
-\fBstart\fR works only on groups that are enabled. \fBstart\fR is used by the
-SMF to start sharing at system boot.
-.sp
-A group will not start sharing if it is in the \fBsharemgr\fR \fBdisabled\fR
-state. However, the corresponding SMF service instance will be started.
-.sp
-Note that the \fBstart\fR subcommand is similar to the \fBshareall\fR(8)
-command in that it starts up only the configured shares. That is, the enabled
+.It Cm start \
+ Oo Fl vh Oc \
+ Oo Fl P Ar proto Oc \
+ Oo Ar group Ns ... | Fl a Oc
+.Pp
+Start the specified group, or
+.Po
+with
+.Fl a
+.Pc
+all groups.
+The
+.Cm start
+subcommand is similar to
+.Cm enable
+in that all shares are started, but
+.Cm start
+works only on groups that are enabled.
+.Cm start
+is used by the SMF to start sharing at system boot.
+.Pp
+A group will not start sharing if it is in the
+.Nm sharemgr Em disabled
+state.
+However, the corresponding SMF service instance will be started.
+.Pp
+Note that the
+.Cm start
+subcommand is similar to the
+.Xr shareall 8
+command in that it starts up only the configured shares.
+That is, the enabled
shares will start being shared, but the configuration state is left the same.
The command:
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
# \fBsharemgr start -a\fR
-.fi
-.in -2
-.sp
-
+.Ed
+.Pp
\&...is equivalent to:
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
# \fBshareall\fR
-.fi
-.in -2
-.sp
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBstop\fR \fB[-vh] [-P \fIproto\fR] [\fIgroup\fR... | -a]\fR\fR
-.ad
-.sp .6
-.RS 4n
-Stop the specified group, or (with \fB-a\fR) all groups. The \fBstop\fR
-subcommand is similar to \fBdisable\fR in that all shares are no longer shared,
-but it works only on groups that are enabled. \fBstop\fR is used by the SMF to
-stop sharing at system shutdown.
-.sp
-Note that the \fBstop\fR subcommand is similar to the \fBunshareall\fR(8)
+.Ed
+.It Cm stop \
+ Oo Fl vh Oc \
+ Oo Fl P Ar proto Oc \
+ Oo Ar group Ns ... | Fl a Oc
+.Pp
+Stop the specified group, or
+.Po
+with
+.Fl a
+.Pc
+all groups.
+The
+.Cm stop
+subcommand is similar to
+.Cm disable
+in that all shares are no longer shared,
+but it works only on groups that are enabled.
+.Cm stop
+is used by the SMF to stop sharing at system shutdown.
+.Pp
+Note that the
+.Cm stop
+subcommand is similar to the
+.Xr unshareall 8
command in that all active shares are unshared, but the configuration is left
-the same. That is, the shares are stopped but the service instances are left
-enabled. The command:
-.sp
-.in +2
-.nf
+the same.
+That is, the shares are stopped but the service instances are left enabled.
+The command:
+.Bd -literal -offset 2n
# \fBsharemgr stop -a\fR
-.fi
-.in -2
-.sp
-
+.Ed
+.Pp
\&...is equivalent to:
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
# \fBunshareall\fR
-.fi
-.in -2
-.sp
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBshare\fR \fB[-F \fIfstype\fR] [-p] [-o \fIoptionlist\fR] [-d
-\fIdescription\fR] [\fIpathname\fR [\fIresourcename\fR]]\fR\fR
-.ad
-.sp .6
-.RS 4n
-Shares the specified path in the \fBdefault\fR share group. This subcommand
-implements the \fBshare\fR(8) functionality. Shares that are shared in this
-manner will be transient shares. Use of the \fB-p\fR option causes the shares
-to be persistent.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBunshare\fR \fB[-F \fIfstype\fR] [-p] [-o \fIoptionlist\fR]
-\fIsharepath\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Unshares the specified share. This subcommand implements the \fBunshare\fR(8)
-functionality. By default, the \fBunshare\fR is temporary. The \fB-p\fR option
+.Ed
+.It Cm share \
+ Oo Fl F Ar fstype Oc \
+ Oo Fl p Oc \
+ Oo Fl o Ar optionlist Oc \
+ Oo Fl d Ar descriptoion Oc \
+ Oo Ar pathname Oo Ar resoucename Oc Oc
+.Pp
+Shares the specified path in the
+.Ar default
+share group.
+This subcommand implements the
+.Xr share 8
+functionality.
+Shares that are shared in this manner will be transient shares.
+Use of the
+.Fl p
+option causes the shares to be persistent.
+.It Cm unshare \
+ Oo Fl F Ar fstype Oc \
+ Oo Fl p Oc \
+ Oo Fl o Ar optionlist Oc \
+ Ar sharepath
+.Pp
+Unshares the specified share.
+This subcommand implements the
+.Xr unshare 8
+functionality.
+By default, the
+.Cm unshare
+is temporary.
+The
+.Fl p
+option
is provided to remove the share from the configuration in a way that persists
across reboots.
-.RE
-
-.SS "Supported Properties"
-Properties are protocol-specific. Currently, only the NFS and SMB protocols are
-supported. Properties have the following characteristics:
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Values of type \fIboolean\fR take either \fBtrue\fR or \fBfalse\fR.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Values of type \fIvalue\fR take a numeric value.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Values of type \fIfile\fR take a file name and not a file path.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-Values of type \fIaccess-list\fR are described in detail following the
-descriptions of the NFS properties.
-.RE
-.sp
-.LP
+.El
+.Ss "Supported Properties"
+Properties are protocol-specific.
+Currently, only the NFS and SMB protocols are supported.
+Properties have the following characteristics:
+.Bl -bullet -offset indent
+.It
+Values of type
+.Sy boolean
+take either
+.Sy true
+or
+.Sy false .
+.It
+Values of type
+.Sy value
+take a numeric value.
+.It
+Values of type
+.Sy file
+take a file name and not a file path.
+.It
+Values of type
+.Sy access-list
+are described in detail following the descriptions of the NFS properties.
+.El
+.Pp
The general properties supported for NFS are:
-.sp
-.ne 2
-.na
-\fB\fBabe=\fR\fIboolean\fR\fR
-.ad
-.sp .6
-.RS 4n
-Set the access-based enumeration (ABE) policy for a share. When set to
-\fBtrue\fR, ABE filtering is enabled on this share and directory entries to
+.Bl -tag -width 1
+.It Cm abe Ns = Ns Ar boolean
+.Pp
+Set the access-based enumeration (ABE) policy for a share.
+When set to
+.Ql true ,
+ABE filtering is enabled on this share and directory entries to
which the requesting user has no access will be omitted from directory listings
-returned to the client. When set to \fBfalse\fR or not defined, ABE filtering
-will not be performed on this share. This property is not defined by default.
-.sp
-.ne 2
-.na
-\fB\fBdisabled\fR\fR
-.ad
-.sp .6
-.RS 4n
+returned to the client.
+When set to
+.Ql false
+or not defined, ABE filtering will not be performed on this share.
+This property is not defined by default.
+.Bl -tag -width disabled
+.It false
Disable ABE for this share.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBenabled\fR\fR
-.ad
-.sp .6
-.RS 4n
+.It true
Enable ABE for this share.
-.RE
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBaclok=\fIboolean\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
+.El
+.It Cm aclok Ns = Ns Ar boolean
+.Pp
Allows the NFS server to do access control for NFS Version 2 clients (running
-SunOS 2.4 or earlier). When \fBaclok\fR is set on the server, maximum access is
-given to all clients. For example, with \fBaclok\fR set, if anyone has read
-permissions, then everyone does. If \fBaclok\fR is not set, minimum access is
-given to all clients.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBad-container\fR\fR
-.ad
-.sp .6
-.RS 4n
+SunOS 2.4 or earlier).
+When
+.Cm aclok
+is set on the server, maximum access is given to all clients.
+For example, with
+.Cm aclok
+set, if anyone has read permissions, then everyone does.
+If
+.Cm aclok
+is not set, minimum access is given to all clients.
+.It Cm ad-container
+.Pp
Specifies the AD container in which to publish shares.
-.sp
+.Pp
The AD container is specified as a comma-separated list of attribute name-value
pairs using the LDAP distinguished name (DN) or relative distinguished name
-(RDN) format. The DN or RDN must be specified in LDAP format using the
-\fBcn=\fR, \fBou=\fR, and \fBdc=\fR prefixes:
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBcn\fR represents the common name
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBou\fR represents the organizational unit
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBdc\fR represents the domain component
-.RE
-\fBcn=\fR, \fBou=\fR and \fBdc=\fR are attribute types. The attribute type used
+(RDN) format.
+The DN or RDN must be specified in LDAP format using the
+.Ar cn= ,
+.Ar ou= ,
+and
+.Ar dc=
+prefixes:
+.Bl -bullet -offset indent
+.It
+.Cm cn
+represents the common name
+.It
+.Cm ou
+represents the organizational unit
+.It
+.Cm dc
+represents the domain component
+.El
+.Pp
+.Cm cn= ,
+.Cm ou= ,
+and
+.Cm dc=
+are attribute types.
+The attribute type used
to describe an object's RDN is called the naming attribute, which, for ADS,
includes the following object classes:
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBcn\fR for the \fBuser\fR object class
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBou\fR for the organizational unit (\fBOU\fR) object class
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBdc\fR for the \fBdomainDns\fR object class
-.RE
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBanon=\fIuid\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Set \fIuid\fR to be the effective user ID of unknown users. By default, unknown
-users are given the effective user ID \fBUID_NOBODY\fR. If uid is set to
-\fB-1\fR, access is denied.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBcatia=\fIboolean\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Bl -bullet -offset indent
+.It
+.Cm cn
+for the
+.Sy user
+object class
+.It
+.Cm ou
+for the organizational unit
+.Pq Cm OU
+object class
+.It
+.Cm dc
+for the
+.Cm domainDns
+object class
+.El
+.It Cm anon Ns = Ns Ar uid
+.Pp
+Set
+.Ar uid
+to be the effective user ID of unknown users.
+By default, unknown users are given the effective user ID
+.Dv UID_NOBODY .
+If uid is set to
+.Sy -1 ,
+access is denied.
+.It Cm catia Ns = Ns Ar boolean
+.Pp
CATIA V4 uses characters in file names that are considered to be invalid by
-Windows. CATIA V5 is available on Windows. A CATIA V4 file could be
+Windows.
+CATIA V5 is available on Windows.
+A CATIA V4 file could be
inaccessible to Windows clients if the file name contains any of the characters
-that are considered illegal in Windows. By default, CATIA character
-substitution is not performed.
-.sp
-If the \fBcatia\fR property is set to true, the following character
+that are considered illegal in Windows.
+By default, CATIA character substitution is not performed.
+If the
+.Cm catia
+property is set to true, the following character
substitution is applied to file names.
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
CATIA CATIA
V4 UNIX V5 Windows
" \e250 0x00a8 Dieresis
@@ -799,541 +841,448 @@ V4 UNIX V5 Windows
? \e277 0x00bf Inverted Question Mark
\e \e377 0x00ff Latin Small Letter Y with Dieresis
| \e246 0x00a6 Broken Bar
-.fi
-.in -2
-.sp
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBcksum=\fIcksumlist\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Set the share to attempt to use end-to-end checksums. The value \fIcksumlist\fR
+.Ed
+.It Cm cksum Ns = Ns Ar cksumlist
+.Pp
+Set the share to attempt to use end-to-end checksums.
+The value
+.Ar cksumlist
specifies the checksum algorithms that should be used.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBcsc=\fR\fIvalue\fR\fR
-.ad
-.sp .6
-.RS 4n
-Set the client-side caching policy for a share. Client-side caching is a client
+.It Cm csc Ns = Ns Ar value
+.Pp
+Set the client-side caching policy for a share.
+Client-side caching is a client
feature and offline files are managed entirely by the clients.
-.sp
-.LP
-The following are valid values for the \fBcsc\fR property:
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBmanual\fR \fB-\fR Clients are permitted to cache files from the specified
-share for offline use as requested by users. However, automatic file-by-file
-reintegration is not permitted. \fBmanual\fR is the default value.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBauto\fR \fB-\fR Clients are permitted to automatically cache files from the
+.Pp
+The following are valid values for the
+.Cm csc
+property:
+.Bl -tag -width disabled -offset indent
+.It Sy manual
+Clients are permitted to cache files from the specified
+share for offline use as requested by users.
+However, automatic file-by-file reintegration is not permitted.
+.Sy manual
+is the default value.
+.It Sy auto
+Clients are permitted to automatically cache files from the
specified share for offline use and file-by-file reintegration is permitted.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBvdo\fR \fB-\fR Clients are permitted to automatically cache files from the
+.It Sy vdo
+Clients are permitted to automatically cache files from the
specified share for offline use, file-by-file reintegration is permitted, and
clients are permitted to work from their local cache even while offline.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-\fBdisabled\fR \fB-\fR Client-side caching is not permitted for this share.
-.RE
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBguestok=\fR\fIboolean\fR\fR
-.ad
-.sp .6
-.RS 4n
-Set the guest access policy for the share. When set to \fBtrue\fR guest access
-is allowed on this share. When set to \fBfalse\fR or not defined guest access
-is not allowed on this share. This property is not defined by default.
-.sp
-An \fBidmap\fR(8) name-based rule can be used to map \fBguest\fR to any local
-username, such as \fBguest\fR or \fBnobody\fR. If the local account has a
-password in \fB/var/smb/smbpasswd\fR the guest connection will be authenticated
-against that password. Any connection made using an account that maps to the
+.It Sy disabled
+Client-side caching is not permitted for this share.
+.El
+.It Cm guestok Ns = Ns Ar boolean
+.Pp
+Set the guest access policy for the share.
+When set to
+.Sy true
+guest access is allowed on this share.
+When set to
+.Sy false
+or not defined guest access is not allowed on this share.
+This property is not defined by default.
+.Pp
+An
+.Xr idmap 8
+name-based rule can be used to map
+.Sy guest
+to any local username, such as
+.Sy guest
+or
+.Sy nobody .
+If the local account has a password in
+.Pa /var/smb/smbpasswd
+the guest connection will be authenticated against that password.
+Any connection made using an account that maps to the
local guest account will be treated as a guest connection.
-.sp
+.Pp
Example name-based rule:
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
# \fBidmap add winname:Guest unixuser:guest\fR
-.fi
-.in -2
-.sp
-
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBindex=\fIfile\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Load \fIfile\fR rather than a listing of the directory containing this file
+.Ed
+.It Cm index Ns = Ns Ar file
+.Pp
+Load
+.Ar file
+rather than a listing of the directory containing this file
when the directory is referenced by an NFS URL.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBlog=\fItag\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Enables NFS server logging for the specified system. The optional tag
-determines the location of the related log files. The tag is defined in
-\fBetc/nfs/nfslog.conf\fR. If no tag is specified, the default values
-associated with the global tag in \fBetc/nfs/nfslog.conf\fR is used. Support of
+.It Cm log Ns = Ns Ar tag
+.Pp
+Enables NFS server logging for the specified system.
+The optional tag determines the location of the related log files.
+The tag is defined in
+.Pa /etc/nfs/nfslog.conf .
+If no tag is specified, the default values
+associated with the global tag in
+.Pa /etc/nfs/nfslog.conf
+is used.
+Support of
NFS server logging is available only for NFS Version 2 and Version 3 requests.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBnosub=\fIboolean\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Prevents clients from mounting subdirectories of shared directories. For
-example, if \fB/export\fR is shared with the \fBnosub\fR option on server
-\fBwool\fR then an NFS client cannot do:
-.sp
-.in +2
-.nf
+.It Cm nosub Ns = Ns Ar boolean
+.Pp
+Prevents clients from mounting subdirectories of shared directories.
+For example, if
+.Pa /export
+is shared with the
+.Cm nosub
+option on server
+.Ql wool
+then an NFS client cannot do:
+.Bd -literal -offset 2n
# \fBmount -F nfs wool:/export/home/mnt\fR
-.fi
-.in -2
-.sp
-
-NFS Version 4 does not use the MOUNT protocol. The \fBnosub\fR option applies
-only to NFS Version 2 and Version 3 requests.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBnosuid=\fIboolean\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
+.Ed
+.Pp
+NFS Version 4 does not use the MOUNT protocol.
+The
+.Cm nosub
+option applies only to NFS Version 2 and Version 3 requests.
+.It Cm nosuid Ns = Ns Ar boolean
+.Pp
By default, clients are allowed to create files on a shared file system with
-the \fBsetuid\fR or \fBsetgid\fR mode enabled. Specifying \fBnosuid\fR causes
-the server file system to silently ignore any attempt to enable the
-\fBsetuid\fR or \fBsetgid\fR mode bits.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBpublic=\fIboolean\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Moves the location of the public file handle from root (\fB/\fR) to the
-exported directory for WebNFS-enabled browsers and clients. This option does
-not enable WebNFS service; WebNFS is always on. Only one file system per server
-can have the \fBpublic\fR property. You can apply the \fBpublic\fR property
-only to a share and not to a group.
-.RE
-
-.sp
-.LP
-NFS also supports negotiated optionsets for supported security modes. The
-security modes are documented in \fBnfssec\fR(7). The properties supported for
-these optionsets are:
-.sp
-.ne 2
-.na
-\fB\fIcharset\fR=\fIaccess-list\fR\fR
-.ad
-.sp .6
-.RS 4n
-Where \fIcharset\fR is one of: \fBeuc-cn\fR, \fBeuc-jp\fR, \fBeuc-jpms\fR,
-\fBeuc-kr\fR, \fBeuc-tw\fR, \fBiso8859-1\fR, \fBiso8859-2\fR, \fBiso8859-5\fR,
-\fBiso8859-6\fR, \fBiso8859-7\fR, \fBiso8859-8\fR, \fBiso8859-9\fR,
-\fBiso8859-13\fR, \fBiso8859-15\fR, \fBkoi8-r\fR.
-.sp
-Clients that match the \fIaccess-list\fR for one of these properties will be
+the
+.Sy setuid
+or
+.Sy setgid
+mode enabled.
+Specifying
+.Sy nosuid
+causes the server file system to silently ignore any attempt to enable the
+.Sy setuid
+or
+.Sy setgid
+mode bits.
+.It Cm public Ns = Ns Ar boolean
+.Pp
+Moves the location of the public file handle from root
+.Pq /
+to the exported directory for WebNFS-enabled browsers and clients.
+This option does not enable WebNFS service; WebNFS is always on.
+Only one file system per server can have the
+.Sy public
+property.
+You can apply the
+.Sy public
+property only to a share and not to a group.
+.El
+.Pp
+NFS also supports negotiated optionsets for supported security modes.
+The security modes are documented in
+.Xr nfssec 7 .
+The properties supported for these optionsets are:
+.Bl -tag -width 1
+.It Cm charset Ns = Ns Ar access-list
+.Pp
+Where
+.Cm charset
+is one of:
+.Sy euc-cn ,
+.Sy euc-jp ,
+.Sy euc-jpms ,
+.Sy euc-kr ,
+.Sy euc-tw ,
+.Sy iso8859-1 ,
+.Sy iso8859-2 ,
+.Sy iso8859-5 ,
+.Sy iso8859-6 ,
+.Sy iso8859-7 ,
+.Sy iso8859-8 ,
+.Sy iso8859-9 ,
+.Sy iso8859-13 ,
+.Sy iso8859-15 ,
+.Sy koi8-r .
+.Pp
+Clients that match the
+.Ar access-list
+for one of these properties will be
assumed to be using that character set and file and path names will be
converted to UTF-8 for the server.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBro=\fIaccess-list\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Sharing is read-only to the clients listed in \fIaccess-list\fR; overrides the
-\fBrw\fR suboption for the clients specified. See the description of
-\fIaccess-list\fR below.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBrw=\fIaccess-list\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Sharing is read-write to the clients listed in \fIaccess-list\fR; overrides the
-\fBro\fR suboption for the clients specified. See the description of
-\fIaccess-list\fR below.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBnone=\fIaccess-list\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Access is not allowed to any client that matches the access list. The exception
-is when the access list is an asterisk (\fB*\fR), in which case \fBro\fR or
-\fBrw\fR can override \fBnone\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBroot=\fIaccess-list\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Only root users from the hosts specified in \fIaccess-list\fR have root access.
-See details on \fIaccess-list\fR below. By default, no host has root access, so
-root users are mapped to an anonymous user ID (see the \fBanon=uid\fR option
-described above). Netgroups can be used if the file system shared is using UNIX
-authentication (\fBAUTH_SYS\fR).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBroot_mapping=\fIuid\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
+.It Cm ro Ns = Ns Ar access-list
+.Pp
+Sharing is read-only to the clients listed in
+.Ar access-list ;
+overrides the
+.Cm rw
+suboption for the clients specified.
+See the description of
+.Ar access-list
+below.
+.It Cm rw Ns = Ns Ar access-list
+.Pp
+Sharing is read-write to the clients listed in
+.Ar access-list ;
+overrides the
+.Cm ro
+suboption for the clients specified.
+See the description of
+.Ar access-list
+below.
+.It Cm none Ns = Ns Ar access-list
+.Pp
+Access is not allowed to any client that matches the access list.
+The exception
+is when the access list is an asterisk
+.Pq Ql * ,
+in which case
+.Cm ro
+or
+.Cm rw
+can override
+.Cm none .
+.It Cm root Ns = Ns Ar access-list
+.Pp
+Only root users from the hosts specified in
+.Ar access-list
+have root access.
+See details on
+.Ar access-list
+below.
+By default, no host has root access, so
+root users are mapped to an anonymous user ID (see the
+.Cm anon Ns = Ns Ar uid
+option described above).
+Netgroups can be used if the file system shared is using UNIX
+authentication
+.Pq Dv AUTH_SYS .
+.It Cm root_mapping Ns = Ns Ar uid
+.Pp
For a client that is allowed root access, map the root UID to the specified
user id.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBwindow=\fIvalue\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-When sharing with \fBsec=dh\fR (see \fBnfssec\fR(7)), set the maximum lifetime
-(in seconds) of the RPC request's credential (in the authentication header)
-that the NFS server allows. If a credential arrives with a lifetime larger than
-what is allowed, the NFS server rejects the request. The default value is 30000
-seconds (8.3 hours). This property is ignored for security modes other than
-\fBdh\fR.
-.RE
-
-.sp
-.LP
+.It Cm window Ns = Ns Ar value
+.Pp
+When sharing with
+.Cm sec Ns = Ns Sy dh
+.Po
+see
+.Xr nfssec 7
+.Pc ,
+set the maximum lifetime (in seconds) of the RPC request's credential
+(in the authentication header) that the NFS server allows.
+If a credential arrives with a lifetime larger than
+what is allowed, the NFS server rejects the request.
+The default value is 30000 seconds (8.3 hours).
+This property is ignored for security modes other than
+.Sy dh .
+.El
+.Pp
The general properties supported for SMB are:
-.sp
-.ne 2
-.na
-\fB\fBencrypt=\fR\fIstring\fR\fR
-.ad
-.sp .6
-.RS 4n
-Controls SMB3 per-share encryption. This is similar to the global smbd/encrypt
-option. For requests on a particular share, the server's behavior is controlled
+.Bl -tag -width 1
+.It Cm encrypt Ns = Ns Ar string
+.Pp
+Controls SMB3 per-share encryption.
+This is similar to the global smbd/encrypt option.
+For requests on a particular share, the server's behavior is controlled
by the stricter of this option and smbd/encrypt.
-.sp
-When set to \fBdisabled\fR, the server will not ask clients to encrypt requests.
-When set to \fBenabled\fR, the server will ask clients to encrypt requests,
-but will not require that they do so. Any message than can be encrypted
-will be encrypted.
-When set to \fBrequired\fR, the server will deny access to or disconnect
+.Pp
+When set to
+.Sy disabled ,
+the server will not ask clients to encrypt requests.
+When set to
+.Sy enabled ,
+the server will ask clients to encrypt requests,
+but will not require that they do so.
+Any message than can be encrypted will be encrypted.
+When set to
+.Sy required ,
+the server will deny access to or disconnect
any client that does not support encryption or fails to encrypt requests
that they should.
-.sp
-In other words, the \fBenabled\fR behavior is that any message that CAN
-be encrypted SHOULD be encrypted, while the \fBrequired\fR behavior is that any
-message that CAN be encrypted MUST be encrypted.
-.sp
+.Pp
+In other words, the
+.Sy enabled
+behavior is that any message that CAN
+be encrypted SHOULD be encrypted, while the
+.Sy required
+behavior is that any message that CAN be encrypted MUST be encrypted.
+.Pp
This property is not defined by default.
-.sp
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBro=\fIaccess-list\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Sharing is read-only to the clients listed in \fIaccess-list\fR; overrides the
-\fBrw\fR suboption for the clients specified. See the description of
-\fIaccess-list\fR below.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBrw=\fIaccess-list\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Sharing is read-write to the clients listed in \fIaccess-list\fR; overrides the
-\fBro\fR suboption for the clients specified. See the description of
-\fIaccess-list\fR below.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBnone=\fIaccess-list\fR\fR\fR
-.ad
-.sp .6
-.RS 4n
-Access is not allowed to any client that matches the access list. The exception
-is when the access list is an asterisk (\fB*\fR), in which case \fBro\fR or
-\fBrw\fR can override \fBnone\fR.
-.RE
-
-.SS "Access List Argument"
-The \fIaccess-list\fR argument is either the string \fB"*"\fR to represent all
-hosts or a colon-separated list whose components can be any number of the
-following:
-.sp
-.ne 2
-.na
-\fB\fIhostname\fR\fR
-.ad
-.sp .6
-.RS 4n
-The name of a host. With a server configured for DNS or LDAP naming in the
-\fBnsswitch.conf\fR(5) \fBhosts\fR entry, a hostname must be represented as a
-fully qualified DNS or LDAP name.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fInetgroup\fR\fR
-.ad
-.sp .6
-.RS 4n
-A \fInetgroup\fR contains a number of hostnames. With a server configured for
-DNS or LDAP naming in the \fBnsswitch.conf\fR(5) \fBhosts\fR entry, any
+.It Cm ro Ns = Ns Ar access-list
+.Pp
+Sharing is read-only to the clients listed in
+.Ar access-list ;
+overrides the
+.Cm rw
+suboption for the clients specified.
+See the description of
+.Ar access-list
+below.
+.It Cm rw Ns = Ns Ar access-list
+.Pp
+Sharing is read-write to the clients listed in
+.Ar access-list ;
+overrides the
+.Cm ro
+suboption for the clients specified.
+See the description of
+.Ar access-list
+below.
+.It Cm none Ns = Ns access-list
+.Pp
+Access is not allowed to any client that matches the access list.
+The exception is when the access list is an asterisk
+.Pq Ql * ,
+in which case
+.Cm ro
+or
+.Cm rw
+can override
+.Cm none .
+.El
+.Ss "Access List Argument"
+The
+.Ar access-list
+argument is either the string
+.Ql *
+to represent all hosts or a colon-separated list whose components can be any
+number of the following:
+.Bl -tag -width 1
+.It Ar hostname
+.Pp
+The name of a host.
+With a server configured for DNS or LDAP naming in the
+.Xr nsswitch.conf 5
+.Ql hosts
+entry, a hostname must be represented as a fully qualified DNS or LDAP name.
+.It Ar netgroup
+.Pp
+A
+.Ar netgroup
+contains a number of hostnames.
+With a server configured for DNS or LDAP naming in the
+.Xr nsswitch.conf 5
+.Ql hosts
+entry, any
hostname in a netgroup must be represented as a fully qualified DNS or LDAP
name.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIdomainname\fR.\fIsuffix\fR\fR
-.ad
-.sp .6
-.RS 4n
+.It Ar domainname . Ns Ar suffix
+.Pp
To use domain membership the server must use DNS or LDAP, rather than, for
-example, NIS, to resolve hostnames to IP addresses. That is, the
-\fBhosts\fR entry in the \fBnsswitch.conf\fR(5) must specify \fBdns\fR or
-\fBldap\fR ahead of \fBnis\fR, because only DNS and LDAP
-return the full domain name of the host. Other name services, such as NIS,
+example, NIS, to resolve hostnames to IP addresses.
+That is, the
+.Sy hosts
+entry in the
+.Xr nsswitch.conf 5
+must specify
+.Ql dns
+or
+.Ql ldap
+ahead of
+.Ql nis ,
+because only DNS and LDAP return the full domain name of the host.
+Other name services, such as NIS,
cannot be used to resolve hostnames on the server because, when mapping
-an IP address to a hostname, they do not return domain information. For
-example, for the IP address 172.16.45.9:
-.sp
-.ne 2
-.na
-\fBNIS\fR
-.ad
-.sp .6
-.RS 4n
-Returns: \fBmyhost\fR
-.RE
-
-.sp
-.ne 2
-.na
-\fBDNS or LDAP\fR
-.ad
-.sp .6
-.RS 4n
-Returns: \fBmyhost.mydomain.example.com\fR
-.RE
-
+an IP address to a hostname, they do not return domain information.
+For example, for the IP address 172.16.45.9:
+.Bl -tag -width "DNS OR LDAP"
+.It Sy NIS
+Returns:
+.Sy myhost
+.It Sy DNS or LDAP
+Returns:
+.Sy myhost.mydomain.example.com
+.El
+.Pp
The domain name suffix is distinguished from hostnames and netgroups by a
-prefixed dot. For example:
-.sp
-.in +2
-.nf
+prefixed dot.
+For example:
+.Bd -literal -offset 2n
rw=.mydomain.example.com
-.fi
-.in -2
-
-A single dot can be used to match a hostname with no suffix. For example, the
+.Ed
+.Pp
+A single dot can be used to match a hostname with no suffix.
+For example, the
specification:
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
rw=.
-.fi
-.in -2
-
-\&...matches \fBmydomain\fR but not \fBmydomain.example.com\fR. This feature
-can be used to match hosts resolved through NIS rather than DNS and
+.Ed
+.Pp
+\&...matches
+.Ql mydomain
+but not
+.Ql mydomain.example.com .
+This feature can be used to match hosts resolved through NIS rather than DNS and
LDAP.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fInetwork\fR\fR
-.ad
-.sp .6
-.RS 4n
-The network or subnet component is preceded by an at-sign (\fB@\fR). It can be
-either a name or a dotted address. If a name, it is converted to a dotted
-address by \fBgetnetbyname\fR(3SOCKET). For example:
-.sp
-.in +2
-.nf
+.It Ar network
+.Pp
+The network or subnet component is preceded by an at-sign
+.Pq Ql @ .
+It can be either a name or a dotted address.
+If a name, it is converted to a dotted address by
+.Xr getnetbyname 3SOCKET .
+For example:
+.Bd -literal -offset 2n
=@mynet
-.fi
-.in -2
-
+.Ed
+.Pp
\&...is equivalent to:
-.sp
-.in +2
-.nf
+.Bd -literal -offset 2n
=@172.16 or =@172.16.0.0
-.fi
-.in -2
-
+.Ed
+.Pp
The network prefix assumes an octet-aligned netmask determined from the zeroth
octet in the low-order part of the address up to and including the high-order
-octet, if you want to specify a single IP address. In the case where network
+octet, if you want to specify a single IP address.
+In the case where network
prefixes are not byte-aligned, the syntax allows a mask length to be specified
-explicitly following a slash (\fB/\fR) delimiter. For example:
-.sp
-.in +2
-.nf
+explicitly following a slash
+.Pq Ql /
+delimiter.
+For example:
+.Bd -literal -offset 2n
=@theothernet/17 or =@172.16.132/22
-.fi
-.in -2
-
+.Ed
+.Pp
\&...where the mask is the number of leftmost contiguous significant bits in
the corresponding IP address.
-.RE
-
-.sp
-.LP
-A prefixed minus sign (\fB-\fR) denies access to a component of
-\fIaccess-list\fR. The list is searched sequentially until a match is found
+.El
+.Pp
+A prefixed minus sign
+.Pq Ql -
+denies access to a component of
+.Ar access-list .
+The list is searched sequentially until a match is found
that either grants or denies access, or until the end of the list is reached.
-For example, if host \fBterra\fR is in the netgroup \fBengineering\fR, then:
-.sp
-.in +2
-.nf
+For example, if host
+.Ql terra
+is in the netgroup
+.Ql engineering ,
+then:
+.Bd -literal -offset 2n
rw=-terra:engineering
-.fi
-.in -2
-
-.sp
-.LP
-\&...denies access to \fBterra\fR, but:
-.sp
-.in +2
-.nf
+.Ed
+.Pp
+\&...denies access to
+.Ql terra ,
+but:
+.Bd -literal -offset 2n
rw=engineering:-terra
-.fi
-.in -2
-
-.sp
-.LP
-\&...grants access to \fBterra\fR.
-.SH EXIT STATUS
-.ne 2
-.na
-\fB\fB0\fR\fR
-.ad
-.RS 18n
+.Ed
+.Pp
+\&...grants access to
+.Ql terra .
+.Sh FILES
+.Bl -tag -width Pa
+.It Pa /usr/include/libshare.h
+Error codes used for exit status.
+.El
+.Sh EXIT STATUS
+.Bl -tag -offset indent -width "other non-zero" -compact
+.It Er 0
Successful completion.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB98\fR\fR
-.ad
-.RS 18n
+.It Er 98
Service is offline and cannot be enabled (start only).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIother non-zero\fR\fR
-.ad
-.RS 18n
+.It Er other non-zero
Command failed.
-.RE
-
-.SH FILES
-.ne 2
-.na
-\fB\fB/usr/include/libshare.h\fR\fR
-.ad
-.RS 27n
-Error codes used for exit status.
-.RE
-
-.SH ATTRIBUTES
-See \fBattributes\fR(7) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability Committed
-.TE
-
-.SH SEE ALSO
-.BR attributes (7),
-.BR nfssec (7),
-.BR smf (7),
-.BR standards (7),
-.BR idmap (8),
-.BR sharectl (8),
-.BR zfs (8)
+.El
+.Sh INTERFACE STABILITY
+Committed
+.Sh SEE ALSO
+.Xr attributes 7 ,
+.Xr nfssec 7 ,
+.Xr smf 7 ,
+.Xr standards 7 ,
+.Xr idmap 8 ,
+.Xr sharectl 8 ,
+.Xr zfs 8
diff --git a/usr/src/pkg/manifests/system-test-ostest.p5m b/usr/src/pkg/manifests/system-test-ostest.p5m
index 60f34a2fc9..f0c61d7872 100644
--- a/usr/src/pkg/manifests/system-test-ostest.p5m
+++ b/usr/src/pkg/manifests/system-test-ostest.p5m
@@ -13,7 +13,7 @@
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
# Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2020 Joyent, Inc.
-# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2021 Tintri by DDN, Inc. All rights reserved.
# Copyright 2022 Oxide Computer Company
# Copyright 2022 MNX Cloud, Inc.
@@ -168,6 +168,8 @@ file path=opt/os-tests/tests/uccid/txn-pollerr mode=0555
file path=opt/os-tests/tests/uccid/yk mode=0555
file path=opt/os-tests/tests/uccid/yk-poll mode=0555
file path=opt/os-tests/tests/uccid/yk-readonly mode=0555
+file path=opt/os-tests/tests/ucontext.32 mode=0555
+file path=opt/os-tests/tests/ucontext.64 mode=0555
file path=opt/os-tests/tests/writev.32 mode=0555
file path=opt/os-tests/tests/writev.64 mode=0555
file path=opt/os-tests/tests/zen_umc_test mode=0555
diff --git a/usr/src/test/os-tests/runfiles/default.run b/usr/src/test/os-tests/runfiles/default.run
index 5499220e15..d432e7be17 100644
--- a/usr/src/test/os-tests/runfiles/default.run
+++ b/usr/src/test/os-tests/runfiles/default.run
@@ -12,7 +12,7 @@
#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright 2020 Joyent, Inc.
-# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2021 Tintri by DDN, Inc. All rights reserved.
# Copyright 2022 Oxide Computer Company
# Copyright 2022 MNX Cloud, Inc.
@@ -39,6 +39,9 @@ tests = ['poll_test', 'epoll_test']
[/opt/os-tests/tests/clock_gettime.32]
[/opt/os-tests/tests/clock_gettime.64]
+[/opt/os-tests/tests/ucontext.32]
+[/opt/os-tests/tests/ucontext.64]
+
[/opt/os-tests/tests/secflags]
user = root
tests = ['secflags_aslr',
diff --git a/usr/src/test/os-tests/tests/Makefile b/usr/src/test/os-tests/tests/Makefile
index 832b750d48..613dd50f8c 100644
--- a/usr/src/test/os-tests/tests/Makefile
+++ b/usr/src/test/os-tests/tests/Makefile
@@ -48,6 +48,7 @@ PROGS = \
eventfd \
odirectory \
OS-6097 \
+ ucontext \
writev
CPPFLAGS += -D_REENTRANT
@@ -70,6 +71,9 @@ clock_gettime.32 := CSTD = $(CSTD_GNU99)
clock_gettime.64 := LDLIBS64 += -lproc
clock_gettime.64 := CSTD = $(CSTD_GNU99)
+ucontext.32 := SMOFF += unreachable
+ucontext.64 := SMOFF += unreachable
+
writev.32 := CPPFLAGS += -D_FILE_OFFSET_BITS=64
writev.32 := CSTD = $(CSTD_GNU99)
writev.64 := CSTD = $(CSTD_GNU99)
diff --git a/usr/src/test/os-tests/tests/ucontext.c b/usr/src/test/os-tests/tests/ucontext.c
new file mode 100644
index 0000000000..a6e43941c1
--- /dev/null
+++ b/usr/src/test/os-tests/tests/ucontext.c
@@ -0,0 +1,103 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
+ */
+
+#include <atomic.h>
+#include <err.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ucontext.h>
+#include <unistd.h>
+#include <sys/debug.h>
+#include <sys/types.h>
+
+static __thread uint64_t tlsvar;
+static ucontext_t ctx;
+static uint32_t failures;
+static pthread_t tid;
+
+#define THREAD1_VALUE 0x1010
+#define THREAD2_VALUE 0x0202
+
+void
+report(char *tag)
+{
+ pthread_t ltid = pthread_self();
+
+ printf(" %-14s: thread=%x, TLS variable=%x\n",
+ tag, (uint_t)ltid, tlsvar);
+}
+
+void
+run(void)
+{
+ pthread_t ltid = pthread_self();
+
+ printf("Coroutine started from second thread\n");
+ report("coroutine");
+
+ if (ltid != tid) {
+ fprintf(stderr,
+ "FAIL: coroutine thread ID is %x, expected %x\n",
+ ltid, tid);
+ atomic_inc_32(&failures);
+ }
+
+ if (tlsvar != THREAD2_VALUE) {
+ fprintf(stderr,
+ "FAIL: coroutine TLS variable is %x, expected %x\n",
+ tlsvar, THREAD2_VALUE);
+ atomic_inc_32(&failures);
+ }
+}
+
+void *
+thread(void *arg __unused)
+{
+ tlsvar = THREAD2_VALUE;
+
+ report("second thread");
+ /*
+ * setcontext() does not return if successful, checking the return
+ * value upsets smatch.
+ */
+ (void) setcontext(&ctx);
+ errx(EXIT_FAILURE, "setcontext() returned and should not have.");
+
+ return (NULL);
+}
+
+int
+main(void)
+{
+ char stk[SIGSTKSZ];
+ void *status;
+
+ tlsvar = THREAD1_VALUE;
+
+ report("main thread");
+
+ VERIFY0(getcontext(&ctx));
+ ctx.uc_link = NULL;
+ ctx.uc_stack.ss_sp = stk;
+ ctx.uc_stack.ss_size = sizeof (stk);
+ makecontext(&ctx, run, 0);
+
+ VERIFY0(pthread_create(&tid, NULL, thread, NULL));
+ VERIFY0(pthread_join(tid, &status));
+
+ return (failures == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
+}
diff --git a/usr/src/uts/common/fs/smbsrv/smb_node.c b/usr/src/uts/common/fs/smbsrv/smb_node.c
index 67c348433d..62396ecbcb 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_node.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_node.c
@@ -188,33 +188,31 @@ smb_node_fini(void)
if (smb_node_cache == NULL)
return;
-#ifdef DEBUG
for (i = 0; i <= SMBND_HASH_MASK; i++) {
smb_llist_t *bucket;
smb_node_t *node;
/*
- * The following sequence is just intended for sanity check.
- * This will have to be modified when the code goes into
- * production.
- *
- * The SMB node hash table should be emtpy at this point. If the
- * hash table is not empty a panic will be triggered.
+ * The SMB node hash table should be empty at this point.
+ * If the hash table is not empty, clean it up.
*
- * The reason why SMB nodes are still remaining in the hash
- * table is problably due to a mismatch between calls to
- * smb_node_lookup() and smb_node_release(). You must track that
- * down.
+ * The reason why SMB nodes might remain in this table is
+ * generally forgotten references somewhere, perhaps on
+ * open files, etc. Those are defects.
*/
bucket = &smb_node_hash_table[i];
node = smb_llist_head(bucket);
while (node != NULL) {
+#ifdef DEBUG
cmn_err(CE_NOTE, "leaked node: 0x%p %s",
(void *)node, node->od_name);
- node = smb_llist_next(bucket, node);
+ cmn_err(CE_NOTE, "...bucket: 0x%p", bucket);
+ debug_enter("leaked_node");
+#endif
+ smb_llist_remove(bucket, node);
+ node = smb_llist_head(bucket);
}
}
-#endif
for (i = 0; i <= SMBND_HASH_MASK; i++) {
smb_llist_destructor(&smb_node_hash_table[i]);
diff --git a/usr/src/uts/common/fs/smbsrv/smb_server.c b/usr/src/uts/common/fs/smbsrv/smb_server.c
index 2269adf34f..af12a0c30b 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_server.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_server.c
@@ -269,6 +269,9 @@ int smb_event_debug = 0;
static smb_llist_t smb_servers;
+/* for smb_server_destroy_session() */
+static smb_llist_t smb_server_session_zombies;
+
kmem_cache_t *smb_cache_request;
kmem_cache_t *smb_cache_session;
kmem_cache_t *smb_cache_user;
@@ -341,6 +344,9 @@ smb_server_g_init(void)
smb_llist_constructor(&smb_servers, sizeof (smb_server_t),
offsetof(smb_server_t, sv_lnd));
+ smb_llist_constructor(&smb_server_session_zombies,
+ sizeof (smb_session_t), offsetof(smb_session_t, s_lnd));
+
return (0);
errout:
@@ -1488,7 +1494,7 @@ smb_server_shutdown(smb_server_t *sv)
* with shutdown in spite of any leaked sessions.
* That's better than a server that won't reboot.
*/
- time = SEC_TO_TICK(10) + ddi_get_lbolt();
+ time = SEC_TO_TICK(5) + ddi_get_lbolt();
mutex_enter(&sv->sv_mutex);
while (sv->sv_session_list.ll_count != 0) {
if (cv_timedwait(&sv->sv_cv, &sv->sv_mutex, time) < 0)
@@ -1774,7 +1780,6 @@ smb_server_receiver(void *arg)
/* We stay in here until socket disconnect. */
smb_session_receiver(session);
- ASSERT(session->s_state == SMB_SESSION_STATE_SHUTDOWN);
smb_server_destroy_session(session);
}
@@ -2628,7 +2633,25 @@ smb_server_destroy_session(smb_session_t *session)
count = ll->ll_count;
smb_llist_exit(ll);
- smb_session_delete(session);
+ /*
+ * Normally, the session should have state SHUTDOWN here.
+ * If the session has any ofiles remaining, eg. due to
+ * forgotten ofile references or something, the state
+ * will be _DISCONNECTED or _TERMINATED. Keep such
+ * sessions in the list of zombies (for debugging).
+ */
+ if (session->s_state == SMB_SESSION_STATE_SHUTDOWN) {
+ smb_session_delete(session);
+ } else {
+#ifdef DEBUG
+ cmn_err(CE_NOTE, "Leaked session: 0x%p", (void *)session);
+ debug_enter("leaked session");
+#endif
+ smb_llist_enter(&smb_server_session_zombies, RW_WRITER);
+ smb_llist_insert_head(&smb_server_session_zombies, session);
+ smb_llist_exit(&smb_server_session_zombies);
+ }
+
if (count == 0) {
/* See smb_server_shutdown */
cv_signal(&sv->sv_cv);
diff --git a/usr/src/uts/common/fs/smbsrv/smb_session.c b/usr/src/uts/common/fs/smbsrv/smb_session.c
index 89ab25ae02..f9250c4f73 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_session.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_session.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2020 Tintri by DDN, Inc. All rights reserved.
- * Copyright 2020 RackTop Systems, Inc.
+ * Copyright 2022 RackTop Systems, Inc.
*/
#include <sys/atomic.h>
@@ -1194,6 +1194,8 @@ smb_session_disconnect_share(
smb_llist_exit(ll);
}
+int smb_session_logoff_maxwait = 2 * MILLISEC; /* 2 sec. */
+
/*
* Logoff all users associated with the specified session.
*
@@ -1207,6 +1209,8 @@ smb_session_logoff(smb_session_t *session)
{
smb_llist_t *ulist;
smb_user_t *user;
+ int count;
+ int timeleft = smb_session_logoff_maxwait;
SMB_SESSION_VALID(session);
@@ -1244,52 +1248,40 @@ top:
user = smb_llist_next(ulist, user);
}
- /* Needed below (Was the list empty?) */
- user = smb_llist_head(ulist);
+ count = smb_llist_get_count(ulist);
+ /* drop the lock and flush the dtor queue */
smb_llist_exit(ulist);
/*
- * It's possible for user objects to remain due to references
- * obtained via smb_server_lookup_ssnid(), when an SMB2
- * session setup is destroying a previous session.
- *
- * Wait for user objects to clear out (last refs. go away,
- * then smb_user_delete takes them out of the list). When
- * the last user object is removed, the session state is
- * set to SHUTDOWN and s_lock is signaled.
- *
- * Not all places that call smb_user_release necessarily
- * flush the delete queue, so after we wait for the list
- * to empty out, go back to the top and recheck the list
- * delete queue to make sure smb_user_delete happens.
+ * Wait (briefly) for user objects to go away.
+ * They might linger, eg. if some ofile ref has been
+ * forgotten, which holds, a tree and a user.
+ * See smb_session_destroy.
*/
- if (user == NULL) {
+ if (count == 0) {
/* User list is empty. */
smb_rwx_rwenter(&session->s_lock, RW_WRITER);
session->s_state = SMB_SESSION_STATE_SHUTDOWN;
smb_rwx_rwexit(&session->s_lock);
} else {
smb_rwx_rwenter(&session->s_lock, RW_READER);
- if (session->s_state != SMB_SESSION_STATE_SHUTDOWN) {
+ if (session->s_state != SMB_SESSION_STATE_SHUTDOWN &&
+ timeleft > 0) {
+ /* May be signaled in smb_user_delete */
(void) smb_rwx_cvwait(&session->s_lock,
MSEC_TO_TICK(200));
+ timeleft -= 200;
smb_rwx_rwexit(&session->s_lock);
goto top;
}
smb_rwx_rwexit(&session->s_lock);
}
- ASSERT(session->s_state == SMB_SESSION_STATE_SHUTDOWN);
/*
* User list should be empty now.
+ * (Checked in smb_session_destroy)
*/
-#ifdef DEBUG
- if (ulist->ll_count != 0) {
- cmn_err(CE_WARN, "user list not empty?");
- debug_enter("s_user_list");
- }
-#endif
/*
* User logoff happens first so we'll set preserve_opens
diff --git a/usr/src/uts/common/fs/smbsrv/smb_srv_oplock.c b/usr/src/uts/common/fs/smbsrv/smb_srv_oplock.c
index 5e5ea0ade0..76560f20a5 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_srv_oplock.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_srv_oplock.c
@@ -150,7 +150,7 @@ static void smb_oplock_wait_break_cancel(smb_request_t *sr);
* This is mostly the same as smb_oplock_ind_break() except:
* - The only CompletionStatus possible is STATUS_CANT_GRANT.
* - Instead of taskq_dispatch this appends the new SR to
- * the "post work" queue on the current SR.
+ * the "post work" queue on the current SR (if possible).
*
* Note called with the node ofile list rwlock held and
* the oplock mutex entered.
@@ -159,7 +159,13 @@ void
smb_oplock_ind_break_in_ack(smb_request_t *ack_sr, smb_ofile_t *ofile,
uint32_t NewLevel, boolean_t AckRequired)
{
- smb_request_t *new_sr;
+ smb_server_t *sv = ofile->f_server;
+ smb_node_t *node = ofile->f_node;
+ smb_request_t *sr = NULL;
+ boolean_t use_postwork = B_TRUE;
+
+ ASSERT(RW_READ_HELD(&node->n_ofile_list.ll_lock));
+ ASSERT(MUTEX_HELD(&node->n_oplock.ol_mutex));
/*
* This should happen only with SMB2 or later,
@@ -183,42 +189,59 @@ smb_oplock_ind_break_in_ack(smb_request_t *ack_sr, smb_ofile_t *ofile,
/*
* When called from Ack processing, we want to use a
- * request on the session doing the ack. If we can't
+ * request on the session doing the ack, so we can
+ * append "post work" to that session. If we can't
* allocate a request on that session (because it's
- * now disconnecting) just fall-back to the normal
- * oplock break code path which deals with that.
- * Once we have a request on the ack session, that
- * session won't go away until the request is done.
+ * now disconnecting) use a request from the server
+ * session like smb_oplock_ind_break does, and then
+ * use taskq_dispatch instead of postwork.
*/
- new_sr = smb_request_alloc(ack_sr->session, 0);
- if (new_sr == NULL) {
- smb_oplock_ind_break(ofile, NewLevel,
- AckRequired, STATUS_CANT_GRANT);
- smb_ofile_release(ofile);
+ sr = smb_request_alloc(ack_sr->session, 0);
+ if (sr == NULL) {
+ use_postwork = B_FALSE;
+ sr = smb_request_alloc(sv->sv_session, 0);
+ }
+ if (sr == NULL) {
+ /*
+ * Server must be shutting down. We took a
+ * hold on the ofile that must be released,
+ * but we can't release here because we're
+ * called with the node ofile list entered.
+ * See smb_ofile_release_LL.
+ */
+ smb_llist_post(&node->n_ofile_list, ofile,
+ smb_ofile_release_LL);
return;
}
- new_sr->sr_state = SMB_REQ_STATE_SUBMITTED;
- new_sr->smb2_async = B_TRUE;
- new_sr->user_cr = zone_kcred();
- new_sr->fid_ofile = ofile;
+ sr->sr_state = SMB_REQ_STATE_SUBMITTED;
+ sr->smb2_async = B_TRUE;
+ sr->user_cr = zone_kcred();
+ sr->fid_ofile = ofile;
if (ofile->f_tree != NULL) {
- new_sr->tid_tree = ofile->f_tree;
- smb_tree_hold_internal(ofile->f_tree);
+ sr->tid_tree = ofile->f_tree;
+ smb_tree_hold_internal(sr->tid_tree);
}
if (ofile->f_user != NULL) {
- new_sr->uid_user = ofile->f_user;
- smb_user_hold_internal(ofile->f_user);
+ sr->uid_user = ofile->f_user;
+ smb_user_hold_internal(sr->uid_user);
}
- new_sr->arg.olbrk.NewLevel = NewLevel;
- new_sr->arg.olbrk.AckRequired = AckRequired;
+ sr->arg.olbrk.NewLevel = NewLevel;
+ sr->arg.olbrk.AckRequired = AckRequired;
- /*
- * Using smb2_cmd_code to indicate what to call.
- * work func. will call smb_oplock_send_brk
- */
- new_sr->smb2_cmd_code = SMB2_OPLOCK_BREAK;
- smb2sr_append_postwork(ack_sr, new_sr);
+ if (use_postwork) {
+ /*
+ * Using smb2_cmd_code to indicate what to call.
+ * work func. will call smb_oplock_send_brk
+ */
+ sr->smb2_cmd_code = SMB2_OPLOCK_BREAK;
+ smb2sr_append_postwork(ack_sr, sr);
+ } else {
+ /* Will call smb_oplock_send_break */
+ sr->smb2_status = STATUS_CANT_GRANT;
+ (void) taskq_dispatch(sv->sv_worker_pool,
+ smb_oplock_async_break, sr, TQ_SLEEP);
+ }
}
/*
@@ -241,6 +264,9 @@ smb_oplock_ind_break(smb_ofile_t *ofile, uint32_t NewLevel,
smb_node_t *node = ofile->f_node;
smb_request_t *sr = NULL;
+ ASSERT(RW_READ_HELD(&node->n_ofile_list.ll_lock));
+ ASSERT(MUTEX_HELD(&node->n_oplock.ol_mutex));
+
/*
* See notes at smb_oplock_async_break re. CompletionStatus
* Check for any invalid codes here, so assert happens in