Print this page
5056 ZFS deadlock on db_mtx and dn_holds
Reviewed by: Will Andrews <willa@spectralogic.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/zfs/sys/sa.h
+++ new/usr/src/uts/common/fs/zfs/sys/sa.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
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) 2010, Oracle and/or its affiliates. All rights reserved.
23 23 */
24 24
25 25 #ifndef _SYS_SA_H
26 26 #define _SYS_SA_H
27 27
28 28 #include <sys/dmu.h>
29 29
30 30 /*
31 31 * Currently available byteswap functions.
32 32 * If it all possible new attributes should used
33 33 * one of the already defined byteswap functions.
34 34 * If a new byteswap function is added then the
35 35 * ZPL/Pool version will need to be bumped.
36 36 */
37 37
38 38 typedef enum sa_bswap_type {
39 39 SA_UINT64_ARRAY,
40 40 SA_UINT32_ARRAY,
41 41 SA_UINT16_ARRAY,
42 42 SA_UINT8_ARRAY,
43 43 SA_ACL,
44 44 } sa_bswap_type_t;
45 45
46 46 typedef uint16_t sa_attr_type_t;
47 47
48 48 /*
49 49 * Attribute to register support for.
50 50 */
51 51 typedef struct sa_attr_reg {
52 52 char *sa_name; /* attribute name */
53 53 uint16_t sa_length;
54 54 sa_bswap_type_t sa_byteswap; /* bswap functon enum */
55 55 sa_attr_type_t sa_attr; /* filled in during registration */
56 56 } sa_attr_reg_t;
57 57
58 58
59 59 typedef void (sa_data_locator_t)(void **, uint32_t *, uint32_t,
60 60 boolean_t, void *userptr);
61 61
62 62 /*
63 63 * array of attributes to store.
64 64 *
65 65 * This array should be treated as opaque/private data.
66 66 * The SA_BULK_ADD_ATTR() macro should be used for manipulating
67 67 * the array.
68 68 *
69 69 * When sa_replace_all_by_template() is used the attributes
70 70 * will be stored in the order defined in the array, except that
71 71 * the attributes may be split between the bonus and the spill buffer
72 72 *
73 73 */
74 74 typedef struct sa_bulk_attr {
75 75 void *sa_data;
76 76 sa_data_locator_t *sa_data_func;
77 77 uint16_t sa_length;
78 78 sa_attr_type_t sa_attr;
79 79 /* the following are private to the sa framework */
80 80 void *sa_addr;
81 81 uint16_t sa_buftype;
82 82 uint16_t sa_size;
83 83 } sa_bulk_attr_t;
84 84
85 85
86 86 /*
87 87 * special macro for adding entries for bulk attr support
88 88 * bulk - sa_bulk_attr_t
89 89 * count - integer that will be incremented during each add
90 90 * attr - attribute to manipulate
91 91 * func - function for accessing data.
92 92 * data - pointer to data.
93 93 * len - length of data
94 94 */
95 95
96 96 #define SA_ADD_BULK_ATTR(b, idx, attr, func, data, len) \
97 97 { \
98 98 b[idx].sa_attr = attr;\
99 99 b[idx].sa_data_func = func; \
100 100 b[idx].sa_data = data; \
101 101 b[idx++].sa_length = len; \
102 102 }
103 103
104 104 typedef struct sa_os sa_os_t;
105 105
106 106 typedef enum sa_handle_type {
107 107 SA_HDL_SHARED,
108 108 SA_HDL_PRIVATE
109 109 } sa_handle_type_t;
110 110
111 111 struct sa_handle;
112 112 typedef void *sa_lookup_tab_t;
113 113 typedef struct sa_handle sa_handle_t;
114 114
115 115 typedef void (sa_update_cb_t)(sa_handle_t *, dmu_tx_t *tx);
116 116
117 117 int sa_handle_get(objset_t *, uint64_t, void *userp,
118 118 sa_handle_type_t, sa_handle_t **);
119 119 int sa_handle_get_from_db(objset_t *, dmu_buf_t *, void *userp,
120 120 sa_handle_type_t, sa_handle_t **);
121 121 void sa_handle_destroy(sa_handle_t *);
122 122 int sa_buf_hold(objset_t *, uint64_t, void *, dmu_buf_t **);
123 123 void sa_buf_rele(dmu_buf_t *, void *);
124 124 int sa_lookup(sa_handle_t *, sa_attr_type_t, void *buf, uint32_t buflen);
125 125 int sa_update(sa_handle_t *, sa_attr_type_t, void *buf,
|
↓ open down ↓ |
125 lines elided |
↑ open up ↑ |
126 126 uint32_t buflen, dmu_tx_t *);
127 127 int sa_remove(sa_handle_t *, sa_attr_type_t, dmu_tx_t *);
128 128 int sa_bulk_lookup(sa_handle_t *, sa_bulk_attr_t *, int count);
129 129 int sa_bulk_lookup_locked(sa_handle_t *, sa_bulk_attr_t *, int count);
130 130 int sa_bulk_update(sa_handle_t *, sa_bulk_attr_t *, int count, dmu_tx_t *);
131 131 int sa_size(sa_handle_t *, sa_attr_type_t, int *);
132 132 int sa_update_from_cb(sa_handle_t *, sa_attr_type_t,
133 133 uint32_t buflen, sa_data_locator_t *, void *userdata, dmu_tx_t *);
134 134 void sa_object_info(sa_handle_t *, dmu_object_info_t *);
135 135 void sa_object_size(sa_handle_t *, uint32_t *, u_longlong_t *);
136 -void sa_update_user(sa_handle_t *, sa_handle_t *);
137 136 void *sa_get_userdata(sa_handle_t *);
138 137 void sa_set_userp(sa_handle_t *, void *);
139 138 dmu_buf_t *sa_get_db(sa_handle_t *);
140 139 uint64_t sa_handle_object(sa_handle_t *);
141 140 boolean_t sa_attr_would_spill(sa_handle_t *, sa_attr_type_t, int size);
142 141 void sa_register_update_callback(objset_t *, sa_update_cb_t *);
143 142 int sa_setup(objset_t *, uint64_t, sa_attr_reg_t *, int, sa_attr_type_t **);
144 143 void sa_tear_down(objset_t *);
145 144 int sa_replace_all_by_template(sa_handle_t *, sa_bulk_attr_t *,
146 145 int, dmu_tx_t *);
147 146 int sa_replace_all_by_template_locked(sa_handle_t *, sa_bulk_attr_t *,
148 147 int, dmu_tx_t *);
149 148 boolean_t sa_enabled(objset_t *);
150 149 void sa_cache_init();
151 150 void sa_cache_fini();
152 151 int sa_set_sa_object(objset_t *, uint64_t);
153 152 int sa_hdrsize(void *);
154 153 void sa_handle_lock(sa_handle_t *);
155 154 void sa_handle_unlock(sa_handle_t *);
156 155
157 156 #ifdef _KERNEL
158 157 int sa_lookup_uio(sa_handle_t *, sa_attr_type_t, uio_t *);
159 158 #endif
160 159
161 160 #ifdef __cplusplus
162 161 extern "C" {
163 162 #endif
164 163
165 164
166 165 #ifdef __cplusplus
167 166 }
168 167 #endif
169 168
170 169 #endif /* _SYS_SA_H */
|
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX