annotate usr/src/uts/common/fs/smbsrv/smb_server.c @ 13956:ba0ec3e45034

3523 SMB NT Notify returning too soon Reviewed by: Albert Lee <trisk@nexenta.com> Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Yakov Zaytsev <yakov@nexenta.com> Approved by: Richard Lowe <richlowe@richlowe.net>
author Gordon Ross <gwr@nexenta.com>
date Wed, 10 Oct 2012 20:07:26 -0400
parents 3f18ae9d8c98
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
2 * CDDL HEADER START
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
3 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
4 * The contents of this file are subject to the terms of the
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
5 * Common Development and Distribution License (the "License").
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
6 * You may not use this file except in compliance with the License.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
7 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
9 * or http://www.opensolaris.org/os/licensing.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
10 * See the License for the specific language governing permissions
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
11 * and limitations under the License.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
12 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
13 * When distributing Covered Code, include this CDDL HEADER in each
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
15 * If applicable, add the following below this CDDL HEADER, with the
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
16 * fields enclosed by brackets "[]" replaced with your own identifying
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
17 * information: Portions Copyright [yyyy] [name of copyright owner]
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
18 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
19 * CDDL HEADER END
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
20 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
21 /*
12065
0e89d02a32ea 6932404 Autohome share does not show up when using sharemgr show -vp
Keyur Desai <Keyur.Desai@Sun.COM>
parents: 11963
diff changeset
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
13751
fcb6d06601cc 2991 Allow building without SMB printing support
Gordon Ross <gwr@nexenta.com>
parents: 13515
diff changeset
23 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
24 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
25
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
26 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
27 * General Structures Layout
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
28 * -------------------------
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
29 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
30 * This is a simplified diagram showing the relationship between most of the
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
31 * main structures.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
32 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
33 * +-------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
34 * | SMB_SERVER |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
35 * +-------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
36 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
37 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
38 * v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
39 * +-------------------+ +-------------------+ +-------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
40 * | SESSION |<----->| SESSION |......| SESSION |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
41 * +-------------------+ +-------------------+ +-------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
42 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
43 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
44 * v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
45 * +-------------------+ +-------------------+ +-------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
46 * | USER |<----->| USER |......| USER |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
47 * +-------------------+ +-------------------+ +-------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
48 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
49 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
50 * v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
51 * +-------------------+ +-------------------+ +-------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
52 * | TREE |<----->| TREE |......| TREE |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
53 * +-------------------+ +-------------------+ +-------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
54 * | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
55 * | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
56 * | v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
57 * | +-------+ +-------+ +-------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
58 * | | OFILE |<----->| OFILE |......| OFILE |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
59 * | +-------+ +-------+ +-------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
60 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
61 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
62 * v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
63 * +-------+ +------+ +------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
64 * | ODIR |<----->| ODIR |......| ODIR |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
65 * +-------+ +------+ +------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
66 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
67 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
68 * Module Interface Overview
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
69 * -------------------------
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
70 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
71 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
72 * +===================================+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
73 * | smbd daemon |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
74 * +===================================+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
75 * | | ^
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
76 * | | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
77 * User | | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
78 * -----------|--------------|----------------|--------------------------------
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
79 * Kernel | | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
80 * | | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
81 * | | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
82 * +=========|==============|================|=================+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
83 * | v v | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
84 * | +-----------+ +--------------------+ +------------------+ |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
85 * | | IO | | Kernel Door Server | | User Door Servers| |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
86 * | | Interface | | Interface | | Interface | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
87 * | +-----------+ +--------------------+ +------------------+ |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
88 * | | | ^ ^ |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
89 * | v v | | | +=========+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
90 * | +-----------------------------------+ | | | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
91 * | + SMB Server Management (this file) |<------------------| ZFS |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
92 * | +-----------------------------------+ | | | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
93 * | | | | Module |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
94 * | +-----------------------------------+ | | | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
95 * | + SMB Server Internal Layers |------+ | +=========+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
96 * | +-----------------------------------+ |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
97 * | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
98 * | |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
99 * +===========================================================+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
100 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
101 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
102 * Server State Machine
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
103 * --------------------
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
104 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
105 * | T0
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
106 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
107 * v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
108 * +-----------------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
109 * | SMB_SERVER_STATE_CREATED |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
110 * +-----------------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
111 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
112 * | T1
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
113 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
114 * v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
115 * +-----------------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
116 * | SMB_SERVER_STATE_CONFIGURED |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
117 * +-----------------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
118 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
119 * | T2
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
120 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
121 * v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
122 * +-----------------------------+
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
123 * | SMB_SERVER_STATE_RUNNING / |
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
124 * | SMB_SERVER_STATE_STOPPING |
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
125 * +-----------------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
126 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
127 * | T3
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
128 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
129 * v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
130 * +-----------------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
131 * | SMB_SERVER_STATE_DELETING |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
132 * +-----------------------------+
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
133 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
134 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
135 * |
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
136 * v
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
137 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
138 * States
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
139 * ------
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
140 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
141 * SMB_SERVER_STATE_CREATED
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
142 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
143 * This is the state of the server just after creation.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
144 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
145 * SMB_SERVER_STATE_CONFIGURED
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
146 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
147 * The server has been configured.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
148 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
149 * SMB_SERVER_STATE_RUNNING
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
150 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
151 * The server has been started. While in this state the threads listening on
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
152 * the sockets are started.
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
153 *
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
154 * When a client establishes a connection the thread listening dispatches
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
155 * a task with the new session as an argument. If the dispatch fails the new
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
156 * session context is destroyed.
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
157 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
158 * SMB_SERVER_STATE_STOPPING
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
159 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
160 * The threads listening on the NBT and TCP sockets are being terminated.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
161 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
162 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
163 * Transitions
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
164 * -----------
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
165 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
166 * Transition T0
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
167 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
168 * The daemon smbd triggers its creation by opening the smbsrv device. If
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
169 * the zone where the daemon lives doesn't have an smb server yet it is
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
170 * created.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
171 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
172 * smb_drv_open() --> smb_server_create()
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
173 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
174 * Transition T1
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
175 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
176 * This transition occurs in smb_server_configure(). It is triggered by the
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
177 * daemon through an Ioctl.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
178 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
179 * smb_drv_ioctl(SMB_IOC_CONFIG) --> smb_server_configure()
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
180 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
181 * Transition T2
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
182 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
183 * This transition occurs in smb_server_start(). It is triggered by the
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
184 * daemon through an Ioctl.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
185 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
186 * smb_drv_ioctl(SMB_IOC_START) --> smb_server_start()
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
187 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
188 * Transition T3
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
189 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
190 * This transition occurs in smb_server_delete(). It is triggered by the
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
191 * daemon when closing the smbsrv device
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
192 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
193 * smb_drv_close() --> smb_server_delete()
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
194 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
195 * Comments
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
196 * --------
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
197 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
198 * This files assumes that there will one SMB server per zone. For now the
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
199 * smb server works only in global zone. There's nothing in this file preventing
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
200 * an smb server from being created in a non global zone. That limitation is
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
201 * enforced in user space.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
202 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
203
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
204 #include <sys/strsubr.h>
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
205 #include <sys/cmn_err.h>
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
206 #include <sys/priv.h>
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
207 #include <sys/socketvar.h>
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
208 #include <sys/zone.h>
10966
37e5dcdf36d3 6747532 ns_lookup_bypid spams syslog with too many messages
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10717
diff changeset
209 #include <netinet/in.h>
37e5dcdf36d3 6747532 ns_lookup_bypid spams syslog with too many messages
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10717
diff changeset
210 #include <netinet/in_systm.h>
37e5dcdf36d3 6747532 ns_lookup_bypid spams syslog with too many messages
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10717
diff changeset
211 #include <netinet/ip.h>
37e5dcdf36d3 6747532 ns_lookup_bypid spams syslog with too many messages
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10717
diff changeset
212 #include <netinet/ip_icmp.h>
37e5dcdf36d3 6747532 ns_lookup_bypid spams syslog with too many messages
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10717
diff changeset
213 #include <netinet/ip_var.h>
37e5dcdf36d3 6747532 ns_lookup_bypid spams syslog with too many messages
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10717
diff changeset
214 #include <netinet/tcp.h>
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
215 #include <smbsrv/smb_kproto.h>
10966
37e5dcdf36d3 6747532 ns_lookup_bypid spams syslog with too many messages
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10717
diff changeset
216 #include <smbsrv/string.h>
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
217 #include <smbsrv/netbios.h>
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
218 #include <smbsrv/smb_fsops.h>
7052
efa04b030974 6615409 Rename appropriate structures in userland
amw
parents: 6849
diff changeset
219 #include <smbsrv/smb_share.h>
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
220 #include <smbsrv/smb_door.h>
6432
98715880dd9e 6666802 Cannot copy >1023 byte readonly file from Vista client to Solaris CIFS share
as200622
parents: 6139
diff changeset
221 #include <smbsrv/smb_kstat.h>
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
222
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
223 extern void smb_reply_notify_change_request(smb_request_t *);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
224
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
225 typedef struct {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
226 smb_listener_daemon_t *ra_listener;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
227 smb_session_t *ra_session;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
228 } smb_receiver_arg_t;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
229
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
230 static void smb_server_kstat_init(smb_server_t *);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
231 static void smb_server_kstat_fini(smb_server_t *);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
232 static void smb_server_timers(smb_thread_t *, void *);
13931
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
233 int smb_server_lookup(smb_server_t **);
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
234 void smb_server_release(smb_server_t *);
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
235 static void smb_server_store_cfg(smb_server_t *, smb_ioc_cfg_t *);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
236 static void smb_server_shutdown(smb_server_t *);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
237 static int smb_server_fsop_start(smb_server_t *);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
238 static void smb_server_fsop_stop(smb_server_t *);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
239 static void smb_event_cancel(smb_server_t *, uint32_t);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
240 static uint32_t smb_event_alloc_txid(void);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
241
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
242 static void smb_server_disconnect_share(smb_llist_t *, const char *);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
243 static void smb_server_enum_private(smb_llist_t *, smb_svcenum_t *);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
244 static int smb_server_session_disconnect(smb_llist_t *, const char *,
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
245 const char *);
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
246 static int smb_server_fclose(smb_llist_t *, uint32_t);
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
247 static int smb_server_kstat_update(kstat_t *, int);
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
248 static int smb_server_legacy_kstat_update(kstat_t *, int);
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
249 static void smb_server_listener_init(smb_server_t *, smb_listener_daemon_t *,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
250 char *, in_port_t, int);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
251 static void smb_server_listener_destroy(smb_listener_daemon_t *);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
252 static int smb_server_listener_start(smb_listener_daemon_t *);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
253 static void smb_server_listener_stop(smb_listener_daemon_t *);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
254 static void smb_server_listener(smb_thread_t *, void *);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
255 static void smb_server_receiver(void *);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
256 static void smb_server_create_session(smb_listener_daemon_t *, ksocket_t);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
257 static void smb_server_destroy_session(smb_listener_daemon_t *,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
258 smb_session_t *);
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
259 static uint16_t smb_spool_get_fid(smb_server_t *);
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
260 static boolean_t smb_spool_lookup_doc_byfid(smb_server_t *, uint16_t,
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
261 smb_kspooldoc_t *);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
262
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
263 int smb_event_debug = 0;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
264
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
265 static smb_llist_t smb_servers;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
266
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
267 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
268 * *****************************************************************************
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
269 * **************** Functions called from the device interface *****************
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
270 * *****************************************************************************
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
271 *
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
272 * These functions typically have to determine the relevant smb server
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
273 * to which the call applies.
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
274 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
275
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
276 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
277 * smb_server_svc_init
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
278 *
7348
73b61202d5d6 6584155 Confusing 'No such object' message is logged when a share is successfully published.
jose borrego <Jose.Borrego@Sun.COM>
parents: 7052
diff changeset
279 * This function must be called from smb_drv_attach().
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
280 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
281 int
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
282 smb_server_svc_init(void)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
283 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
284 int rc = 0;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
285
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
286 while (rc == 0) {
8934
8ff6afa44187 6709704 smbtorture RAW-BENCH-OPLOCK test fails (when oplocks enabled)
jose borrego <Jose.Borrego@Sun.COM>
parents: 8670
diff changeset
287 if (rc = smb_mbc_init())
8ff6afa44187 6709704 smbtorture RAW-BENCH-OPLOCK test fails (when oplocks enabled)
jose borrego <Jose.Borrego@Sun.COM>
parents: 8670
diff changeset
288 continue;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
289 if (rc = smb_vop_init())
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
290 continue;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
291 if (rc = smb_node_init())
6496
76a38b87ee13 6686647 smbsrv scalability impacted by memory management issues
jb150015
parents: 6432
diff changeset
292 continue;
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
293 if (rc = smb_oplock_init())
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
294 continue;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
295 if (rc = smb_fem_init())
6496
76a38b87ee13 6686647 smbsrv scalability impacted by memory management issues
jb150015
parents: 6432
diff changeset
296 continue;
76a38b87ee13 6686647 smbsrv scalability impacted by memory management issues
jb150015
parents: 6432
diff changeset
297 if (rc = smb_net_init())
76a38b87ee13 6686647 smbsrv scalability impacted by memory management issues
jb150015
parents: 6432
diff changeset
298 continue;
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
299 smb_llist_init();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
300 smb_llist_constructor(&smb_servers, sizeof (smb_server_t),
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
301 offsetof(smb_server_t, sv_lnd));
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
302 return (0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
303 }
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
304
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
305 smb_llist_fini();
6496
76a38b87ee13 6686647 smbsrv scalability impacted by memory management issues
jb150015
parents: 6432
diff changeset
306 smb_net_fini();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
307 smb_fem_fini();
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
308 smb_node_fini();
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
309 smb_vop_fini();
8934
8ff6afa44187 6709704 smbtorture RAW-BENCH-OPLOCK test fails (when oplocks enabled)
jose borrego <Jose.Borrego@Sun.COM>
parents: 8670
diff changeset
310 smb_mbc_fini();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
311 return (rc);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
312 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
313
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
314 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
315 * smb_server_svc_fini
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
316 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
317 * This function must called from smb_drv_detach(). It will fail if servers
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
318 * still exist.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
319 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
320 int
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
321 smb_server_svc_fini(void)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
322 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
323 int rc = EBUSY;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
324
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
325 if (smb_llist_get_count(&smb_servers) == 0) {
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
326 smb_llist_fini();
6496
76a38b87ee13 6686647 smbsrv scalability impacted by memory management issues
jb150015
parents: 6432
diff changeset
327 smb_net_fini();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
328 smb_fem_fini();
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
329 smb_node_fini();
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
330 smb_oplock_fini();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
331 smb_vop_fini();
8934
8ff6afa44187 6709704 smbtorture RAW-BENCH-OPLOCK test fails (when oplocks enabled)
jose borrego <Jose.Borrego@Sun.COM>
parents: 8670
diff changeset
332 smb_mbc_fini();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
333 smb_llist_destructor(&smb_servers);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
334 rc = 0;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
335 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
336 return (rc);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
337 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
338
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
339 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
340 * smb_server_create
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
341 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
342 * This function will fail if there's already a server associated with the
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
343 * caller's zone.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
344 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
345 int
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
346 smb_server_create(void)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
347 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
348 zoneid_t zid;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
349 smb_server_t *sv;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
350
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
351 zid = getzoneid();
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
352
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
353 smb_llist_enter(&smb_servers, RW_WRITER);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
354 sv = smb_llist_head(&smb_servers);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
355 while (sv) {
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
356 SMB_SERVER_VALID(sv);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
357 if (sv->sv_zid == zid) {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
358 smb_llist_exit(&smb_servers);
8167
6daa56c3d019 6772644 Arbitrary arguments passed to smbsrv routines may lead to unintended behavior
Alan Wright <amw@Sun.COM>
parents: 7961
diff changeset
359 return (EPERM);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
360 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
361 sv = smb_llist_next(&smb_servers, sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
362 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
363
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
364 sv = kmem_zalloc(sizeof (smb_server_t), KM_NOSLEEP);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
365 if (sv == NULL) {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
366 smb_llist_exit(&smb_servers);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
367 return (ENOMEM);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
368 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
369
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
370 smb_llist_constructor(&sv->sv_opipe_list, sizeof (smb_opipe_t),
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
371 offsetof(smb_opipe_t, p_lnd));
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
372
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
373 smb_llist_constructor(&sv->sv_event_list, sizeof (smb_event_t),
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
374 offsetof(smb_event_t, se_lnd));
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
375
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
376 smb_llist_constructor(&sv->sp_info.sp_list, sizeof (smb_kspooldoc_t),
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
377 offsetof(smb_kspooldoc_t, sd_lnd));
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
378
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
379 smb_llist_constructor(&sv->sp_info.sp_fidlist,
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
380 sizeof (smb_spoolfid_t), offsetof(smb_spoolfid_t, sf_lnd));
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
381
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
382 sv->si_cache_request = kmem_cache_create("smb_request_cache",
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
383 sizeof (smb_request_t), 8, NULL, NULL, NULL, NULL, NULL, 0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
384 sv->si_cache_session = kmem_cache_create("smb_session_cache",
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
385 sizeof (smb_session_t), 8, NULL, NULL, NULL, NULL, NULL, 0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
386 sv->si_cache_user = kmem_cache_create("smb_user_cache",
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
387 sizeof (smb_user_t), 8, NULL, NULL, NULL, NULL, NULL, 0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
388 sv->si_cache_tree = kmem_cache_create("smb_tree_cache",
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
389 sizeof (smb_tree_t), 8, NULL, NULL, NULL, NULL, NULL, 0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
390 sv->si_cache_ofile = kmem_cache_create("smb_ofile_cache",
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
391 sizeof (smb_ofile_t), 8, NULL, NULL, NULL, NULL, NULL, 0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
392 sv->si_cache_odir = kmem_cache_create("smb_odir_cache",
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
393 sizeof (smb_odir_t), 8, NULL, NULL, NULL, NULL, NULL, 0);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
394 sv->si_cache_opipe = kmem_cache_create("smb_opipe_cache",
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
395 sizeof (smb_opipe_t), 8, NULL, NULL, NULL, NULL, NULL, 0);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
396 sv->si_cache_event = kmem_cache_create("smb_event_cache",
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
397 sizeof (smb_event_t), 8, NULL, NULL, NULL, NULL, NULL, 0);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
398
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
399 smb_thread_init(&sv->si_thread_timers,
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
400 "smb_timers", smb_server_timers, sv);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
401
6432
98715880dd9e 6666802 Cannot copy >1023 byte readonly file from Vista client to Solaris CIFS share
as200622
parents: 6139
diff changeset
402 sv->sv_pid = curproc->p_pid;
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
403 smb_srqueue_init(&sv->sv_srqueue);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
404
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
405 smb_kdoor_init();
7052
efa04b030974 6615409 Rename appropriate structures in userland
amw
parents: 6849
diff changeset
406 smb_opipe_door_init();
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
407 smb_server_kstat_init(sv);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
408
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
409 mutex_init(&sv->sv_mutex, NULL, MUTEX_DEFAULT, NULL);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
410 cv_init(&sv->sv_cv, NULL, CV_DEFAULT, NULL);
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
411 cv_init(&sv->sp_info.sp_cv, NULL, CV_DEFAULT, NULL);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
412
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
413 sv->sv_state = SMB_SERVER_STATE_CREATED;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
414 sv->sv_magic = SMB_SERVER_MAGIC;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
415 sv->sv_zid = zid;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
416
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
417 smb_llist_insert_tail(&smb_servers, sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
418 smb_llist_exit(&smb_servers);
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
419
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
420 smb_threshold_init(&sv->sv_ssetup_ct, SMB_SSETUP_CMD,
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
421 smb_ssetup_threshold, smb_ssetup_timeout);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
422 smb_threshold_init(&sv->sv_tcon_ct, SMB_TCON_CMD, smb_tcon_threshold,
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
423 smb_tcon_timeout);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
424 smb_threshold_init(&sv->sv_opipe_ct, SMB_OPIPE_CMD, smb_opipe_threshold,
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
425 smb_opipe_timeout);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
426
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
427 return (0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
428 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
429
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
430 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
431 * smb_server_delete
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
432 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
433 * This function will delete the server passed in. It will make sure that all
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
434 * activity associated that server has ceased before destroying it.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
435 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
436 int
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
437 smb_server_delete(void)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
438 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
439 smb_server_t *sv;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
440 int rc;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
441
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
442 rc = smb_server_lookup(&sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
443 if (rc != 0)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
444 return (rc);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
445
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
446 smb_threshold_fini(&sv->sv_ssetup_ct);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
447 smb_threshold_fini(&sv->sv_tcon_ct);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
448 smb_threshold_fini(&sv->sv_opipe_ct);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
449
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
450 mutex_enter(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
451 switch (sv->sv_state) {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
452 case SMB_SERVER_STATE_RUNNING:
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
453 sv->sv_state = SMB_SERVER_STATE_STOPPING;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
454 mutex_exit(&sv->sv_mutex);
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
455 smb_server_shutdown(sv);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
456 mutex_enter(&sv->sv_mutex);
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
457 cv_broadcast(&sv->sp_info.sp_cv);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
458 sv->sv_state = SMB_SERVER_STATE_DELETING;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
459 break;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
460 case SMB_SERVER_STATE_STOPPING:
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
461 sv->sv_state = SMB_SERVER_STATE_DELETING;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
462 break;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
463 case SMB_SERVER_STATE_CONFIGURED:
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
464 case SMB_SERVER_STATE_CREATED:
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
465 sv->sv_state = SMB_SERVER_STATE_DELETING;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
466 break;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
467 default:
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
468 SMB_SERVER_STATE_VALID(sv->sv_state);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
469 mutex_exit(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
470 smb_server_release(sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
471 return (ENOTTY);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
472 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
473
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
474 ASSERT(sv->sv_state == SMB_SERVER_STATE_DELETING);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
475
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
476 sv->sv_refcnt--;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
477 while (sv->sv_refcnt)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
478 cv_wait(&sv->sv_cv, &sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
479
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
480 mutex_exit(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
481
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
482 smb_llist_enter(&smb_servers, RW_WRITER);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
483 smb_llist_remove(&smb_servers, sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
484 smb_llist_exit(&smb_servers);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
485
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
486 smb_server_listener_destroy(&sv->sv_nbt_daemon);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
487 smb_server_listener_destroy(&sv->sv_tcp_daemon);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
488 rw_destroy(&sv->sv_cfg_lock);
7052
efa04b030974 6615409 Rename appropriate structures in userland
amw
parents: 6849
diff changeset
489 smb_opipe_door_fini();
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
490 smb_kdoor_fini();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
491 smb_server_kstat_fini(sv);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
492 smb_llist_destructor(&sv->sv_opipe_list);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
493 smb_llist_destructor(&sv->sv_event_list);
7619
0ad244464731 6736540 ntlmv2 signing does not work in domain mode
jose borrego <Jose.Borrego@Sun.COM>
parents: 7588
diff changeset
494
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
495 kmem_cache_destroy(sv->si_cache_request);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
496 kmem_cache_destroy(sv->si_cache_session);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
497 kmem_cache_destroy(sv->si_cache_user);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
498 kmem_cache_destroy(sv->si_cache_tree);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
499 kmem_cache_destroy(sv->si_cache_ofile);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
500 kmem_cache_destroy(sv->si_cache_odir);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
501 kmem_cache_destroy(sv->si_cache_opipe);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
502 kmem_cache_destroy(sv->si_cache_event);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
503
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
504 smb_srqueue_destroy(&sv->sv_srqueue);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
505
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
506 smb_thread_destroy(&sv->si_thread_timers);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
507 mutex_destroy(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
508 cv_destroy(&sv->sv_cv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
509 sv->sv_magic = 0;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
510 kmem_free(sv, sizeof (smb_server_t));
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
511
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
512 return (0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
513 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
514
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
515 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
516 * smb_server_configure
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
517 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
518 int
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
519 smb_server_configure(smb_ioc_cfg_t *ioc)
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
520 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
521 int rc = 0;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
522 smb_server_t *sv;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
523
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
524 rc = smb_server_lookup(&sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
525 if (rc)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
526 return (rc);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
527
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
528 mutex_enter(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
529 switch (sv->sv_state) {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
530 case SMB_SERVER_STATE_CREATED:
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
531 smb_server_store_cfg(sv, ioc);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
532 sv->sv_state = SMB_SERVER_STATE_CONFIGURED;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
533 break;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
534
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
535 case SMB_SERVER_STATE_CONFIGURED:
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
536 smb_server_store_cfg(sv, ioc);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
537 break;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
538
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
539 case SMB_SERVER_STATE_RUNNING:
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
540 case SMB_SERVER_STATE_STOPPING:
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
541 rw_enter(&sv->sv_cfg_lock, RW_WRITER);
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
542 smb_server_store_cfg(sv, ioc);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
543 rw_exit(&sv->sv_cfg_lock);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
544 break;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
545
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
546 default:
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
547 SMB_SERVER_STATE_VALID(sv->sv_state);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
548 rc = EFAULT;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
549 break;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
550 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
551 mutex_exit(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
552
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
553 smb_server_release(sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
554
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
555 return (rc);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
556 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
557
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
558 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
559 * smb_server_start
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
560 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
561 int
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
562 smb_server_start(smb_ioc_start_t *ioc)
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
563 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
564 int rc = 0;
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
565 int family;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
566 smb_server_t *sv;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
567
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
568 rc = smb_server_lookup(&sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
569 if (rc)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
570 return (rc);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
571
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
572 mutex_enter(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
573 switch (sv->sv_state) {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
574 case SMB_SERVER_STATE_CONFIGURED:
10966
37e5dcdf36d3 6747532 ns_lookup_bypid spams syslog with too many messages
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10717
diff changeset
575 smb_codepage_init();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
576
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
577 sv->sv_worker_pool = taskq_create("smb_workers",
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
578 sv->sv_cfg.skc_maxworkers, SMB_WORKER_PRIORITY,
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
579 sv->sv_cfg.skc_maxworkers, INT_MAX,
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
580 TASKQ_DYNAMIC|TASKQ_PREPOPULATE);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
581
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
582 sv->sv_receiver_pool = taskq_create("smb_receivers",
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
583 sv->sv_cfg.skc_maxconnections, SMB_WORKER_PRIORITY,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
584 sv->sv_cfg.skc_maxconnections, INT_MAX,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
585 TASKQ_DYNAMIC);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
586
8670
6da349c3f817 6792084 smb_node_lookup should not take ownership of the hold on vnode passed as a parameter
jose borrego <Jose.Borrego@Sun.COM>
parents: 8348
diff changeset
587 sv->sv_session = smb_session_create(NULL, 0, sv, 0);
7588
fc605a2defdc 6736087 smb_kdoor_clnt_upcall: failed
Alan Wright <amw@Sun.COM>
parents: 7348
diff changeset
588
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
589 if (sv->sv_worker_pool == NULL || sv->sv_session == NULL) {
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
590 rc = ENOMEM;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
591 break;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
592 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
593
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
594 if (rc = smb_server_fsop_start(sv))
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
595 break;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
596 ASSERT(sv->sv_lmshrd == NULL);
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
597 sv->sv_lmshrd = smb_kshare_door_init(ioc->lmshrd);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
598 if (sv->sv_lmshrd == NULL)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
599 break;
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
600 if (rc = smb_kdoor_open(ioc->udoor)) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
601 cmn_err(CE_WARN, "Cannot open smbd door");
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
602 break;
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
603 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
604 if (rc = smb_opipe_door_open(ioc->opipe)) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
605 cmn_err(CE_WARN, "Cannot open opipe door");
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
606 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
607 }
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
608 if (rc = smb_thread_start(&sv->si_thread_timers))
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
609 break;
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
610
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
611 family = AF_INET;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
612 smb_server_listener_init(sv, &sv->sv_nbt_daemon,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
613 "smb_nbt_listener", IPPORT_NETBIOS_SSN, family);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
614 if (sv->sv_cfg.skc_ipv6_enable)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
615 family = AF_INET6;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
616 smb_server_listener_init(sv, &sv->sv_tcp_daemon,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
617 "smb_tcp_listener", IPPORT_SMB, family);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
618 rc = smb_server_listener_start(&sv->sv_nbt_daemon);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
619 if (rc != 0)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
620 break;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
621 rc = smb_server_listener_start(&sv->sv_tcp_daemon);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
622 if (rc != 0)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
623 break;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
624
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
625 sv->sv_state = SMB_SERVER_STATE_RUNNING;
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
626 sv->sv_start_time = gethrtime();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
627 mutex_exit(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
628 smb_server_release(sv);
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
629 smb_export_start();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
630 return (0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
631 default:
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
632 SMB_SERVER_STATE_VALID(sv->sv_state);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
633 mutex_exit(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
634 smb_server_release(sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
635 return (ENOTTY);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
636 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
637
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
638 mutex_exit(&sv->sv_mutex);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
639 smb_server_shutdown(sv);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
640 smb_server_release(sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
641 return (rc);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
642 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
643
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
644 /*
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
645 * An smbd is shutting down.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
646 */
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
647 int
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
648 smb_server_stop(void)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
649 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
650 smb_server_t *sv;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
651 int rc;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
652
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
653 if ((rc = smb_server_lookup(&sv)) != 0)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
654 return (rc);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
655
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
656 mutex_enter(&sv->sv_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
657 switch (sv->sv_state) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
658 case SMB_SERVER_STATE_RUNNING:
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
659 sv->sv_state = SMB_SERVER_STATE_STOPPING;
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
660 mutex_exit(&sv->sv_mutex);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
661 smb_server_shutdown(sv);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
662 mutex_enter(&sv->sv_mutex);
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
663 cv_broadcast(&sv->sp_info.sp_cv);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
664 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
665 default:
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
666 SMB_SERVER_STATE_VALID(sv->sv_state);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
667 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
668 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
669 mutex_exit(&sv->sv_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
670
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
671 smb_server_release(sv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
672 return (0);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
673 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
674
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
675 boolean_t
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
676 smb_server_is_stopping(void)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
677 {
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
678 smb_server_t *sv;
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
679 boolean_t status;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
680
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
681 if (smb_server_lookup(&sv) != 0)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
682 return (B_TRUE);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
683
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
684 SMB_SERVER_VALID(sv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
685
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
686 mutex_enter(&sv->sv_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
687
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
688 switch (sv->sv_state) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
689 case SMB_SERVER_STATE_STOPPING:
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
690 case SMB_SERVER_STATE_DELETING:
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
691 status = B_TRUE;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
692 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
693 default:
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
694 status = B_FALSE;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
695 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
696 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
697
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
698 mutex_exit(&sv->sv_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
699 smb_server_release(sv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
700 return (status);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
701 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
702
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
703 int
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
704 smb_server_cancel_event(uint32_t txid)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
705 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
706 smb_server_t *sv;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
707 int rc;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
708
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
709 if ((rc = smb_server_lookup(&sv)) == 0) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
710 smb_event_cancel(sv, txid);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
711 smb_server_release(sv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
712 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
713
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
714 return (rc);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
715 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
716
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
717 int
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
718 smb_server_notify_event(smb_ioc_event_t *ioc)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
719 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
720 smb_server_t *sv;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
721 int rc;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
722
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
723 if ((rc = smb_server_lookup(&sv)) == 0) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
724 smb_event_notify(sv, ioc->txid);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
725 smb_server_release(sv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
726 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
727
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
728 return (rc);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
729 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
730
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
731 /*
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
732 * smb_server_spooldoc
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
733 *
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
734 * Waits for print file close broadcast.
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
735 * Gets the head of the fid list,
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
736 * then searches the spooldoc list and returns
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
737 * this info via the ioctl to user land.
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
738 *
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
739 * rc - 0 success
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
740 */
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
741
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
742 int
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
743 smb_server_spooldoc(smb_ioc_spooldoc_t *ioc)
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
744 {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
745 smb_server_t *sv;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
746 int rc;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
747 smb_kspooldoc_t *spdoc;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
748 uint16_t fid;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
749
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
750 if ((rc = smb_server_lookup(&sv)) != 0)
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
751 return (rc);
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
752
13480
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
753 if (sv->sv_cfg.skc_print_enable == 0) {
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
754 rc = ENOTTY;
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
755 goto out;
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
756 }
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
757
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
758 mutex_enter(&sv->sv_mutex);
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
759 for (;;) {
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
760 if (sv->sv_state != SMB_SERVER_STATE_RUNNING) {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
761 rc = ECANCELED;
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
762 break;
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
763 }
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
764 if ((fid = smb_spool_get_fid(sv)) != 0) {
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
765 rc = 0;
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
766 break;
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
767 }
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
768 if (cv_wait_sig(&sv->sp_info.sp_cv, &sv->sv_mutex) == 0) {
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
769 rc = EINTR;
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
770 break;
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
771 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
772 }
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
773 mutex_exit(&sv->sv_mutex);
13480
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
774 if (rc != 0)
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
775 goto out;
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
776
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
777 spdoc = kmem_zalloc(sizeof (*spdoc), KM_SLEEP);
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
778 if (smb_spool_lookup_doc_byfid(sv, fid, spdoc)) {
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
779 ioc->spool_num = spdoc->sd_spool_num;
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
780 ioc->ipaddr = spdoc->sd_ipaddr;
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
781 (void) strlcpy(ioc->path, spdoc->sd_path,
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
782 MAXPATHLEN);
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
783 (void) strlcpy(ioc->username,
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
784 spdoc->sd_username, MAXNAMELEN);
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
785 } else {
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
786 /* Did not find that print job. */
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
787 rc = EAGAIN;
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
788 }
13480
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
789 kmem_free(spdoc, sizeof (*spdoc));
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
790
13480
868da6012e6f 1604 smbd print_enable doesn't really work
Gordon Ross <gwr@nexenta.com>
parents: 13479
diff changeset
791 out:
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
792 smb_server_release(sv);
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
793 return (rc);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
794 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
795
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
796 int
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
797 smb_server_set_gmtoff(smb_ioc_gmt_t *ioc)
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
798 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
799 int rc;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
800 smb_server_t *sv;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
801
9422
0d166d7fccd3 6802098 Need to support name-based rules for builtin and local well known accounts
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 9231
diff changeset
802 if ((rc = smb_server_lookup(&sv)) == 0) {
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
803 sv->si_gmtoff = ioc->offset;
9422
0d166d7fccd3 6802098 Need to support name-based rules for builtin and local well known accounts
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 9231
diff changeset
804 smb_server_release(sv);
0d166d7fccd3 6802098 Need to support name-based rules for builtin and local well known accounts
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 9231
diff changeset
805 }
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
806
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
807 return (rc);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
808 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
809
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
810 int
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
811 smb_server_numopen(smb_ioc_opennum_t *ioc)
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
812 {
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
813 smb_server_t *sv;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
814 int rc;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
815
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
816 if ((rc = smb_server_lookup(&sv)) == 0) {
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
817 ioc->open_users = sv->sv_users;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
818 ioc->open_trees = sv->sv_trees;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
819 ioc->open_files = sv->sv_files + sv->sv_pipes;
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
820 smb_server_release(sv);
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
821 }
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
822 return (rc);
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
823 }
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
824
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
825 /*
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
826 * Enumerate objects within the server. The svcenum provides the
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
827 * enumeration context, i.e. what the caller want to get back.
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
828 */
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
829 int
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
830 smb_server_enum(smb_ioc_svcenum_t *ioc)
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
831 {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
832 smb_svcenum_t *svcenum = &ioc->svcenum;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
833 smb_server_t *sv;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
834 int rc;
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
835
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
836 switch (svcenum->se_type) {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
837 case SMB_SVCENUM_TYPE_USER:
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
838 case SMB_SVCENUM_TYPE_TREE:
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
839 case SMB_SVCENUM_TYPE_FILE:
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
840 break;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
841 default:
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
842 return (EINVAL);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
843 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
844
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
845 if ((rc = smb_server_lookup(&sv)) != 0)
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
846 return (rc);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
847
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
848 svcenum->se_bavail = svcenum->se_buflen;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
849 svcenum->se_bused = 0;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
850 svcenum->se_nitems = 0;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
851
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
852 smb_server_enum_private(&sv->sv_nbt_daemon.ld_session_list, svcenum);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
853 smb_server_enum_private(&sv->sv_tcp_daemon.ld_session_list, svcenum);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
854
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
855 smb_server_release(sv);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
856 return (0);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
857 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
858
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
859 /*
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
860 * Look for sessions to disconnect by client and user name.
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
861 */
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
862 int
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
863 smb_server_session_close(smb_ioc_session_t *ioc)
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
864 {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
865 smb_llist_t *ll;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
866 smb_server_t *sv;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
867 int nbt_cnt;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
868 int tcp_cnt;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
869 int rc;
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
870
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
871 if ((rc = smb_server_lookup(&sv)) != 0)
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
872 return (rc);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
873
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
874 ll = &sv->sv_nbt_daemon.ld_session_list;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
875 nbt_cnt = smb_server_session_disconnect(ll, ioc->client, ioc->username);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
876
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
877 ll = &sv->sv_tcp_daemon.ld_session_list;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
878 tcp_cnt = smb_server_session_disconnect(ll, ioc->client, ioc->username);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
879
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
880 smb_server_release(sv);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
881
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
882 if ((nbt_cnt == 0) && (tcp_cnt == 0))
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
883 return (ENOENT);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
884 return (0);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
885 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
886
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
887 /*
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
888 * Close a file by uniqid.
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
889 */
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
890 int
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
891 smb_server_file_close(smb_ioc_fileid_t *ioc)
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
892 {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
893 uint32_t uniqid = ioc->uniqid;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
894 smb_llist_t *ll;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
895 smb_server_t *sv;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
896 int rc;
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
897
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
898 if ((rc = smb_server_lookup(&sv)) != 0)
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
899 return (rc);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
900
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
901 ll = &sv->sv_nbt_daemon.ld_session_list;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
902 rc = smb_server_fclose(ll, uniqid);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
903
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
904 if (rc == ENOENT) {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
905 ll = &sv->sv_tcp_daemon.ld_session_list;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
906 rc = smb_server_fclose(ll, uniqid);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
907 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
908
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
909 smb_server_release(sv);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
910 return (rc);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
911 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
912
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
913 /*
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
914 * These functions determine the relevant smb server to which the call apply.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
915 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
916
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
917 uint32_t
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
918 smb_server_get_session_count(void)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
919 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
920 smb_server_t *sv;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
921 uint32_t counter = 0;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
922
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
923 if (smb_server_lookup(&sv))
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
924 return (0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
925
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
926 counter = smb_llist_get_count(&sv->sv_nbt_daemon.ld_session_list);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
927 counter += smb_llist_get_count(&sv->sv_tcp_daemon.ld_session_list);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
928
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
929 smb_server_release(sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
930
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
931 return (counter);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
932 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
933
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
934 /*
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
935 * Gets the vnode of the specified share path.
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
936 *
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
937 * A hold on the returned vnode pointer is taken so the caller
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
938 * must call VN_RELE.
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
939 */
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
940 int
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
941 smb_server_sharevp(const char *shr_path, vnode_t **vp)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
942 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
943 smb_server_t *sv;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
944 smb_request_t *sr;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
945 smb_node_t *fnode = NULL;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
946 smb_node_t *dnode;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
947 char last_comp[MAXNAMELEN];
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
948 int rc = 0;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
949
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
950 ASSERT(shr_path);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
951
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
952 if ((rc = smb_server_lookup(&sv)))
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
953 return (rc);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
954
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
955 mutex_enter(&sv->sv_mutex);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
956 switch (sv->sv_state) {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
957 case SMB_SERVER_STATE_RUNNING:
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
958 break;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
959 default:
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
960 mutex_exit(&sv->sv_mutex);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
961 smb_server_release(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
962 return (ENOTACTIVE);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
963 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
964 mutex_exit(&sv->sv_mutex);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
965
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
966 if ((sr = smb_request_alloc(sv->sv_session, 0)) == NULL) {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
967 smb_server_release(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
968 return (ENOMEM);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
969 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
970 sr->user_cr = kcred;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
971
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
972 rc = smb_pathname_reduce(sr, sr->user_cr, shr_path,
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
973 NULL, NULL, &dnode, last_comp);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
974
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
975 if (rc == 0) {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
976 rc = smb_fsop_lookup(sr, sr->user_cr, SMB_FOLLOW_LINKS,
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
977 sv->si_root_smb_node, dnode, last_comp, &fnode);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
978 smb_node_release(dnode);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
979 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
980
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
981 smb_request_free(sr);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
982 smb_server_release(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
983
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
984 if (rc != 0)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
985 return (rc);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
986
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
987 ASSERT(fnode->vp && fnode->vp->v_vfsp);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
988
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
989 VN_HOLD(fnode->vp);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
990 *vp = fnode->vp;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
991
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
992 smb_node_release(fnode);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
993
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
994 return (0);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
995 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
996
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
997
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
998 /*
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
999 * This is a special interface that will be utilized by ZFS to cause a share to
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1000 * be added/removed.
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1001 *
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1002 * arg is either a lmshare_info_t or share_name from userspace.
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1003 * It will need to be copied into the kernel. It is lmshare_info_t
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1004 * for add operations and share_name for delete operations.
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1005 */
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1006 int
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1007 smb_server_share(void *arg, boolean_t add_share)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1008 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1009 smb_server_t *sv;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1010 int rc;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1011
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1012 if ((rc = smb_server_lookup(&sv)) == 0) {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1013 mutex_enter(&sv->sv_mutex);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1014 switch (sv->sv_state) {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1015 case SMB_SERVER_STATE_RUNNING:
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1016 mutex_exit(&sv->sv_mutex);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1017 (void) smb_kshare_upcall(sv->sv_lmshrd, arg, add_share);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1018 break;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1019 default:
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1020 mutex_exit(&sv->sv_mutex);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1021 break;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1022 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1023 smb_server_release(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1024 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1025
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1026 return (rc);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1027 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1028
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1029 int
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1030 smb_server_unshare(const char *sharename)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1031 {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1032 smb_server_t *sv;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1033 smb_llist_t *ll;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1034 int rc;
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1035
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1036 if ((rc = smb_server_lookup(&sv)))
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1037 return (rc);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1038
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1039 mutex_enter(&sv->sv_mutex);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1040 switch (sv->sv_state) {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1041 case SMB_SERVER_STATE_RUNNING:
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1042 case SMB_SERVER_STATE_STOPPING:
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1043 break;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1044 default:
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1045 mutex_exit(&sv->sv_mutex);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1046 smb_server_release(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1047 return (ENOTACTIVE);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1048 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1049 mutex_exit(&sv->sv_mutex);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1050
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1051 ll = &sv->sv_nbt_daemon.ld_session_list;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1052 smb_server_disconnect_share(ll, sharename);
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1053
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1054 ll = &sv->sv_tcp_daemon.ld_session_list;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1055 smb_server_disconnect_share(ll, sharename);
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1056
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1057 smb_server_release(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1058 return (0);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1059 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1060
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1061 /*
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1062 * Disconnect the specified share.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1063 * Typically called when a share has been removed.
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1064 */
7619
0ad244464731 6736540 ntlmv2 signing does not work in domain mode
jose borrego <Jose.Borrego@Sun.COM>
parents: 7588
diff changeset
1065 static void
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1066 smb_server_disconnect_share(smb_llist_t *ll, const char *sharename)
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1067 {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1068 smb_session_t *session;
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1069
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1070 smb_llist_enter(ll, RW_READER);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1071
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1072 session = smb_llist_head(ll);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1073 while (session) {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1074 SMB_SESSION_VALID(session);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1075 smb_rwx_rwenter(&session->s_lock, RW_READER);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1076 switch (session->s_state) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1077 case SMB_SESSION_STATE_NEGOTIATED:
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1078 case SMB_SESSION_STATE_OPLOCK_BREAKING:
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1079 case SMB_SESSION_STATE_WRITE_RAW_ACTIVE:
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1080 smb_session_disconnect_share(session, sharename);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1081 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1082 default:
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1083 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1084 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1085 smb_rwx_rwexit(&session->s_lock);
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1086 session = smb_llist_next(ll, session);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1087 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1088
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1089 smb_llist_exit(ll);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1090 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1091
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1092 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1093 * *****************************************************************************
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1094 * **************** Functions called from the internal layers ******************
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1095 * *****************************************************************************
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1096 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1097 * These functions are provided the relevant smb server by the caller.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1098 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1099
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1100 void
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1101 smb_server_get_cfg(smb_server_t *sv, smb_kmod_cfg_t *cfg)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1102 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1103 rw_enter(&sv->sv_cfg_lock, RW_READER);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1104 bcopy(&sv->sv_cfg, cfg, sizeof (*cfg));
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1105 rw_exit(&sv->sv_cfg_lock);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1106 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1107
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1108 /*
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1109 *
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1110 */
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1111 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1112 smb_server_inc_nbt_sess(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1113 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1114 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1115 atomic_inc_32(&sv->sv_nbt_sess);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1116 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1117
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1118 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1119 smb_server_dec_nbt_sess(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1120 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1121 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1122 atomic_dec_32(&sv->sv_nbt_sess);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1123 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1124
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1125 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1126 smb_server_inc_tcp_sess(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1127 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1128 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1129 atomic_inc_32(&sv->sv_tcp_sess);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1130 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1131
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1132 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1133 smb_server_dec_tcp_sess(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1134 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1135 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1136 atomic_dec_32(&sv->sv_tcp_sess);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1137 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1138
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1139 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1140 smb_server_inc_users(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1141 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1142 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1143 atomic_inc_32(&sv->sv_users);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1144 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1145
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1146 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1147 smb_server_dec_users(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1148 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1149 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1150 atomic_dec_32(&sv->sv_users);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1151 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1152
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1153 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1154 smb_server_inc_trees(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1155 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1156 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1157 atomic_inc_32(&sv->sv_trees);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1158 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1159
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1160 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1161 smb_server_dec_trees(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1162 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1163 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1164 atomic_dec_32(&sv->sv_trees);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1165 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1166
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1167 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1168 smb_server_inc_files(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1169 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1170 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1171 atomic_inc_32(&sv->sv_files);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1172 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1173
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1174 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1175 smb_server_dec_files(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1176 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1177 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1178 atomic_dec_32(&sv->sv_files);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1179 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1180
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1181 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1182 smb_server_inc_pipes(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1183 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1184 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1185 atomic_inc_32(&sv->sv_pipes);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1186 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1187
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1188 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1189 smb_server_dec_pipes(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1190 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1191 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1192 atomic_dec_32(&sv->sv_pipes);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1193 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1194
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1195 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1196 smb_server_add_rxb(smb_server_t *sv, int64_t value)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1197 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1198 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1199 atomic_add_64(&sv->sv_rxb, value);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1200 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1201
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1202 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1203 smb_server_add_txb(smb_server_t *sv, int64_t value)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1204 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1205 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1206 atomic_add_64(&sv->sv_txb, value);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1207 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1208
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1209 void
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1210 smb_server_inc_req(smb_server_t *sv)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1211 {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1212 SMB_SERVER_VALID(sv);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1213 atomic_inc_64(&sv->sv_nreq);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1214 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1215
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1216 /*
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1217 * *****************************************************************************
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1218 * *************************** Static Functions ********************************
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1219 * *****************************************************************************
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1220 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1221
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1222 static void
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1223 smb_server_timers(smb_thread_t *thread, void *arg)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1224 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1225 smb_server_t *sv = (smb_server_t *)arg;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1226
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1227 ASSERT(sv != NULL);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1228
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1229 while (smb_thread_continue_timedwait(thread, 1 /* Seconds */)) {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1230 smb_session_timers(&sv->sv_nbt_daemon.ld_session_list);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1231 smb_session_timers(&sv->sv_tcp_daemon.ld_session_list);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1232 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1233 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1234
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1235 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1236 * smb_server_kstat_init
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1237 */
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1238 static void
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1239 smb_server_kstat_init(smb_server_t *sv)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1240 {
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1241 char name[KSTAT_STRLEN];
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1242
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1243 sv->sv_ksp = kstat_create_zone(SMBSRV_KSTAT_MODULE, sv->sv_zid,
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1244 SMBSRV_KSTAT_STATISTICS, SMBSRV_KSTAT_CLASS, KSTAT_TYPE_RAW,
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1245 sizeof (smbsrv_kstats_t), 0, sv->sv_zid);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1246
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1247 if (sv->sv_ksp != NULL) {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1248 sv->sv_ksp->ks_update = smb_server_kstat_update;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1249 sv->sv_ksp->ks_private = sv;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1250 ((smbsrv_kstats_t *)sv->sv_ksp->ks_data)->ks_start_time =
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1251 sv->sv_start_time;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1252 smb_dispatch_stats_init(
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1253 ((smbsrv_kstats_t *)sv->sv_ksp->ks_data)->ks_reqs);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1254 kstat_install(sv->sv_ksp);
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1255 } else {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1256 cmn_err(CE_WARN, "SMB Server: Statistics unavailable");
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1257 }
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1258
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1259 (void) snprintf(name, sizeof (name), "%s%d",
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1260 SMBSRV_KSTAT_NAME, sv->sv_zid);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1261
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1262 sv->sv_legacy_ksp = kstat_create(SMBSRV_KSTAT_MODULE, sv->sv_zid,
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1263 name, SMBSRV_KSTAT_CLASS, KSTAT_TYPE_NAMED,
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1264 sizeof (smb_server_legacy_kstat_t) / sizeof (kstat_named_t), 0);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1265
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1266 if (sv->sv_legacy_ksp != NULL) {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1267 smb_server_legacy_kstat_t *ksd;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1268
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1269 ksd = sv->sv_legacy_ksp->ks_data;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1270
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1271 (void) strlcpy(ksd->ls_files.name, "open_files",
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1272 sizeof (ksd->ls_files.name));
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1273 ksd->ls_files.data_type = KSTAT_DATA_UINT32;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1274
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1275 (void) strlcpy(ksd->ls_trees.name, "connections",
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1276 sizeof (ksd->ls_trees.name));
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1277 ksd->ls_trees.data_type = KSTAT_DATA_UINT32;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1278
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1279 (void) strlcpy(ksd->ls_users.name, "connections",
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1280 sizeof (ksd->ls_users.name));
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1281 ksd->ls_users.data_type = KSTAT_DATA_UINT32;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1282
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1283 mutex_init(&sv->sv_legacy_ksmtx, NULL, MUTEX_DEFAULT, NULL);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1284 sv->sv_legacy_ksp->ks_lock = &sv->sv_legacy_ksmtx;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1285 sv->sv_legacy_ksp->ks_update = smb_server_legacy_kstat_update;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1286 kstat_install(sv->sv_legacy_ksp);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1287 }
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1288 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1289
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1290 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1291 * smb_server_kstat_fini
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1292 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1293 static void
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1294 smb_server_kstat_fini(smb_server_t *sv)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1295 {
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1296 if (sv->sv_legacy_ksp != NULL) {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1297 kstat_delete(sv->sv_legacy_ksp);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1298 mutex_destroy(&sv->sv_legacy_ksmtx);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1299 sv->sv_legacy_ksp = NULL;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1300 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1301
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1302 if (sv->sv_ksp != NULL) {
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1303 kstat_delete(sv->sv_ksp);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1304 sv->sv_ksp = NULL;
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1305 smb_dispatch_stats_fini();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1306 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1307 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1308
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1309 /*
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1310 * smb_server_kstat_update
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1311 */
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1312 static int
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1313 smb_server_kstat_update(kstat_t *ksp, int rw)
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1314 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1315 smb_server_t *sv;
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1316 smbsrv_kstats_t *ksd;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1317
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1318 if (rw == KSTAT_READ) {
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1319 sv = ksp->ks_private;
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1320 SMB_SERVER_VALID(sv);
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1321 ksd = (smbsrv_kstats_t *)ksp->ks_data;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1322 /*
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1323 * Counters
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1324 */
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1325 ksd->ks_nbt_sess = sv->sv_nbt_sess;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1326 ksd->ks_tcp_sess = sv->sv_tcp_sess;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1327 ksd->ks_users = sv->sv_users;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1328 ksd->ks_trees = sv->sv_trees;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1329 ksd->ks_files = sv->sv_files;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1330 ksd->ks_pipes = sv->sv_pipes;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1331 /*
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1332 * Throughput
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1333 */
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1334 ksd->ks_txb = sv->sv_txb;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1335 ksd->ks_rxb = sv->sv_rxb;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1336 ksd->ks_nreq = sv->sv_nreq;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1337 /*
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1338 * Busyness
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1339 */
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1340 ksd->ks_maxreqs = sv->sv_cfg.skc_maxworkers;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1341 smb_srqueue_update(&sv->sv_srqueue,
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1342 &ksd->ks_utilization);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1343 /*
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1344 * Latency & Throughput of the requests
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1345 */
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1346 smb_dispatch_stats_update(ksd->ks_reqs, 0, SMB_COM_NUM);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1347 return (0);
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1348 }
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1349 if (rw == KSTAT_WRITE)
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1350 return (EACCES);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1351
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1352 return (EIO);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1353 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1354
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1355 static int
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1356 smb_server_legacy_kstat_update(kstat_t *ksp, int rw)
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1357 {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1358 smb_server_t *sv;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1359 smb_server_legacy_kstat_t *ksd;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1360 int rc;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1361
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1362 switch (rw) {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1363 case KSTAT_WRITE:
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1364 rc = EACCES;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1365 break;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1366 case KSTAT_READ:
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1367 if (!smb_server_lookup(&sv)) {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1368 ASSERT(MUTEX_HELD(ksp->ks_lock));
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1369 ASSERT(sv->sv_legacy_ksp == ksp);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1370 ksd = (smb_server_legacy_kstat_t *)ksp->ks_data;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1371 ksd->ls_files.value.ui32 = sv->sv_files + sv->sv_pipes;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1372 ksd->ls_trees.value.ui32 = sv->sv_trees;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1373 ksd->ls_users.value.ui32 = sv->sv_users;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1374 smb_server_release(sv);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1375 rc = 0;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1376 break;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1377 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1378 _NOTE(FALLTHRU)
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1379 default:
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1380 rc = EIO;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1381 break;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1382 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1383 return (rc);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1384
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1385 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1386
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1387 /*
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1388 * smb_server_shutdown
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1389 */
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1390 static void
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1391 smb_server_shutdown(smb_server_t *sv)
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1392 {
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1393 SMB_SERVER_VALID(sv);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1394
7052
efa04b030974 6615409 Rename appropriate structures in userland
amw
parents: 6849
diff changeset
1395 smb_opipe_door_close();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1396 smb_thread_stop(&sv->si_thread_timers);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1397 smb_kdoor_close();
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1398 smb_kshare_door_fini(sv->sv_lmshrd);
6849
56d4aff9b8ab 6650862 Streams data not visible with CIFS server via LADS (freeware) executable
jb150015
parents: 6771
diff changeset
1399 sv->sv_lmshrd = NULL;
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1400 smb_export_stop();
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1401 smb_server_fsop_stop(sv);
7588
fc605a2defdc 6736087 smb_kdoor_clnt_upcall: failed
Alan Wright <amw@Sun.COM>
parents: 7348
diff changeset
1402
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1403 smb_server_listener_stop(&sv->sv_nbt_daemon);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1404 smb_server_listener_stop(&sv->sv_tcp_daemon);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1405
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1406 if (sv->sv_session != NULL) {
13931
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1407 /*
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1408 * smb_kshare_export may have a request on here.
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1409 * Normal sessions do this in smb_session_cancel()
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1410 * but this is a "fake" session used only for the
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1411 * requests used by the kshare thread(s).
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1412 */
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1413 smb_slist_wait_for_empty(&sv->sv_session->s_req_list);
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1414
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1415 smb_session_delete(sv->sv_session);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1416 sv->sv_session = NULL;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1417 }
7588
fc605a2defdc 6736087 smb_kdoor_clnt_upcall: failed
Alan Wright <amw@Sun.COM>
parents: 7348
diff changeset
1418
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1419 if (sv->sv_receiver_pool != NULL) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1420 taskq_destroy(sv->sv_receiver_pool);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1421 sv->sv_receiver_pool = NULL;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1422 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1423
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1424 if (sv->sv_worker_pool != NULL) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1425 taskq_destroy(sv->sv_worker_pool);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1426 sv->sv_worker_pool = NULL;
7588
fc605a2defdc 6736087 smb_kdoor_clnt_upcall: failed
Alan Wright <amw@Sun.COM>
parents: 7348
diff changeset
1427 }
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1428 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1429
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1430 /*
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1431 * smb_server_listener_init
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1432 *
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1433 * Initializes listener contexts.
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1434 */
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1435 static void
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1436 smb_server_listener_init(
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1437 smb_server_t *sv,
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1438 smb_listener_daemon_t *ld,
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1439 char *name,
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1440 in_port_t port,
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1441 int family)
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1442 {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1443 ASSERT(ld->ld_magic != SMB_LISTENER_MAGIC);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1444
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1445 bzero(ld, sizeof (*ld));
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1446
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1447 ld->ld_sv = sv;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1448 ld->ld_family = family;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1449 ld->ld_port = port;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1450
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1451 if (family == AF_INET) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1452 ld->ld_sin.sin_family = (uint32_t)family;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1453 ld->ld_sin.sin_port = htons(port);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1454 ld->ld_sin.sin_addr.s_addr = htonl(INADDR_ANY);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1455 } else {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1456 ld->ld_sin6.sin6_family = (uint32_t)family;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1457 ld->ld_sin6.sin6_port = htons(port);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1458 (void) memset(&ld->ld_sin6.sin6_addr.s6_addr, 0,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1459 sizeof (ld->ld_sin6.sin6_addr.s6_addr));
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1460 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1461
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1462 smb_llist_constructor(&ld->ld_session_list, sizeof (smb_session_t),
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1463 offsetof(smb_session_t, s_lnd));
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1464 smb_thread_init(&ld->ld_thread, name, smb_server_listener, ld);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1465 ld->ld_magic = SMB_LISTENER_MAGIC;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1466 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1467
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1468 /*
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1469 * smb_server_listener_destroy
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1470 *
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1471 * Destroyes listener contexts.
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1472 */
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1473 static void
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1474 smb_server_listener_destroy(smb_listener_daemon_t *ld)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1475 {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1476 SMB_LISTENER_VALID(ld);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1477 ASSERT(ld->ld_so == NULL);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1478 smb_thread_destroy(&ld->ld_thread);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1479 smb_llist_destructor(&ld->ld_session_list);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1480 ld->ld_magic = 0;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1481 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1482
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1483 /*
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1484 * smb_server_listener_start
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1485 *
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1486 * Starts the listener associated with the context passed in.
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1487 *
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1488 * Return: 0 Success
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1489 * not 0 Failure
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1490 */
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1491 static int
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1492 smb_server_listener_start(smb_listener_daemon_t *ld)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1493 {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1494 int rc;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1495 uint32_t on;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1496 uint32_t off;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1497
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1498 SMB_LISTENER_VALID(ld);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1499
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1500 if (ld->ld_so != NULL)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1501 return (EINVAL);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1502
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1503 ld->ld_so = smb_socreate(ld->ld_family, SOCK_STREAM, 0);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1504 if (ld->ld_so == NULL) {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1505 cmn_err(CE_WARN, "port %d: socket create failed", ld->ld_port);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1506 return (ENOMEM);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1507 }
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1508
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1509 off = 0;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1510 (void) ksocket_setsockopt(ld->ld_so, SOL_SOCKET,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1511 SO_MAC_EXEMPT, &off, sizeof (off), CRED());
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1512
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1513 on = 1;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1514 (void) ksocket_setsockopt(ld->ld_so, SOL_SOCKET,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1515 SO_REUSEADDR, &on, sizeof (on), CRED());
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1516
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1517 if (ld->ld_family == AF_INET) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1518 rc = ksocket_bind(ld->ld_so,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1519 (struct sockaddr *)&ld->ld_sin,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1520 sizeof (ld->ld_sin), CRED());
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1521 } else {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1522 rc = ksocket_bind(ld->ld_so,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1523 (struct sockaddr *)&ld->ld_sin6,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1524 sizeof (ld->ld_sin6), CRED());
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1525 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1526
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1527 if (rc != 0) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1528 cmn_err(CE_WARN, "port %d: bind failed", ld->ld_port);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1529 return (rc);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1530 }
9021
3b15214a2c50 6794156 ADS messages in syslog on domain join failure are too vague
Alan Wright <amw@Sun.COM>
parents: 8934
diff changeset
1531
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1532 rc = ksocket_listen(ld->ld_so, 20, CRED());
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1533 if (rc < 0) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1534 cmn_err(CE_WARN, "port %d: listen failed", ld->ld_port);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1535 return (rc);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1536 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1537
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1538 ksocket_hold(ld->ld_so);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1539 rc = smb_thread_start(&ld->ld_thread);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1540 if (rc != 0) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1541 ksocket_rele(ld->ld_so);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1542 cmn_err(CE_WARN, "port %d: listener failed to start",
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1543 ld->ld_port);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1544 return (rc);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1545 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1546 return (0);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1547 }
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1548
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1549 /*
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1550 * smb_server_listener_stop
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1551 *
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1552 * Stops the listener associated with the context passed in.
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1553 */
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1554 static void
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1555 smb_server_listener_stop(smb_listener_daemon_t *ld)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1556 {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1557 SMB_LISTENER_VALID(ld);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1558
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1559 if (ld->ld_so != NULL) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1560 smb_soshutdown(ld->ld_so);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1561 smb_sodestroy(ld->ld_so);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1562 smb_thread_stop(&ld->ld_thread);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1563 ld->ld_so = NULL;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1564 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1565 }
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1566
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1567 /*
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1568 * smb_server_listener
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1569 *
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1570 * Entry point of the listeners.
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1571 */
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1572 static void
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1573 smb_server_listener(smb_thread_t *thread, void *arg)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1574 {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1575 _NOTE(ARGUNUSED(thread))
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1576 smb_listener_daemon_t *ld;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1577 smb_session_t *session;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1578 ksocket_t s_so;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1579 int on;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1580 int txbuf_size;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1581
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1582 ld = (smb_listener_daemon_t *)arg;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1583
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1584 SMB_LISTENER_VALID(ld);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1585
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1586 DTRACE_PROBE1(so__wait__accept, struct sonode *, ld->ld_so);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1587
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1588 while (ksocket_accept(ld->ld_so, NULL, NULL, &s_so, CRED())
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1589 == 0) {
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1590 DTRACE_PROBE1(so__accept, struct sonode *, s_so);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1591
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1592 on = 1;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1593 (void) ksocket_setsockopt(s_so, IPPROTO_TCP, TCP_NODELAY,
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1594 &on, sizeof (on), CRED());
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1595
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1596 on = 1;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1597 (void) ksocket_setsockopt(s_so, SOL_SOCKET, SO_KEEPALIVE,
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1598 &on, sizeof (on), CRED());
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1599
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1600 txbuf_size = 128*1024;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1601 (void) ksocket_setsockopt(s_so, SOL_SOCKET, SO_SNDBUF,
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1602 (const void *)&txbuf_size, sizeof (txbuf_size), CRED());
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1603
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1604 /*
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1605 * Create a session for this connection.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1606 */
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1607 smb_server_create_session(ld, s_so);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1608 }
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1609 /* Disconnect all the sessions this listener created. */
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1610 smb_llist_enter(&ld->ld_session_list, RW_READER);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1611 session = smb_llist_head(&ld->ld_session_list);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1612 while (session != NULL) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1613 smb_session_disconnect(session);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1614 session = smb_llist_next(&ld->ld_session_list, session);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1615 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1616 smb_llist_exit(&ld->ld_session_list);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1617 ksocket_rele(ld->ld_so);
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1618 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1619
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1620 /*
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1621 * smb_server_receiver
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1622 *
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1623 * Entry point of the receiver threads.
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1624 */
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1625 static void
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1626 smb_server_receiver(void *arg)
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1627 {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1628 smb_listener_daemon_t *ld;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1629 smb_session_t *session;
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1630
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1631 ld = ((smb_receiver_arg_t *)arg)->ra_listener;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1632 session = ((smb_receiver_arg_t *)arg)->ra_session;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1633 smb_mem_free(arg);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1634 smb_session_receiver(session);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1635 smb_server_destroy_session(ld, session);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1636 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1637
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1638 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1639 * smb_server_lookup
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1640 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1641 * This function tries to find the server associated with the zone of the
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1642 * caller.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1643 */
13931
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1644 int
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1645 smb_server_lookup(smb_server_t **psv)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1646 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1647 zoneid_t zid;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1648 smb_server_t *sv;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1649
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1650 zid = getzoneid();
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1651
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1652 smb_llist_enter(&smb_servers, RW_READER);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1653 sv = smb_llist_head(&smb_servers);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1654 while (sv) {
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1655 SMB_SERVER_VALID(sv);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1656 if (sv->sv_zid == zid) {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1657 mutex_enter(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1658 if (sv->sv_state != SMB_SERVER_STATE_DELETING) {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1659 sv->sv_refcnt++;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1660 mutex_exit(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1661 smb_llist_exit(&smb_servers);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1662 *psv = sv;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1663 return (0);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1664 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1665 mutex_exit(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1666 break;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1667 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1668 sv = smb_llist_next(&smb_servers, sv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1669 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1670 smb_llist_exit(&smb_servers);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1671 return (EPERM);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1672 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1673
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1674 /*
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1675 * smb_server_release
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1676 *
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1677 * This function decrements the reference count of the server and signals its
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1678 * condition variable if the state of the server is SMB_SERVER_STATE_DELETING.
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1679 */
13931
3f18ae9d8c98 3502 panic in smb_server_shutdown (sl_count assertion)
Kevin Crowe <kevin.crowe@nexenta.com>
parents: 13930
diff changeset
1680 void
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1681 smb_server_release(smb_server_t *sv)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1682 {
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1683 SMB_SERVER_VALID(sv);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1684
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1685 mutex_enter(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1686 ASSERT(sv->sv_refcnt);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1687 sv->sv_refcnt--;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1688 if ((sv->sv_refcnt == 0) && (sv->sv_state == SMB_SERVER_STATE_DELETING))
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1689 cv_signal(&sv->sv_cv);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1690 mutex_exit(&sv->sv_mutex);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1691 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1692
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1693 /*
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1694 * Enumerate the users associated with a session list.
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1695 */
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1696 static void
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1697 smb_server_enum_private(smb_llist_t *ll, smb_svcenum_t *svcenum)
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1698 {
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1699 smb_session_t *sn;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1700 smb_llist_t *ulist;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1701 smb_user_t *user;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1702 int rc = 0;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1703
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1704 smb_llist_enter(ll, RW_READER);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1705 sn = smb_llist_head(ll);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1706
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1707 while (sn != NULL) {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1708 SMB_SESSION_VALID(sn);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1709 ulist = &sn->s_user_list;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1710 smb_llist_enter(ulist, RW_READER);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1711 user = smb_llist_head(ulist);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1712
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1713 while (user != NULL) {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1714 if (smb_user_hold(user)) {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1715 rc = smb_user_enum(user, svcenum);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1716 smb_user_release(user);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1717 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1718
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1719 user = smb_llist_next(ulist, user);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1720 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1721
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1722 smb_llist_exit(ulist);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1723
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1724 if (rc != 0)
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1725 break;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1726
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1727 sn = smb_llist_next(ll, sn);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1728 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1729
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1730 smb_llist_exit(ll);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1731 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1732
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1733 /*
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1734 * Disconnect sessions associated with the specified client and username.
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1735 * Empty strings are treated as wildcards.
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1736 */
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1737 static int
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1738 smb_server_session_disconnect(smb_llist_t *ll,
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1739 const char *client, const char *name)
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1740 {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1741 smb_session_t *sn;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1742 smb_llist_t *ulist;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1743 smb_user_t *user;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1744 boolean_t match;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1745 int count = 0;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1746
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1747 smb_llist_enter(ll, RW_READER);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1748 sn = smb_llist_head(ll);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1749
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1750 while (sn != NULL) {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1751 SMB_SESSION_VALID(sn);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1752
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1753 if ((*client != '\0') && (!smb_session_isclient(sn, client))) {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1754 sn = smb_llist_next(ll, sn);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1755 continue;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1756 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1757
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1758 ulist = &sn->s_user_list;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1759 smb_llist_enter(ulist, RW_READER);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1760 user = smb_llist_head(ulist);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1761
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1762 while (user != NULL) {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1763 if (smb_user_hold(user)) {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1764 match = (*name == '\0');
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1765 if (!match)
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1766 match = smb_user_namecmp(user, name);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1767
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1768 if (match) {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1769 smb_llist_exit(ulist);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1770 smb_user_logoff(user);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1771 ++count;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1772 smb_user_release(user);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1773 smb_llist_enter(ulist, RW_READER);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1774 user = smb_llist_head(ulist);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1775 continue;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1776 }
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1777
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1778 smb_user_release(user);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1779 }
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1780
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1781 user = smb_llist_next(ulist, user);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1782 }
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1783
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1784 smb_llist_exit(ulist);
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1785 sn = smb_llist_next(ll, sn);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1786 }
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1787
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1788 smb_llist_exit(ll);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1789 return (count);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1790 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1791
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1792 /*
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1793 * Close a file by its unique id.
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1794 */
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1795 static int
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1796 smb_server_fclose(smb_llist_t *ll, uint32_t uniqid)
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1797 {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1798 smb_session_t *sn;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1799 smb_llist_t *ulist;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1800 smb_user_t *user;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1801 int rc = ENOENT;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1802
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1803 smb_llist_enter(ll, RW_READER);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1804 sn = smb_llist_head(ll);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1805
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1806 while ((sn != NULL) && (rc == ENOENT)) {
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1807 SMB_SESSION_VALID(sn);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1808 ulist = &sn->s_user_list;
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1809 smb_llist_enter(ulist, RW_READER);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1810 user = smb_llist_head(ulist);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1811
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1812 while ((user != NULL) && (rc == ENOENT)) {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1813 if (smb_user_hold(user)) {
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1814 rc = smb_user_fclose(user, uniqid);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1815 smb_user_release(user);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1816 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1817
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1818 user = smb_llist_next(ulist, user);
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1819 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1820
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1821 smb_llist_exit(ulist);
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1822 sn = smb_llist_next(ll, sn);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1823 }
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1824
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
1825 smb_llist_exit(ll);
10122
96eda55bfd54 6582152 MMC remote service management support
Jordan Brown <Jordan.Brown@Sun.COM>
parents: 10001
diff changeset
1826 return (rc);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1827 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1828
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1829 static void
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1830 smb_server_store_cfg(smb_server_t *sv, smb_ioc_cfg_t *ioc)
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1831 {
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1832 if (ioc->maxconnections == 0)
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1833 ioc->maxconnections = 0xFFFFFFFF;
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1834
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1835 smb_session_correct_keep_alive_values(
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1836 &sv->sv_nbt_daemon.ld_session_list, ioc->keepalive);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1837 smb_session_correct_keep_alive_values(
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1838 &sv->sv_tcp_daemon.ld_session_list, ioc->keepalive);
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1839
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1840 sv->sv_cfg.skc_maxworkers = ioc->maxworkers;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1841 sv->sv_cfg.skc_maxconnections = ioc->maxconnections;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1842 sv->sv_cfg.skc_keepalive = ioc->keepalive;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1843 sv->sv_cfg.skc_restrict_anon = ioc->restrict_anon;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1844 sv->sv_cfg.skc_signing_enable = ioc->signing_enable;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1845 sv->sv_cfg.skc_signing_required = ioc->signing_required;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1846 sv->sv_cfg.skc_oplock_enable = ioc->oplock_enable;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1847 sv->sv_cfg.skc_sync_enable = ioc->sync_enable;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1848 sv->sv_cfg.skc_secmode = ioc->secmode;
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1849 sv->sv_cfg.skc_ipv6_enable = ioc->ipv6_enable;
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1850 sv->sv_cfg.skc_print_enable = ioc->print_enable;
13930
f2303e5259ca 604 CIFS server should traverse child mount points
Aram Hăvărneanu <aram@nexenta.com>
parents: 13751
diff changeset
1851 sv->sv_cfg.skc_traverse_mounts = ioc->traverse_mounts;
12508
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1852 sv->sv_cfg.skc_execflags = ioc->exec_flags;
edb7861a1533 6935899 Add AD connectivity diagnostics
Alan Wright <amw@Sun.COM>
parents: 12065
diff changeset
1853 sv->sv_cfg.skc_version = ioc->version;
9832
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1854 (void) strlcpy(sv->sv_cfg.skc_nbdomain, ioc->nbdomain,
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1855 sizeof (sv->sv_cfg.skc_nbdomain));
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1856 (void) strlcpy(sv->sv_cfg.skc_fqdn, ioc->fqdn,
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1857 sizeof (sv->sv_cfg.skc_fqdn));
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1858 (void) strlcpy(sv->sv_cfg.skc_hostname, ioc->hostname,
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1859 sizeof (sv->sv_cfg.skc_hostname));
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1860 (void) strlcpy(sv->sv_cfg.skc_system_comment, ioc->system_comment,
3569b6c7f56c 6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
Alan Wright <amw@Sun.COM>
parents: 9422
diff changeset
1861 sizeof (sv->sv_cfg.skc_system_comment));
13479
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1862
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1863 if (sv->sv_cfg.skc_oplock_enable && smb_raw_mode) {
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1864 /*
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1865 * Note that these two optional protocol features
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1866 * (oplocks, raw_mode) have unfortunate interactions.
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1867 * Since raw_mode is only wanted by ancient clients,
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1868 * we just turn it off (that's what MS recommends).
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1869 * Leave some evidence in the log if someone has
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1870 * patched smb_raw_mode to enable it.
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1871 */
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1872 cmn_err(CE_NOTE,
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1873 "Raw mode enabled: Disabling opportunistic locks");
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1874 sv->sv_cfg.skc_oplock_enable = 0;
68b69d972a7f 1603 smbsrv raw mode is ill-advised
Gordon Ross <gwr@nexenta.com>
parents: 13378
diff changeset
1875 }
6139
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1876 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1877
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1878 static int
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1879 smb_server_fsop_start(smb_server_t *sv)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1880 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1881 int error;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1882
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1883 error = smb_node_root_init(rootdir, sv, &sv->si_root_smb_node);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1884 if (error != 0)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1885 sv->si_root_smb_node = NULL;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1886
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1887 return (error);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1888 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1889
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1890 static void
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1891 smb_server_fsop_stop(smb_server_t *sv)
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1892 {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1893 if (sv->si_root_smb_node != NULL) {
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1894 smb_node_release(sv->si_root_smb_node);
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1895 sv->si_root_smb_node = NULL;
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1896 }
5c743b207bf9 6541120 Configuration is not propagated to SMB kernel module
jb150015
parents:
diff changeset
1897 }
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1898
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1899 smb_event_t *
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1900 smb_event_create(int timeout)
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1901 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1902 smb_server_t *sv;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1903 smb_event_t *event;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1904
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1905 if (smb_server_is_stopping())
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1906 return (NULL);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1907
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1908 if (smb_server_lookup(&sv) != 0) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1909 cmn_err(CE_NOTE, "smb_event_create failed");
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1910 return (NULL);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1911 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1912
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1913 event = kmem_cache_alloc(sv->si_cache_event, KM_SLEEP);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1914
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1915 bzero(event, sizeof (smb_event_t));
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1916 mutex_init(&event->se_mutex, NULL, MUTEX_DEFAULT, NULL);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1917 cv_init(&event->se_cv, NULL, CV_DEFAULT, NULL);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1918 event->se_magic = SMB_EVENT_MAGIC;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1919 event->se_txid = smb_event_alloc_txid();
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1920 event->se_server = sv;
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1921 event->se_timeout = timeout;
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1922
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1923 smb_llist_enter(&sv->sv_event_list, RW_WRITER);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1924 smb_llist_insert_tail(&sv->sv_event_list, event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1925 smb_llist_exit(&sv->sv_event_list);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1926
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1927 smb_server_release(sv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1928 return (event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1929 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1930
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1931 void
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1932 smb_event_destroy(smb_event_t *event)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1933 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1934 smb_server_t *sv;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1935
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1936 if (event == NULL)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1937 return;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1938
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1939 SMB_EVENT_VALID(event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1940 ASSERT(event->se_waittime == 0);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1941
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1942 if (smb_server_lookup(&sv) != 0)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1943 return;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1944
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1945 smb_llist_enter(&sv->sv_event_list, RW_WRITER);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1946 smb_llist_remove(&sv->sv_event_list, event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1947 smb_llist_exit(&sv->sv_event_list);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1948
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1949 event->se_magic = (uint32_t)~SMB_EVENT_MAGIC;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1950 cv_destroy(&event->se_cv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1951 mutex_destroy(&event->se_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1952
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1953 kmem_cache_free(sv->si_cache_event, event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1954 smb_server_release(sv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1955 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1956
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1957 /*
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1958 * Get the txid for the specified event.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1959 */
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1960 uint32_t
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1961 smb_event_txid(smb_event_t *event)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1962 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1963 if (event != NULL) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1964 SMB_EVENT_VALID(event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1965 return (event->se_txid);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1966 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1967
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1968 cmn_err(CE_NOTE, "smb_event_txid failed");
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1969 return ((uint32_t)-1);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1970 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1971
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1972 /*
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1973 * Wait for event notification.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1974 */
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1975 int
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1976 smb_event_wait(smb_event_t *event)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1977 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1978 int seconds = 1;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1979 int ticks;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1980
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1981 if (event == NULL)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1982 return (EINVAL);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1983
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1984 SMB_EVENT_VALID(event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1985
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1986 mutex_enter(&event->se_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1987 event->se_waittime = 1;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1988 event->se_errno = 0;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1989
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1990 while (!(event->se_notified)) {
12065
0e89d02a32ea 6932404 Autohome share does not show up when using sharemgr show -vp
Keyur Desai <Keyur.Desai@Sun.COM>
parents: 11963
diff changeset
1991 if (smb_event_debug && ((event->se_waittime % 30) == 0))
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1992 cmn_err(CE_NOTE, "smb_event_wait[%d] (%d sec)",
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1993 event->se_txid, event->se_waittime);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1994
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1995 if (event->se_errno != 0)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1996 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1997
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
1998 if (event->se_waittime > event->se_timeout) {
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
1999 event->se_errno = ETIME;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2000 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2001 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2002
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2003 ticks = SEC_TO_TICK(seconds);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2004 (void) cv_reltimedwait(&event->se_cv,
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2005 &event->se_mutex, (clock_t)ticks, TR_CLOCK_TICK);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2006 ++event->se_waittime;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2007 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2008
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2009 event->se_waittime = 0;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2010 event->se_notified = B_FALSE;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2011 cv_signal(&event->se_cv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2012 mutex_exit(&event->se_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2013 return (event->se_errno);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2014 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2015
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2016 /*
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2017 * If txid is non-zero, cancel the specified event.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2018 * Otherwise, cancel all events.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2019 */
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2020 static void
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2021 smb_event_cancel(smb_server_t *sv, uint32_t txid)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2022 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2023 smb_event_t *event;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2024 smb_llist_t *event_list;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2025
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2026 SMB_SERVER_VALID(sv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2027
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2028 event_list = &sv->sv_event_list;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2029 smb_llist_enter(event_list, RW_WRITER);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2030
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2031 event = smb_llist_head(event_list);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2032 while (event) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2033 SMB_EVENT_VALID(event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2034
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2035 if (txid == 0 || event->se_txid == txid) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2036 mutex_enter(&event->se_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2037 event->se_errno = ECANCELED;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2038 event->se_notified = B_TRUE;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2039 cv_signal(&event->se_cv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2040 mutex_exit(&event->se_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2041
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2042 if (txid != 0)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2043 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2044 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2045
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2046 event = smb_llist_next(event_list, event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2047 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2048
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2049 smb_llist_exit(event_list);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2050 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2051
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2052 /*
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2053 * If txid is non-zero, notify the specified event.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2054 * Otherwise, notify all events.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2055 */
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2056 void
11963
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2057 smb_event_notify(smb_server_t *sv, uint32_t txid)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2058 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2059 smb_event_t *event;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2060 smb_llist_t *event_list;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2061
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2062 SMB_SERVER_VALID(sv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2063
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2064 event_list = &sv->sv_event_list;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2065 smb_llist_enter(event_list, RW_READER);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2066
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2067 event = smb_llist_head(event_list);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2068 while (event) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2069 SMB_EVENT_VALID(event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2070
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2071 if (txid == 0 || event->se_txid == txid) {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2072 mutex_enter(&event->se_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2073 event->se_notified = B_TRUE;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2074 cv_signal(&event->se_cv);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2075 mutex_exit(&event->se_mutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2076
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2077 if (txid != 0)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2078 break;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2079 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2080
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2081 event = smb_llist_next(event_list, event);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2082 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2083
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2084 smb_llist_exit(event_list);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2085 }
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2086
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2087 /*
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2088 * Allocate a new transaction id (txid).
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2089 *
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2090 * 0 or -1 are not assigned because they are used to detect invalid
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2091 * conditions or to indicate all open id's.
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2092 */
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2093 static uint32_t
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2094 smb_event_alloc_txid(void)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2095 {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2096 static kmutex_t txmutex;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2097 static uint32_t txid;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2098 uint32_t txid_ret;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2099
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2100 mutex_enter(&txmutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2101
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2102 if (txid == 0)
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2103 txid = ddi_get_lbolt() << 11;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2104
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2105 do {
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2106 ++txid;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2107 } while (txid == 0 || txid == (uint32_t)-1);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2108
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2109 txid_ret = txid;
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2110 mutex_exit(&txmutex);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2111
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2112 return (txid_ret);
061945695ce1 PSARC/2009/534 SMB/CIFS Standalone DFS
afshin salek ardakani - Sun Microsystems - Irvine United States <Afshin.Ardakani@Sun.COM>
parents: 10966
diff changeset
2113 }
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2114
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2115 /*
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2116 * Called by the ioctl to find the corresponding
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2117 * spooldoc node. removes node on success
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2118 *
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2119 * Return values
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2120 * rc
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2121 * B_FALSE - not found
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2122 * B_TRUE - found
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2123 *
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2124 */
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2125
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
2126 static boolean_t
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
2127 smb_spool_lookup_doc_byfid(smb_server_t *sv, uint16_t fid,
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
2128 smb_kspooldoc_t *spdoc)
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2129 {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2130 smb_kspooldoc_t *sp;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2131 smb_llist_t *splist;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2132
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2133 splist = &sv->sp_info.sp_list;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2134 smb_llist_enter(splist, RW_WRITER);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2135 sp = smb_llist_head(splist);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2136 while (sp != NULL) {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2137 /*
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2138 * check for a matching fid
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2139 */
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2140 if (sp->sd_fid == fid) {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2141 *spdoc = *sp;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2142 smb_llist_remove(splist, sp);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2143 smb_llist_exit(splist);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2144 kmem_free(sp, sizeof (smb_kspooldoc_t));
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2145 return (B_TRUE);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2146 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2147 sp = smb_llist_next(splist, sp);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2148 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2149 cmn_err(CE_WARN, "smb_spool_lookup_user_byfid: no fid:%d", fid);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2150 smb_llist_exit(splist);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2151 return (B_FALSE);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2152 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2153
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2154 /*
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2155 * Adds the spool fid to a linked list to be used
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2156 * as a search key in the spooldoc queue
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2157 *
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2158 * Return values
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2159 * rc non-zero error
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2160 * rc zero success
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2161 *
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2162 */
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2163
13751
fcb6d06601cc 2991 Allow building without SMB printing support
Gordon Ross <gwr@nexenta.com>
parents: 13515
diff changeset
2164 void
fcb6d06601cc 2991 Allow building without SMB printing support
Gordon Ross <gwr@nexenta.com>
parents: 13515
diff changeset
2165 smb_spool_add_fid(smb_server_t *sv, uint16_t fid)
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2166 {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2167 smb_llist_t *fidlist;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2168 smb_spoolfid_t *sf;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2169
13751
fcb6d06601cc 2991 Allow building without SMB printing support
Gordon Ross <gwr@nexenta.com>
parents: 13515
diff changeset
2170 if (sv->sv_cfg.skc_print_enable == 0)
fcb6d06601cc 2991 Allow building without SMB printing support
Gordon Ross <gwr@nexenta.com>
parents: 13515
diff changeset
2171 return;
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2172
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2173 sf = kmem_zalloc(sizeof (smb_spoolfid_t), KM_SLEEP);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2174 fidlist = &sv->sp_info.sp_fidlist;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2175 smb_llist_enter(fidlist, RW_WRITER);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2176 sf->sf_fid = fid;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2177 smb_llist_insert_tail(fidlist, sf);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2178 smb_llist_exit(fidlist);
13751
fcb6d06601cc 2991 Allow building without SMB printing support
Gordon Ross <gwr@nexenta.com>
parents: 13515
diff changeset
2179 cv_broadcast(&sv->sp_info.sp_cv);
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2180 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2181
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2182 /*
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2183 * Called by the ioctl to get and remove the head of the fid list
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2184 *
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2185 * Return values
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2186 * int fd
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2187 * greater than 0 success
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2188 * 0 - error
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2189 *
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2190 */
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2191
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
2192 static uint16_t
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
2193 smb_spool_get_fid(smb_server_t *sv)
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2194 {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2195 smb_spoolfid_t *spfid;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2196 smb_llist_t *splist;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2197 uint16_t fid;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2198
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2199 splist = &sv->sp_info.sp_fidlist;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2200 smb_llist_enter(splist, RW_WRITER);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2201 spfid = smb_llist_head(splist);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2202 if (spfid != NULL) {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2203 fid = spfid->sf_fid;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2204 smb_llist_remove(&sv->sp_info.sp_fidlist, spfid);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2205 kmem_free(spfid, sizeof (smb_spoolfid_t));
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2206 } else {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2207 fid = 0;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2208 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2209 smb_llist_exit(splist);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2210 return (fid);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2211 }
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2212
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2213 /*
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2214 * Adds the spooldoc to the tail of the spooldoc list
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2215 *
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2216 * Return values
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2217 * rc non-zero error
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2218 * rc zero success
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2219 */
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2220 int
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2221 smb_spool_add_doc(smb_kspooldoc_t *sp)
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2222 {
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2223 smb_llist_t *splist;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2224 smb_server_t *sv;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2225 int rc = 0;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2226
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2227 rc = smb_server_lookup(&sv);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2228 if (rc)
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2229 return (rc);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2230
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2231 splist = &sv->sp_info.sp_list;
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2232 smb_llist_enter(splist, RW_WRITER);
13378
d6c0163a1c2e 1039 /usr/lib/smbsrv/smbd prevents suspend
Gordon Ross <gwr@nexenta.com>
parents: 13169
diff changeset
2233 sp->sd_spool_num = atomic_inc_32_nv(&sv->sp_info.sp_cnt);
12902
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2234 smb_llist_insert_tail(splist, sp);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2235 smb_llist_exit(splist);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2236 smb_server_release(sv);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2237 return (rc);
16985853e3aa 6957935 Only one standalone DFS namespace should be cached
joyce mcintosh <Joyce.McIntosh@Sun.COM>
parents: 12508
diff changeset
2238 }
13169
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2239
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2240 /*
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2241 * smb_server_create_session
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2242 */
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2243 static void
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2244 smb_server_create_session(smb_listener_daemon_t *ld, ksocket_t s_so)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2245 {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2246 smb_session_t *session;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2247 smb_receiver_arg_t *rarg;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2248
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2249 session = smb_session_create(s_so, ld->ld_port, ld->ld_sv,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2250 ld->ld_family);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2251
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2252 if (session != NULL) {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2253 smb_llist_enter(&ld->ld_session_list, RW_WRITER);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2254 smb_llist_insert_tail(&ld->ld_session_list, session);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2255 smb_llist_exit(&ld->ld_session_list);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2256
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2257 rarg = (smb_receiver_arg_t *)smb_mem_alloc(
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2258 sizeof (smb_receiver_arg_t));
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2259 rarg->ra_listener = ld;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2260 rarg->ra_session = session;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2261
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2262 if (taskq_dispatch(ld->ld_sv->sv_receiver_pool,
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2263 smb_server_receiver, rarg, TQ_NOQUEUE) != 0)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2264 return;
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2265
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2266 smb_mem_free(rarg);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2267 smb_session_disconnect(session);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2268 smb_server_destroy_session(ld, session);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2269 } else {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2270 smb_soshutdown(s_so);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2271 smb_sodestroy(s_so);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2272 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2273 cmn_err(CE_WARN, "SMB Session: creation failed");
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2274 }
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2275
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2276 static void
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2277 smb_server_destroy_session(smb_listener_daemon_t *ld, smb_session_t *session)
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2278 {
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2279 smb_llist_enter(&ld->ld_session_list, RW_WRITER);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2280 smb_llist_remove(&ld->ld_session_list, session);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2281 smb_llist_exit(&ld->ld_session_list);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2282 smb_session_delete(session);
89c014c50a5f 6962953 fw_101 : assertion failed in thread_join() from smb_server_delete()
jose borrego <Jose.Borrego@Sun.COM>
parents: 12902
diff changeset
2283 }