Print this page
NEX-5736 implement autoreplace matching based on FRU slot number
NEX-6200 hot spares are not reactivated after reinserting into enclosure
NEX-9403 need to update FRU for spare and l2cache devices
NEX-9404 remove lofi autoreplace support from syseventd
NEX-9409 hotsparing doesn't work for vdevs without FRU
NEX-9424 zfs`vdev_online() needs better notification about state changes
Portions contributed by: Alek Pinchuk <alek@nexenta.com>
Portions contributed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-2846 Enable Automatic/Intelligent Hot Sparing capability
Reviewed by: Jeffry Molanus <jeffry.molanus@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/lib/libzfs/common/libzfs_fru.c
+++ new/usr/src/lib/libzfs/common/libzfs_fru.c
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.
|
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
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 /*
23 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 + * Copyright 2017 Nexenta Systems, Inc.
25 26 */
26 27
27 28 #include <dlfcn.h>
28 29 #include <errno.h>
29 30 #include <libintl.h>
30 31 #include <link.h>
31 32 #include <pthread.h>
32 33 #include <strings.h>
33 34 #include <unistd.h>
34 35
35 36 #include <libzfs.h>
36 37
37 38 #include <fm/libtopo.h>
39 +#include <fm/topo_hc.h>
38 40 #include <sys/fm/protocol.h>
39 41 #include <sys/systeminfo.h>
40 42
41 43 #include "libzfs_impl.h"
42 44
43 45 /*
44 46 * This file is responsible for determining the relationship between I/O
45 47 * devices paths and physical locations. In the world of MPxIO and external
46 48 * enclosures, the device path is not synonymous with the physical location.
47 49 * If you remove a drive and insert it into a different slot, it will end up
48 50 * with the same path under MPxIO. If you recable storage enclosures, the
49 51 * device paths may change. All of this makes it difficult to implement the
50 52 * 'autoreplace' property, which is supposed to automatically manage disk
51 53 * replacement based on physical slot.
52 54 *
53 55 * In order to work around these limitations, we have a per-vdev FRU property
54 56 * that is the libtopo path (minus disk-specific authority information) to the
55 57 * physical location of the device on the system. This is an optional
56 58 * property, and is only needed when using the 'autoreplace' property or when
57 59 * generating FMA faults against vdevs.
58 60 */
59 61
60 62 /*
61 63 * Because the FMA packages depend on ZFS, we have to dlopen() libtopo in case
62 64 * it is not present. We only need this once per library instance, so it is
63 65 * not part of the libzfs handle.
64 66 */
65 67 static void *_topo_dlhandle;
66 68 static topo_hdl_t *(*_topo_open)(int, const char *, int *);
67 69 static void (*_topo_close)(topo_hdl_t *);
68 70 static char *(*_topo_snap_hold)(topo_hdl_t *, const char *, int *);
69 71 static void (*_topo_snap_release)(topo_hdl_t *);
|
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
70 72 static topo_walk_t *(*_topo_walk_init)(topo_hdl_t *, const char *,
71 73 topo_walk_cb_t, void *, int *);
72 74 static int (*_topo_walk_step)(topo_walk_t *, int);
73 75 static void (*_topo_walk_fini)(topo_walk_t *);
74 76 static void (*_topo_hdl_strfree)(topo_hdl_t *, char *);
75 77 static char *(*_topo_node_name)(tnode_t *);
76 78 static int (*_topo_prop_get_string)(tnode_t *, const char *, const char *,
77 79 char **, int *);
78 80 static int (*_topo_node_fru)(tnode_t *, nvlist_t **, nvlist_t *, int *);
79 81 static int (*_topo_fmri_nvl2str)(topo_hdl_t *, nvlist_t *, char **, int *);
82 +static int (*_topo_fmri_str2nvl)(topo_hdl_t *, const char *, nvlist_t **,
83 + int *);
80 84 static int (*_topo_fmri_strcmp_noauth)(topo_hdl_t *, const char *,
81 85 const char *);
82 86
83 87 #define ZFS_FRU_HASH_SIZE 257
84 88
85 89 static size_t
86 90 fru_strhash(const char *key)
87 91 {
88 92 ulong_t g, h = 0;
89 93 const char *p;
90 94
91 95 for (p = key; *p != '\0'; p++) {
92 96 h = (h << 4) + *p;
93 97
94 98 if ((g = (h & 0xf0000000)) != 0) {
95 99 h ^= (g >> 24);
96 100 h ^= g;
97 101 }
98 102 }
99 103
100 104 return (h % ZFS_FRU_HASH_SIZE);
101 105 }
102 106
103 107 static int
104 108 libzfs_fru_gather(topo_hdl_t *thp, tnode_t *tn, void *arg)
105 109 {
106 110 libzfs_handle_t *hdl = arg;
107 111 nvlist_t *fru;
108 112 char *devpath, *frustr;
109 113 int err;
110 114 libzfs_fru_t *frup;
111 115 size_t idx;
112 116
113 117 /*
114 118 * If this is the chassis node, and we don't yet have the system
115 119 * chassis ID, then fill in this value now.
116 120 */
117 121 if (hdl->libzfs_chassis_id[0] == '\0' &&
118 122 strcmp(_topo_node_name(tn), "chassis") == 0) {
119 123 if (_topo_prop_get_string(tn, FM_FMRI_AUTHORITY,
120 124 FM_FMRI_AUTH_CHASSIS, &devpath, &err) == 0)
121 125 (void) strlcpy(hdl->libzfs_chassis_id, devpath,
122 126 sizeof (hdl->libzfs_chassis_id));
123 127 }
124 128
125 129 /*
126 130 * Skip non-disk nodes.
127 131 */
128 132 if (strcmp(_topo_node_name(tn), "disk") != 0)
129 133 return (TOPO_WALK_NEXT);
130 134
131 135 /*
132 136 * Get the devfs path and FRU.
133 137 */
134 138 if (_topo_prop_get_string(tn, "io", "devfs-path", &devpath, &err) != 0)
135 139 return (TOPO_WALK_NEXT);
136 140
137 141 if (libzfs_fru_lookup(hdl, devpath) != NULL) {
138 142 _topo_hdl_strfree(thp, devpath);
139 143 return (TOPO_WALK_NEXT);
140 144 }
141 145
142 146 if (_topo_node_fru(tn, &fru, NULL, &err) != 0) {
143 147 _topo_hdl_strfree(thp, devpath);
144 148 return (TOPO_WALK_NEXT);
145 149 }
146 150
147 151 /*
148 152 * Convert the FRU into a string.
149 153 */
150 154 if (_topo_fmri_nvl2str(thp, fru, &frustr, &err) != 0) {
151 155 nvlist_free(fru);
152 156 _topo_hdl_strfree(thp, devpath);
153 157 return (TOPO_WALK_NEXT);
154 158 }
155 159
156 160 nvlist_free(fru);
157 161
158 162 /*
159 163 * Finally, we have a FRU string and device path. Add it to the hash.
160 164 */
161 165 if ((frup = calloc(sizeof (libzfs_fru_t), 1)) == NULL) {
162 166 _topo_hdl_strfree(thp, devpath);
163 167 _topo_hdl_strfree(thp, frustr);
164 168 return (TOPO_WALK_NEXT);
165 169 }
166 170
167 171 if ((frup->zf_device = strdup(devpath)) == NULL ||
168 172 (frup->zf_fru = strdup(frustr)) == NULL) {
169 173 free(frup->zf_device);
170 174 free(frup);
171 175 _topo_hdl_strfree(thp, devpath);
172 176 _topo_hdl_strfree(thp, frustr);
173 177 return (TOPO_WALK_NEXT);
174 178 }
175 179
176 180 _topo_hdl_strfree(thp, devpath);
177 181 _topo_hdl_strfree(thp, frustr);
178 182
|
↓ open down ↓ |
89 lines elided |
↑ open up ↑ |
179 183 idx = fru_strhash(frup->zf_device);
180 184 frup->zf_chain = hdl->libzfs_fru_hash[idx];
181 185 hdl->libzfs_fru_hash[idx] = frup;
182 186 frup->zf_next = hdl->libzfs_fru_list;
183 187 hdl->libzfs_fru_list = frup;
184 188
185 189 return (TOPO_WALK_NEXT);
186 190 }
187 191
188 192 /*
193 + * Given a disk FRU, check that FRU contains a slot number and remove FRU
194 + * details that aren't needed when comparing FRUs by slot number.
195 + */
196 +static char *
197 +diskfru_to_slot(libzfs_handle_t *hdl, const char *diskfru)
198 +{
199 + nvlist_t *nvl, **hc;
200 + char *hc_name, *tmp = NULL;
201 + int ret, i;
202 + uint_t hc_cnt;
203 +
204 + /* string -> nvlist */
205 + if (_topo_fmri_str2nvl(hdl->libzfs_topo_hdl, diskfru, &nvl, &ret) != 0)
206 + return (NULL);
207 +
208 + /* Need slot (bay) number in the FRU */
209 + if (nvlist_lookup_nvlist_array(nvl, FM_FMRI_HC_LIST, &hc,
210 + &hc_cnt) != 0)
211 + goto out;
212 +
213 + for (i = 0; i < hc_cnt; i++) {
214 + if (nvlist_lookup_string(hc[i], FM_FMRI_HC_NAME,
215 + &hc_name) == 0 && strcmp(hc_name, BAY) == 0)
216 + break;
217 + }
218 + if (i == hc_cnt)
219 + goto out;
220 +
221 + /* Drop the unwanted components */
222 + (void) nvlist_remove_all(nvl, FM_FMRI_HC_SERIAL_ID);
223 + (void) nvlist_remove_all(nvl, FM_FMRI_HC_PART);
224 + (void) nvlist_remove_all(nvl, FM_FMRI_HC_REVISION);
225 +
226 + /* nvlist -> string */
227 + if (_topo_fmri_nvl2str(hdl->libzfs_topo_hdl, nvl, &tmp, &ret) != 0)
228 + tmp = NULL;
229 +out:
230 + nvlist_free(nvl);
231 + return (tmp);
232 +}
233 +
234 +/*
235 + * Check if given FRUs match by slot number to skip comparing disk specific
236 + * fields of the FRU.
237 + */
238 +/* ARGSUSED */
239 +int
240 +libzfs_fru_cmp_slot(libzfs_handle_t *hdl, const char *a, const char *b,
241 + size_t len)
242 +{
243 + char *slota, *slotb;
244 + int ret = -1;
245 +
246 + if (a == NULL || b == NULL)
247 + return (-1);
248 +
249 + slota = diskfru_to_slot(hdl, a);
250 + slotb = diskfru_to_slot(hdl, b);
251 +
252 + if (slota != NULL && slotb != NULL)
253 + ret = strcmp(slota, slotb);
254 +
255 + _topo_hdl_strfree(hdl->libzfs_topo_hdl, slota);
256 + _topo_hdl_strfree(hdl->libzfs_topo_hdl, slotb);
257 +
258 + return (ret);
259 +}
260 +
261 +/*
189 262 * Called during initialization to setup the dynamic libtopo connection.
190 263 */
191 264 #pragma init(libzfs_init_fru)
192 265 static void
193 266 libzfs_init_fru(void)
194 267 {
195 268 char path[MAXPATHLEN];
196 269 char isa[257];
197 270
198 271 #if defined(_LP64)
199 272 if (sysinfo(SI_ARCHITECTURE_64, isa, sizeof (isa)) < 0)
200 273 isa[0] = '\0';
201 274 #else
202 275 isa[0] = '\0';
203 276 #endif
204 277 (void) snprintf(path, sizeof (path),
205 278 "/usr/lib/fm/%s/libtopo.so", isa);
206 279
207 280 if ((_topo_dlhandle = dlopen(path, RTLD_LAZY)) == NULL)
208 281 return;
209 282
210 283 _topo_open = (topo_hdl_t *(*)())
211 284 dlsym(_topo_dlhandle, "topo_open");
212 285 _topo_close = (void (*)())
213 286 dlsym(_topo_dlhandle, "topo_close");
214 287 _topo_snap_hold = (char *(*)())
215 288 dlsym(_topo_dlhandle, "topo_snap_hold");
216 289 _topo_snap_release = (void (*)())
217 290 dlsym(_topo_dlhandle, "topo_snap_release");
218 291 _topo_walk_init = (topo_walk_t *(*)())
219 292 dlsym(_topo_dlhandle, "topo_walk_init");
220 293 _topo_walk_step = (int (*)())
221 294 dlsym(_topo_dlhandle, "topo_walk_step");
222 295 _topo_walk_fini = (void (*)())
223 296 dlsym(_topo_dlhandle, "topo_walk_fini");
|
↓ open down ↓ |
25 lines elided |
↑ open up ↑ |
224 297 _topo_hdl_strfree = (void (*)())
225 298 dlsym(_topo_dlhandle, "topo_hdl_strfree");
226 299 _topo_node_name = (char *(*)())
227 300 dlsym(_topo_dlhandle, "topo_node_name");
228 301 _topo_prop_get_string = (int (*)())
229 302 dlsym(_topo_dlhandle, "topo_prop_get_string");
230 303 _topo_node_fru = (int (*)())
231 304 dlsym(_topo_dlhandle, "topo_node_fru");
232 305 _topo_fmri_nvl2str = (int (*)())
233 306 dlsym(_topo_dlhandle, "topo_fmri_nvl2str");
307 + _topo_fmri_str2nvl = (int (*)())
308 + dlsym(_topo_dlhandle, "topo_fmri_str2nvl");
234 309 _topo_fmri_strcmp_noauth = (int (*)())
235 310 dlsym(_topo_dlhandle, "topo_fmri_strcmp_noauth");
236 311
237 312 if (_topo_open == NULL || _topo_close == NULL ||
238 313 _topo_snap_hold == NULL || _topo_snap_release == NULL ||
239 314 _topo_walk_init == NULL || _topo_walk_step == NULL ||
240 315 _topo_walk_fini == NULL || _topo_hdl_strfree == NULL ||
241 316 _topo_node_name == NULL || _topo_prop_get_string == NULL ||
242 317 _topo_node_fru == NULL || _topo_fmri_nvl2str == NULL ||
243 - _topo_fmri_strcmp_noauth == NULL) {
318 + _topo_fmri_str2nvl == NULL || _topo_fmri_strcmp_noauth == NULL) {
244 319 (void) dlclose(_topo_dlhandle);
245 320 _topo_dlhandle = NULL;
246 321 }
247 322 }
248 323
249 324 /*
250 325 * Refresh the mappings from device path -> FMRI. We do this by walking the
251 326 * hc topology looking for disk nodes, and recording the io/devfs-path and FRU.
252 327 * Note that we strip out the disk-specific authority information (serial,
253 328 * part, revision, etc) so that we are left with only the identifying
254 329 * characteristics of the slot (hc path and chassis-id).
255 330 */
256 331 void
257 332 libzfs_fru_refresh(libzfs_handle_t *hdl)
258 333 {
259 334 int err;
260 335 char *uuid;
261 336 topo_hdl_t *thp;
262 337 topo_walk_t *twp;
263 338
264 339 if (_topo_dlhandle == NULL)
265 340 return;
266 341
267 342 /*
268 343 * Clear the FRU hash and initialize our basic structures.
269 344 */
270 345 libzfs_fru_clear(hdl, B_FALSE);
271 346
272 347 if ((hdl->libzfs_topo_hdl = _topo_open(TOPO_VERSION,
273 348 NULL, &err)) == NULL)
274 349 return;
275 350
276 351 thp = hdl->libzfs_topo_hdl;
277 352
278 353 if ((uuid = _topo_snap_hold(thp, NULL, &err)) == NULL)
279 354 return;
280 355
281 356 _topo_hdl_strfree(thp, uuid);
282 357
283 358 if (hdl->libzfs_fru_hash == NULL &&
284 359 (hdl->libzfs_fru_hash =
|
↓ open down ↓ |
31 lines elided |
↑ open up ↑ |
285 360 calloc(ZFS_FRU_HASH_SIZE, sizeof (void *))) == NULL)
286 361 return;
287 362
288 363 /*
289 364 * We now have a topo snapshot, so iterate over the hc topology looking
290 365 * for disks to add to the hash.
291 366 */
292 367 twp = _topo_walk_init(thp, FM_FMRI_SCHEME_HC,
293 368 libzfs_fru_gather, hdl, &err);
294 369 if (twp != NULL) {
295 - (void) _topo_walk_step(twp, TOPO_WALK_CHILD);
370 + int status;
371 +
372 + status = _topo_walk_step(twp, TOPO_WALK_CHILD);
373 + assert(status != TOPO_WALK_NEXT);
296 374 _topo_walk_fini(twp);
297 375 }
298 376 }
299 377
300 378 /*
301 379 * Given a devfs path, return the FRU for the device, if known. This will
302 380 * automatically call libzfs_fru_refresh() if it hasn't already been called by
303 381 * the consumer. The string returned is valid until the next call to
304 382 * libzfs_fru_refresh().
305 383 */
306 384 const char *
307 385 libzfs_fru_lookup(libzfs_handle_t *hdl, const char *devpath)
308 386 {
309 387 size_t idx = fru_strhash(devpath);
310 388 libzfs_fru_t *frup;
311 389
312 390 if (hdl->libzfs_fru_hash == NULL)
313 391 libzfs_fru_refresh(hdl);
314 392
315 393 if (hdl->libzfs_fru_hash == NULL)
316 394 return (NULL);
317 395
318 396 for (frup = hdl->libzfs_fru_hash[idx]; frup != NULL;
319 397 frup = frup->zf_chain) {
320 398 if (strcmp(devpath, frup->zf_device) == 0)
321 399 return (frup->zf_fru);
322 400 }
323 401
324 402 return (NULL);
325 403 }
326 404
327 405 /*
328 406 * Given a fru path, return the device path. This will automatically call
329 407 * libzfs_fru_refresh() if it hasn't already been called by the consumer. The
330 408 * string returned is valid until the next call to libzfs_fru_refresh().
331 409 */
332 410 const char *
333 411 libzfs_fru_devpath(libzfs_handle_t *hdl, const char *fru)
334 412 {
335 413 libzfs_fru_t *frup;
336 414 size_t idx;
337 415
338 416 if (hdl->libzfs_fru_hash == NULL)
339 417 libzfs_fru_refresh(hdl);
340 418
341 419 if (hdl->libzfs_fru_hash == NULL)
342 420 return (NULL);
343 421
344 422 for (idx = 0; idx < ZFS_FRU_HASH_SIZE; idx++) {
345 423 for (frup = hdl->libzfs_fru_hash[idx]; frup != NULL;
346 424 frup = frup->zf_next) {
347 425 if (_topo_fmri_strcmp_noauth(hdl->libzfs_topo_hdl,
348 426 fru, frup->zf_fru))
349 427 return (frup->zf_device);
350 428 }
351 429 }
352 430
353 431 return (NULL);
354 432 }
355 433
356 434 /*
357 435 * Change the stored FRU for the given vdev.
358 436 */
359 437 int
360 438 zpool_fru_set(zpool_handle_t *zhp, uint64_t vdev_guid, const char *fru)
361 439 {
362 440 zfs_cmd_t zc = { 0 };
363 441
364 442 (void) strncpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
365 443 (void) strncpy(zc.zc_value, fru, sizeof (zc.zc_value));
366 444 zc.zc_guid = vdev_guid;
367 445
368 446 if (zfs_ioctl(zhp->zpool_hdl, ZFS_IOC_VDEV_SETFRU, &zc) != 0)
369 447 return (zpool_standard_error_fmt(zhp->zpool_hdl, errno,
370 448 dgettext(TEXT_DOMAIN, "cannot set FRU")));
371 449
372 450 return (0);
373 451 }
374 452
375 453 /*
376 454 * Compare to two FRUs, ignoring any authority information.
377 455 */
378 456 boolean_t
379 457 libzfs_fru_compare(libzfs_handle_t *hdl, const char *a, const char *b)
380 458 {
381 459 if (hdl->libzfs_fru_hash == NULL)
382 460 libzfs_fru_refresh(hdl);
383 461
384 462 if (hdl->libzfs_fru_hash == NULL)
385 463 return (strcmp(a, b) == 0);
386 464
387 465 return (_topo_fmri_strcmp_noauth(hdl->libzfs_topo_hdl, a, b));
388 466 }
389 467
390 468 /*
391 469 * This special function checks to see whether the FRU indicates it's supposed
392 470 * to be in the system chassis, but the chassis-id doesn't match. This can
393 471 * happen in a clustered case, where both head nodes have the same logical
394 472 * disk, but opening the device on the other head node is meaningless.
395 473 */
396 474 boolean_t
397 475 libzfs_fru_notself(libzfs_handle_t *hdl, const char *fru)
398 476 {
399 477 const char *chassisid;
400 478 size_t len;
401 479
402 480 if (hdl->libzfs_fru_hash == NULL)
403 481 libzfs_fru_refresh(hdl);
404 482
405 483 if (hdl->libzfs_chassis_id[0] == '\0')
406 484 return (B_FALSE);
407 485
408 486 if (strstr(fru, "/chassis=0/") == NULL)
409 487 return (B_FALSE);
410 488
411 489 if ((chassisid = strstr(fru, ":chassis-id=")) == NULL)
412 490 return (B_FALSE);
|
↓ open down ↓ |
107 lines elided |
↑ open up ↑ |
413 491
414 492 chassisid += 12;
415 493 len = strlen(hdl->libzfs_chassis_id);
416 494 if (strncmp(chassisid, hdl->libzfs_chassis_id, len) == 0 &&
417 495 (chassisid[len] == '/' || chassisid[len] == ':'))
418 496 return (B_FALSE);
419 497
420 498 return (B_TRUE);
421 499 }
422 500
501 +/*
502 + * Check if both FRUs belong to the same enclosure.
503 + */
504 +boolean_t
505 +libzfs_fru_cmp_enclosure(const char *fru_a, const char *fru_b)
506 +{
507 + int a, b;
508 + char *encl_a, *encl_b;
509 + const char *encl_str = "/ses-enclosure=";
510 + size_t encl_str_len = strlen(encl_str);
511 +
512 + encl_a = strstr(fru_a, encl_str);
513 + encl_b = strstr(fru_b, encl_str);
514 + /* If both FRUs don't contain enclosure field, consider it a match */
515 + if (encl_a == NULL && encl_b == NULL)
516 + return (B_TRUE);
517 + /* If one FRU has the enclosure field, but the other one doesn't */
518 + if (encl_a == NULL || encl_b == NULL)
519 + return (B_FALSE);
520 +
521 + encl_a += encl_str_len;
522 + encl_b += encl_str_len;
523 + if (sscanf(encl_a, "%d", &a) != 1 || sscanf(encl_b, "%d", &b) != 1)
524 + return (B_FALSE);
525 +
526 + return (a == b);
527 +}
528 +
423 529 /*
424 530 * Clear memory associated with the FRU hash.
425 531 */
426 532 void
427 533 libzfs_fru_clear(libzfs_handle_t *hdl, boolean_t final)
428 534 {
429 535 libzfs_fru_t *frup;
430 536
431 537 while ((frup = hdl->libzfs_fru_list) != NULL) {
432 538 hdl->libzfs_fru_list = frup->zf_next;
433 539 free(frup->zf_device);
434 540 free(frup->zf_fru);
435 541 free(frup);
436 542 }
437 543
438 544 hdl->libzfs_fru_list = NULL;
439 545
440 546 if (hdl->libzfs_topo_hdl != NULL) {
441 547 _topo_snap_release(hdl->libzfs_topo_hdl);
442 548 _topo_close(hdl->libzfs_topo_hdl);
443 549 hdl->libzfs_topo_hdl = NULL;
444 550 }
445 551
446 552 if (final) {
447 553 free(hdl->libzfs_fru_hash);
448 554 } else if (hdl->libzfs_fru_hash != NULL) {
449 555 bzero(hdl->libzfs_fru_hash,
450 556 ZFS_FRU_HASH_SIZE * sizeof (void *));
451 557 }
452 558 }
|
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX