Print this page
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Revert "NEX-5801 Snapshots left over after failed backups"
This reverts commit f182fb95f09036db71fbfc6f0a6b90469b761f21.
NEX-5801 Snapshots left over after failed backups
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-2911 NDMP logging should use syslog and is too chatty
NEX-894 Default location of NDMP log file should be under /var/log
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/cmd/ndmpd/ndmp/ndmpd_common.h
+++ new/usr/src/cmd/ndmpd/ndmp/ndmpd_common.h
1 1 /*
2 2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
3 3 */
4 4
5 5 /*
6 6 * BSD 3 Clause License
7 7 *
8 8 * Copyright (c) 2007, The Storage Networking Industry Association.
9 9 *
10 10 * Redistribution and use in source and binary forms, with or without
11 11 * modification, are permitted provided that the following conditions
12 12 * are met:
13 13 * - Redistributions of source code must retain the above copyright
14 14 * notice, this list of conditions and the following disclaimer.
15 15 *
16 16 * - Redistributions in binary form must reproduce the above copyright
17 17 * notice, this list of conditions and the following disclaimer in
18 18 * the documentation and/or other materials provided with the
19 19 * distribution.
20 20 *
21 21 * - Neither the name of The Storage Networking Industry Association (SNIA)
22 22 * nor the names of its contributors may be used to endorse or promote
23 23 * products derived from this software without specific prior written
24 24 * permission.
25 25 *
26 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 36 * POSSIBILITY OF SUCH DAMAGE.
37 37 */
38 38 /* Copyright (c) 2007, The Storage Networking Industry Association. */
|
↓ open down ↓ |
38 lines elided |
↑ open up ↑ |
39 39 /* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
40 40 /*
41 41 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
42 42 */
43 43
44 44 #ifndef _NDMP_COMMON_H
45 45 #define _NDMP_COMMON_H
46 46
47 47 #include <thread.h>
48 48 #include <synch.h>
49 -#include "ndmpd_log.h"
50 49 #include "ndmp.h"
51 50 #include <unistd.h>
52 51 #include <sys/types.h>
53 52 #include <rpc/rpc.h>
54 53 #include <sys/stat.h>
55 54 #include <stdio.h>
56 55 #include <bsm/adt.h>
57 56 #include <bsm/adt_event.h>
58 57
59 58
60 59 #define XDR_AND_SIZE(func) (bool_t(*)(XDR*, ...))xdr_##func, sizeof (func)
61 60 #define AUTH_REQUIRED TRUE
62 61 #define AUTH_NOT_REQUIRED FALSE
63 62 #define NDMP_EOM_MAGIC "PRCMEOM"
63 +#define NDMP_RCF_BASENAME "NdmpBackup"
64 64 #define KILOBYTE 1024
65 65
66 66 #define INT_MAXCMD 12
67 67
68 68 extern mutex_t ndmpd_zfs_fd_lock;
69 69
70 70 /* Connection data structure. */
71 71 typedef struct msg_info {
72 72 ndmp_header mi_hdr;
73 73 struct ndmp_msg_handler *mi_handler;
74 74 void *mi_body;
75 75 } msg_info_t;
76 76
77 77 typedef struct ndmp_connection {
78 78 int conn_sock;
79 79 XDR conn_xdrs;
80 80 ulong_t conn_my_sequence;
81 81 boolean_t conn_authorized;
82 82 boolean_t conn_eof;
83 83 msg_info_t conn_msginfo; /* received request or reply message */
84 84 ushort_t conn_version;
85 85 void *conn_client_data;
86 86 mutex_t conn_lock;
87 87 adt_session_data_t *conn_ah;
88 88 } ndmp_connection_t;
89 89
90 90 typedef void (*ndmp_con_handler_func_t) (struct ndmp_connection *);
91 91
92 92 typedef void ndmp_msg_handler_func_t(struct ndmp_connection *, void *);
93 93
94 94
95 95 typedef struct ndmp_msg_handler {
96 96 ndmp_msg_handler_func_t *mh_func;
97 97 bool_t(*mh_xdr_request) (XDR *xdrs, ...);
98 98 int mh_sizeof_request;
99 99 bool_t(*mh_xdr_reply) (XDR *xdrs, ...);
100 100 int mh_sizeof_reply;
101 101 } ndmp_msg_handler_t;
102 102
103 103 typedef struct ndmp_handler {
104 104 int hd_cnt;
105 105 struct hd_messages {
106 106 ndmp_message hm_message;
107 107 boolean_t hm_auth_required;
108 108 ndmp_msg_handler_t hm_msg_v[3];
109 109 } hd_msgs[INT_MAXCMD];
110 110 } ndmp_handler_t;
111 111
112 112 /*
113 113 * Function prototypes.
114 114 */
115 115 extern ndmp_connection_t *ndmp_create_connection(void);
116 116
117 117 extern void ndmp_destroy_connection(ndmp_connection_t *);
118 118
119 119 extern void ndmp_close(ndmp_connection_t *);
120 120
121 121 extern int ndmp_connect(ndmp_connection_t *,
122 122 char *,
123 123 ulong_t);
124 124
125 125 extern int ndmp_run(ulong_t,
126 126 ndmp_con_handler_func_t);
127 127
128 128 extern int ndmp_process_requests(ndmp_connection_t *);
129 129
130 130 extern int ndmp_send_response(ndmp_connection_t *,
131 131 ndmp_error,
132 132 void *);
133 133
134 134 extern int ndmp_send_request(ndmp_connection_t *,
135 135 ndmp_message,
136 136 ndmp_error,
137 137 void *,
138 138 void **);
139 139
140 140 extern int ndmp_send_request_lock(ndmp_connection_t *,
141 141 ndmp_message,
142 142 ndmp_error,
143 143 void *,
144 144 void **);
145 145
146 146 extern void ndmp_free_message(ndmp_connection_t *);
147 147
148 148 extern int ndmp_get_fd(ndmp_connection_t *);
149 149
150 150 extern void ndmp_set_client_data(ndmp_connection_t *,
151 151 void *);
152 152
153 153 extern void *ndmp_get_client_data(ndmp_connection_t *);
154 154
155 155 extern void ndmp_set_version(ndmp_connection_t *,
156 156 ushort_t);
157 157
158 158 extern ushort_t ndmp_get_version(ndmp_connection_t *);
159 159
160 160 extern void ndmp_set_authorized(ndmp_connection_t *,
161 161 boolean_t);
162 162
163 163
164 164 /*
165 165 * NDMP daemon callback functions.
166 166 * Called by backup/recover modules.
167 167 */
168 168 typedef char *ndmpd_get_env_func_t(void *, char *);
169 169 typedef int ndmpd_add_env_func_t(void *, char *, char *);
170 170 typedef void *ndmpd_get_name_func_t(void *, ulong_t);
171 171 typedef int ndmpd_dispatch_func_t(void *, boolean_t);
172 172 typedef void ndmpd_done_func_t(void *, int);
173 173 typedef int ndmpd_log_func_t(void *, char *, ...);
174 174
175 175 typedef int ndmpd_log_func_v3_t(void *, ndmp_log_type, ulong_t,
176 176 char *, ...);
177 177
178 178
179 179 #define NDMPD_SELECT_MODE_READ 1
180 180 #define NDMPD_SELECT_MODE_WRITE 2
181 181 #define NDMPD_SELECT_MODE_EXCEPTION 4
182 182
183 183 typedef void ndmpd_file_handler_func_t(void *, int, ulong_t);
184 184
185 185 typedef int ndmpd_add_file_handler_func_t(void *, void *, int, ulong_t,
186 186 ndmpd_file_handler_func_t *);
187 187
188 188 typedef int ndmpd_remove_file_handler_func_t(void *, int);
189 189
190 190 typedef int ndmpd_write_func_t(void *, char *, ulong_t);
191 191
192 192 typedef int ndmpd_file_history_path_func_t(void *, char *, struct stat64 *,
193 193 u_longlong_t);
194 194
195 195 typedef int ndmpd_file_history_dir_func_t(void *, char *, ulong_t,
196 196 ulong_t);
197 197
198 198 typedef int ndmpd_file_history_node_func_t(void *, ulong_t, struct stat64 *,
199 199 u_longlong_t);
200 200
201 201 typedef int ndmpd_seek_func_t(void *, u_longlong_t, u_longlong_t);
202 202
203 203 typedef int ndmpd_read_func_t(void *, char *, ulong_t);
204 204
205 205 typedef int ndmpd_file_recovered_func_t(void *, char *, int);
206 206
207 207 typedef struct ndmpd_module_stats {
208 208 u_longlong_t ms_bytes_processed;
209 209 u_longlong_t ms_est_bytes_remaining;
210 210 ulong_t ms_est_time_remaining;
211 211 } ndmpd_module_stats;
212 212
213 213 /*
214 214 * Parameter structure passed to module start function.
215 215 */
216 216 typedef struct ndmpd_module_params {
217 217 void *mp_daemon_cookie;
218 218 void **mp_module_cookie;
219 219 ushort_t mp_protocol_version;
220 220 ndmp_data_operation mp_operation;
221 221 ndmpd_module_stats *mp_stats;
222 222 ndmpd_get_env_func_t *mp_get_env_func;
223 223 ndmpd_add_env_func_t *mp_add_env_func;
224 224 ndmpd_add_env_func_t *mp_set_env_func;
225 225 ndmpd_get_name_func_t *mp_get_name_func;
226 226 ndmpd_dispatch_func_t *mp_dispatch_func;
227 227 ndmpd_done_func_t *mp_done_func;
228 228 ndmpd_log_func_t *mp_log_func;
229 229 ndmpd_add_file_handler_func_t *mp_add_file_handler_func;
230 230 ndmpd_remove_file_handler_func_t *mp_remove_file_handler_func;
231 231 ndmpd_write_func_t *mp_write_func;
232 232 ndmpd_file_history_path_func_t *mp_file_history_path_func;
233 233 ndmpd_file_history_dir_func_t *mp_file_history_dir_func;
234 234 ndmpd_file_history_node_func_t *mp_file_history_node_func;
235 235 ndmpd_read_func_t *mp_read_func;
236 236 ndmpd_seek_func_t *mp_seek_func;
237 237 ndmpd_file_recovered_func_t *mp_file_recovered_func;
238 238 /*
239 239 * NDMP V3 params.
240 240 */
241 241 ndmpd_log_func_v3_t *mp_log_func_v3;
242 242 } ndmpd_module_params_t;
243 243
244 244 #define MOD_ADDENV(m, n, v) \
245 245 (*(m)->mp_add_env_func)((m)->mp_daemon_cookie, n, v)
246 246
247 247 #define MOD_SETENV(m, n, v) \
248 248 (*(m)->mp_set_env_func)((m)->mp_daemon_cookie, n, v)
249 249
250 250 #define MOD_GETENV(m, e) \
251 251 (*(m)->mp_get_env_func)((m)->mp_daemon_cookie, e)
252 252
253 253 #define MOD_GETNAME(m, i) \
254 254 (*(m)->mp_get_name_func)((m)->mp_daemon_cookie, i)
255 255
256 256 #define MOD_LOG(m, ...) \
257 257 (*(m)->mp_log_func)((m)->mp_daemon_cookie, __VA_ARGS__)
258 258
259 259 #define MOD_READ(m, b, s) \
260 260 (*(m)->mp_read_func)((m)->mp_daemon_cookie, b, s)
261 261
262 262 #define MOD_WRITE(m, b, s) \
263 263 (*(m)->mp_write_func)((m)->mp_daemon_cookie, b, s)
264 264
265 265 #define MOD_DONE(m, e) \
266 266 (*(m)->mp_done_func)((m)->mp_daemon_cookie, e)
267 267
268 268 #define MOD_FILERECOVERD(m, n, e) \
269 269 (*(m)->mp_file_recovered_func)((m)->mp_daemon_cookie, n, e)
270 270
271 271 extern int ndmp_log_msg_id;
272 272
273 273 #define MOD_LOGV3(m, t, ...) \
274 274 (*(m)->mp_log_func_v3)((m)->mp_daemon_cookie, (t), \
275 275 ++ndmp_log_msg_id, __VA_ARGS__)
276 276
277 277 #define MOD_LOGCONTV3(m, t, ...) \
278 278 (*(m)->mp_log_func_v3)((m)->mp_daemon_cookie, \
279 279 (t), ndmp_log_msg_id, __VA_ARGS__)
280 280
281 281 /*
282 282 * Module function prototypes.
283 283 */
284 284 typedef int module_start_func_t(void *);
285 285 typedef int module_abort_func_t(void *);
286 286 #endif /* _NDMP_COMMON_H */
|
↓ open down ↓ |
213 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX