Print this page
NEX-5428 Backout the 5.0 changes
NEX-2937 Continuous write_same starves all other commands
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
NEX-3217 Panic running benchmark at ESX VM
NEX-3204 Panic doing FC rescan from ESXi 5.5u1 with VAAI enabled
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Tony Nguyen <tony.nguyen@nexenta.com>
NEX-3023 Panics and hangs when using write_same and compare_and_write
Review by: Bayard Bell <bayard.bell@nexenta.com>
Review by: Rick McNeal <rick.mcneal@nexenta.com>
Review by: Jean McCormack <jean.mccormack@nexenta.com>
Approved by: Jean McCormack <jean.mccormack@nexenta.com>
Related bug: NEX-2723 Kernel panic in xfer_completion code for write_same (0x93) and compare_and_write (0x89)
NEX-2178 Multi-block transfers on memory constrained systems for write_same (0x93) and compare_and_write (0x89) cause memory corruption
NEX-2105 assertion failed: (scmd->flags & SBD_SCSI_CMD_TRANS_DATA) && scmd->trans_data != NULL, file: ../../common/io/comstar/lu/stmf_sbd/sbd_scsi.c, line: 2447
SUP-698 Appliance is regularly crashing with a kernel memory allocator, duplicate free: buffer freed
NEX-2105 assertion failed: (scmd->flags & SBD_SCSI_CMD_TRANS_DATA) && scmd->trans_data != NULL, file:
NEX-1965 Page fault at netbios_first_level_name_decode+0xbb
Support simultaneous compare_and_write operations for VAAI
Bug IDs SUP-505
SUP-1768
SUP-1928
Code Reviewers:
Sarah Jelinek
Jeffry Molanus
Albert Lee
Harold Shaw
OS-69 Open source VAAI
8226 nza-kernel needs to be buildable by itself
Re #6790 backspace should perform delete on console
VAAI (XXX ATS support for COMSTAR, YYY Block-copy support for COMSTAR)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_impl.h
+++ new/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 *
24 - * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 + * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
25 25 */
26 26
27 27 #ifndef _SBD_IMPL_H
28 28 #define _SBD_IMPL_H
29 29
30 30 #ifdef __cplusplus
31 31 extern "C" {
32 32 #endif
33 33
34 34 struct register_lu_cmd;
35 35 struct modify_lu_cmd;
36 36 struct sbd_lu_attr;
37 37 struct sbd_it_data;
38 38
39 +#define ATOMIC8_GET(val) ( \
40 + (atomic_add_8_nv(&(val), 0)))
41 +#define ATOMIC32_GET(val) ( \
42 + (atomic_add_32_nv(&(val), 0)))
43 +
39 44 /*
40 45 * sms endianess
41 46 */
42 47 #define SMS_BIG_ENDIAN 0x00
43 48 #define SMS_LITTLE_ENDIAN 0xFF
44 49
45 50 #ifdef _BIG_ENDIAN
46 51 #define SMS_DATA_ORDER SMS_BIG_ENDIAN
47 52 #else
48 53 #define SMS_DATA_ORDER SMS_LITTLE_ENDIAN
49 54 #endif
50 55
51 56 /* Test if one of the BitOrder definitions exists */
52 57 #ifdef _BIT_FIELDS_LTOH
53 58 #elif defined(_BIT_FIELDS_HTOL)
54 59 #else
55 60 #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
56 61 #endif
57 62
58 63 #define SBD_V0_MAGIC 0x53554e4d4943524f
59 64 #define SBD_MAGIC 0x53554e5342444c55
60 65
61 66 typedef struct sbd_v0_meta_start {
62 67 uint64_t sm_magic; /* SBD_MAGIC */
63 68 uint64_t sm_meta_size; /* Includes everything */
64 69 } sbd_v0_meta_start_t;
65 70
66 71 typedef struct sbd_meta_start {
67 72 uint64_t sm_magic;
68 73 uint64_t sm_meta_size;
69 74 uint64_t sm_meta_size_used;
70 75 uint64_t sm_rsvd1; /* Defaults to zero */
71 76 uint64_t sm_rsvd2;
72 77 uint16_t sm_ver_major;
73 78 uint16_t sm_ver_minor;
74 79 uint16_t sm_ver_subminor;
75 80 uint8_t sm_flags; /* None at this moment */
76 81 uint8_t sm_chksum;
77 82 } sbd_meta_start_t;
78 83
79 84 typedef struct sm_v0_section_hdr {
80 85 uint64_t sms_offset; /* Offset of this section */
81 86 uint64_t sms_size; /* Includes the header and padding */
82 87 uint16_t sms_id; /* Section identifier */
83 88 uint16_t sms_padding; /* For alignment */
84 89 uint32_t sms_seqno; /* For multiple sections with same ID */
85 90 uint8_t sms_hdr_data_order; /* 0x00 or 0xff */
86 91 uint8_t sms_payload_data_order;
87 92 uint16_t rsvd2;
88 93 uint32_t rsvd3; /* 8 byte align */
89 94 } sm_v0_section_hdr_t;
90 95
91 96 /*
92 97 * sbd_it_flags
93 98 */
94 99 #define SBD_IT_HAS_SCSI2_RESERVATION 0x0001
95 100 #define SBD_IT_PGR_REGISTERED 0x0002
96 101 #define SBD_IT_PGR_EXCLUSIVE_RSV_HOLDER 0x0004
97 102 #define SBD_IT_PGR_CHECK_FLAG 0x0008
98 103
99 104 /*
100 105 * PGR flags
101 106 */
102 107 #define SBD_PGR_APTPL 0x01
103 108 #define SBD_PGR_RSVD_ONE 0x02
104 109 #define SBD_PGR_RSVD_ALL_REGISTRANTS 0x04
105 110 #define SBD_PGR_ALL_KEYS_HAS_IT 0x08
106 111
107 112 #define SBD_PGR_RSVD(pgr) (((pgr)->pgr_flags) & (SBD_PGR_RSVD_ONE | \
108 113 SBD_PGR_RSVD_ALL_REGISTRANTS))
109 114 #define SBD_PGR_RSVD_NONE(pgr) (!(SBD_PGR_RSVD(pgr)))
110 115
111 116 /*
112 117 * PGR key flags
113 118 */
114 119 #define SBD_PGR_KEY_ALL_TG_PT 0x01
115 120 #define SBD_PGR_KEY_TPT_ID_FLAG 0x02
116 121
117 122 typedef struct sbd_pgr_key_info {
118 123 uint64_t pgr_key;
119 124 uint16_t pgr_key_lpt_len;
120 125 uint16_t pgr_key_rpt_len;
121 126 uint8_t pgr_key_flags;
122 127 uint8_t pgr_key_it[1]; /* order:- initiator info followed by */
123 128 /* scsi_devid_desc of local port */
124 129 } sbd_pgr_key_info_t;
125 130
126 131 typedef struct sbd_pgr_info {
127 132 sm_section_hdr_t pgr_sms_header;
128 133 uint32_t pgr_rsvholder_indx;
129 134 uint32_t pgr_numkeys;
130 135 uint8_t pgr_flags;
131 136 uint8_t pgr_data_order;
132 137 #ifdef _BIT_FIELDS_LTOH
133 138 uint8_t pgr_rsv_type:4,
134 139 pgr_rsv_scope:4;
135 140 #else
136 141 uint8_t pgr_rsv_scope:4,
137 142 pgr_rsv_type:4;
138 143 #endif
139 144 uint8_t rsvd[5]; /* 8 byte boundary */
140 145
141 146 } sbd_pgr_info_t;
142 147
143 148 typedef struct sbd_pgr_key {
144 149 uint64_t pgr_key;
145 150 uint16_t pgr_key_lpt_len;
146 151 uint16_t pgr_key_rpt_len;
147 152 uint8_t pgr_key_flags;
148 153 struct scsi_devid_desc *pgr_key_lpt_id;
149 154 struct scsi_transport_id *pgr_key_rpt_id;
150 155 struct sbd_it_data *pgr_key_it;
151 156 struct sbd_pgr_key *pgr_key_next;
152 157 struct sbd_pgr_key *pgr_key_prev;
153 158 } sbd_pgr_key_t;
154 159
155 160 typedef struct sbd_pgr {
156 161 sbd_pgr_key_t *pgr_keylist;
157 162 sbd_pgr_key_t *pgr_rsvholder;
158 163 uint32_t pgr_PRgeneration; /* PGR PRgeneration value */
159 164 uint8_t pgr_flags; /* PGR flags (eg: APTPL) */
160 165 uint8_t pgr_rsv_type:4,
161 166 pgr_rsv_scope:4;
162 167 krwlock_t pgr_lock; /* Lock order pgr_lock, sl_lock */
163 168 } sbd_pgr_t;
164 169
165 170
166 171 typedef struct sbd_v0_lu_info {
167 172 sm_v0_section_hdr_t sli_sms_header;
168 173 uint64_t sli_total_store_size;
169 174 uint64_t sli_total_meta_size;
170 175 uint64_t rsvd0;
171 176 uint64_t sli_lu_data_offset;
172 177 uint64_t sli_lu_data_size;
173 178 uint64_t rsvd1;
174 179 uint32_t sli_flags;
175 180 uint16_t sli_blocksize;
176 181 uint16_t rsvd2;
177 182 uint8_t sli_lu_devid[20];
178 183 uint32_t rsvd3;
179 184 } sbd_v0_lu_info_t;
180 185
181 186 typedef struct sbd_lu_info {
182 187 sm_section_hdr_t sli_sms_header;
183 188 uint64_t sli_total_store_size;
184 189 uint64_t sli_total_meta_size;
185 190 uint64_t sli_lu_data_offset;
186 191 uint64_t sli_lu_data_size;
187 192 uint32_t sli_flags;
188 193 uint16_t sli_blocksize;
189 194 uint8_t sli_data_order;
190 195 uint8_t rsvd1;
191 196 uint8_t sli_lu_devid[20];
192 197 uint32_t rsvd2;
193 198 } sbd_lu_info_t;
194 199
195 200 /*
196 201 * sl_flags
197 202 */
198 203 #define SBD_LU_HAS_SCSI2_RESERVATION 0x0001
|
↓ open down ↓ |
150 lines elided |
↑ open up ↑ |
199 204
200 205 typedef struct sbd_cmd {
201 206 uint8_t flags;
202 207 uint8_t nbufs;
203 208 uint16_t cmd_type; /* Type of command */
204 209 uint32_t trans_data_len; /* Length of transient data buf */
205 210 uint64_t addr; /* current */
206 211 uint32_t len; /* len left */
207 212 uint32_t current_ro; /* running relative offset */
208 213 uint8_t *trans_data; /* Any transient data */
214 + ats_state_t *ats_state;
215 + uint32_t rsvd;
209 216 } sbd_cmd_t;
210 217
211 218 /*
212 219 * flags for sbd_cmd
220 + *
221 + * SBD_SCSI_CMD_ACTIVE means that a command is running. This is the time
222 + * between the function sbd_new_task is called and either the command
223 + * completion is sent (stmf_scsilib_send_status) or an abort is
224 + * issued
225 + *
226 + * SBD_SCSI_CMD_ABORT_REQUESTED is when a command is being aborted. It may
227 + * be set prior to the task being dispatched or anywhere in the process
228 + * of the command.
229 + *
230 + * SBD_SCSI_CMD_XFER_FAIL is set when a command data buffer transfer was
231 + * errored. Usually it leads to an abort.
232 + *
233 + * SBD_SCSI_CMD_SYNC_WRITE synchronous write being done.
234 + *
235 + * SBD_SCSI_CMD_TRANS_DATA means that a buffer has been allocated to
236 + * be used for the transfer of data.
213 237 */
214 238 #define SBD_SCSI_CMD_ACTIVE 0x01
215 239 #define SBD_SCSI_CMD_ABORT_REQUESTED 0x02
216 240 #define SBD_SCSI_CMD_XFER_FAIL 0x04
217 241 #define SBD_SCSI_CMD_SYNC_WRITE 0x08
218 242 #define SBD_SCSI_CMD_TRANS_DATA 0x10
243 +#define SBD_SCSI_CMD_ATS_RELATED 0x20
219 244
220 245 /*
221 246 * cmd types
222 247 */
223 248 #define SBD_CMD_SCSI_READ 0x01
224 249 #define SBD_CMD_SCSI_WRITE 0x02
225 250 #define SBD_CMD_SMALL_READ 0x03
226 251 #define SBD_CMD_SMALL_WRITE 0x04
227 252 #define SBD_CMD_SCSI_PR_OUT 0x05
228 253
229 254 typedef struct sbd_it_data {
230 255 struct sbd_it_data *sbd_it_next;
231 256 uint64_t sbd_it_session_id;
232 257 uint8_t sbd_it_lun[8];
233 258 uint8_t sbd_it_ua_conditions;
234 259 uint8_t sbd_it_flags;
235 260 sbd_pgr_key_t *pgr_key_ptr;
236 261 } sbd_it_data_t;
237 262
238 263 typedef struct sbd_create_standby_lu {
239 264 uint32_t stlu_meta_fname_size;
240 265 uint32_t stlu_rsvd;
241 266 uint8_t stlu_guid[16];
242 267 char stlu_meta_fname[8];
243 268 } sbd_create_standby_lu_t;
244 269
245 270 /*
246 271 * Different UA conditions
247 272 */
248 273 #define SBD_UA_POR 0x01
249 274 #define SBD_UA_CAPACITY_CHANGED 0x02
250 275 #define SBD_UA_MODE_PARAMETERS_CHANGED 0x04
251 276 #define SBD_UA_ACCESS_STATE_TRANSITION 0x08
252 277 #define SBD_UA_REGISTRATIONS_PREEMPTED 0x10
253 278 #define SBD_UA_RESERVATIONS_PREEMPTED 0x20
254 279 #define SBD_UA_RESERVATIONS_RELEASED 0x40
255 280 #define SBD_UA_ASYMMETRIC_ACCESS_CHANGED 0x80
256 281
257 282 /*
258 283 * sbd_it_flags
259 284 */
260 285 #define SBD_IT_HAS_SCSI2_RESERVATION 0x0001
261 286
262 287 /*
263 288 * dbuf private data needed for direct zvol data transfers
264 289 *
265 290 * To further isolate the zvol knowledge, the object handles
266 291 * needed to call into zfs are declared void * here.
267 292 */
268 293
269 294 typedef struct sbd_zvol_io {
270 295 uint64_t zvio_offset; /* offset into volume */
271 296 int zvio_flags; /* flags */
272 297 void *zvio_dbp; /* array of dmu buffers */
273 298 void *zvio_abp; /* array of arc buffers */
274 299 uio_t *zvio_uio; /* for copy operations */
275 300 } sbd_zvol_io_t;
276 301
277 302 #define ZVIO_DEFAULT 0
278 303 #define ZVIO_COMMIT 1
279 304 #define ZVIO_ABORT 2
280 305 #define ZVIO_SYNC 4
281 306 #define ZVIO_ASYNC 8
282 307
283 308 /*
284 309 * zvol data path functions
285 310 */
286 311 int sbd_zvol_get_volume_params(sbd_lu_t *sl);
287 312 uint32_t sbd_zvol_numsegs(sbd_lu_t *sl, uint64_t off, uint32_t len);
288 313 int sbd_zvol_alloc_read_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
289 314 void sbd_zvol_rele_read_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
290 315 int sbd_zvol_alloc_write_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
291 316 void sbd_zvol_rele_write_bufs_abort(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
292 317 int sbd_zvol_rele_write_bufs(sbd_lu_t *sl, stmf_data_buf_t *dbuf);
|
↓ open down ↓ |
64 lines elided |
↑ open up ↑ |
293 318 int sbd_zvol_copy_read(sbd_lu_t *sl, uio_t *uio);
294 319 int sbd_zvol_copy_write(sbd_lu_t *sl, uio_t *uio, int flags);
295 320
296 321 stmf_status_t sbd_task_alloc(struct scsi_task *task);
297 322 void sbd_new_task(struct scsi_task *task, struct stmf_data_buf *initial_dbuf);
298 323 void sbd_dbuf_xfer_done(struct scsi_task *task, struct stmf_data_buf *dbuf);
299 324 void sbd_send_status_done(struct scsi_task *task);
300 325 void sbd_task_free(struct scsi_task *task);
301 326 stmf_status_t sbd_abort(struct stmf_lu *lu, int abort_cmd, void *arg,
302 327 uint32_t flags);
328 +void sbd_task_poll(struct scsi_task *task);
303 329 void sbd_dbuf_free(struct scsi_task *task, struct stmf_data_buf *dbuf);
304 330 void sbd_ctl(struct stmf_lu *lu, int cmd, void *arg);
305 331 stmf_status_t sbd_info(uint32_t cmd, stmf_lu_t *lu, void *arg,
306 332 uint8_t *buf, uint32_t *bufsizep);
333 +uint8_t sbd_get_lbasize_shift(stmf_lu_t *lu);
334 +int sbd_is_valid_lu(stmf_lu_t *lu);
307 335
308 336 #ifdef __cplusplus
309 337 }
310 338 #endif
311 339
312 340 #endif /* _SBD_IMPL_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX