Mercurial > illumos > illumos-gate
annotate usr/src/uts/common/fs/zfs/dmu_send.c @ 13765:9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
author | Richard Lowe <richlowe@richlowe.net> |
---|---|
date | Wed, 01 Aug 2012 16:40:39 -0400 |
parents | 38b4aca480b3 |
children | cd512c80fd75 |
rev | line source |
---|---|
2743 | 1 /* |
2 * CDDL HEADER START | |
3 * | |
4 * The contents of this file are subject to the terms of the | |
5 * Common Development and Distribution License (the "License"). | |
6 * You may not use this file except in compliance with the License. | |
7 * | |
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
9 * or http://www.opensolaris.org/os/licensing. | |
10 * See the License for the specific language governing permissions | |
11 * and limitations under the License. | |
12 * | |
13 * When distributing Covered Code, include this CDDL HEADER in each | |
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. | |
15 * If applicable, add the following below this CDDL HEADER, with the | |
16 * fields enclosed by brackets "[]" replaced with your own identifying | |
17 * information: Portions Copyright [yyyy] [name of copyright owner] | |
18 * | |
19 * CDDL HEADER END | |
20 */ | |
21 /* | |
12070
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
13329
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved. |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
24 * Copyright (c) 2012 by Delphix. All rights reserved. |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
25 * Copyright (c) 2012, Joyent, Inc. All rights reserved. |
13329
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
26 */ |
2743 | 27 |
28 #include <sys/dmu.h> | |
29 #include <sys/dmu_impl.h> | |
30 #include <sys/dmu_tx.h> | |
31 #include <sys/dbuf.h> | |
32 #include <sys/dnode.h> | |
33 #include <sys/zfs_context.h> | |
34 #include <sys/dmu_objset.h> | |
35 #include <sys/dmu_traverse.h> | |
36 #include <sys/dsl_dataset.h> | |
37 #include <sys/dsl_dir.h> | |
11022
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
38 #include <sys/dsl_prop.h> |
2743 | 39 #include <sys/dsl_pool.h> |
40 #include <sys/dsl_synctask.h> | |
41 #include <sys/zfs_ioctl.h> | |
42 #include <sys/zap.h> | |
43 #include <sys/zio_checksum.h> | |
12070
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
44 #include <sys/zfs_znode.h> |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
45 #include <zfs_fletcher.h> |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
46 #include <sys/avl.h> |
11381
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
47 #include <sys/ddt.h> |
12527
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
48 #include <sys/zfs_onexit.h> |
2743 | 49 |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
50 /* Set this tunable to TRUE to replace corrupt data with 0x2f5baddb10c */ |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
51 int zfs_send_corrupt_data = B_FALSE; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
52 |
5367 | 53 static char *dmu_recv_tag = "dmu_recv_tag"; |
54 | |
2743 | 55 static int |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
56 dump_bytes(dmu_sendarg_t *dsp, void *buf, int len) |
2743 | 57 { |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
58 dsl_dataset_t *ds = dsp->dsa_os->os_dsl_dataset; |
2743 | 59 ssize_t resid; /* have to get resid to get detailed errno */ |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
60 ASSERT3U(len % 8, ==, 0); |
2743 | 61 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
62 fletcher_4_incremental_native(buf, len, &dsp->dsa_zc); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
63 dsp->dsa_err = vn_rdwr(UIO_WRITE, dsp->dsa_vp, |
2743 | 64 (caddr_t)buf, len, |
65 0, UIO_SYSSPACE, FAPPEND, RLIM64_INFINITY, CRED(), &resid); | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
66 |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
67 mutex_enter(&ds->ds_sendstream_lock); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
68 *dsp->dsa_off += len; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
69 mutex_exit(&ds->ds_sendstream_lock); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
70 |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
71 return (dsp->dsa_err); |
2743 | 72 } |
73 | |
74 static int | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
75 dump_free(dmu_sendarg_t *dsp, uint64_t object, uint64_t offset, |
2743 | 76 uint64_t length) |
77 { | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
78 struct drr_free *drrf = &(dsp->dsa_drr->drr_u.drr_free); |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
79 |
13736
9f1d48e1681f
2901 ZFS receive fails for exabyte sparse files
Simon Klinkert <klinkert@webgods.de>
parents:
13700
diff
changeset
|
80 if (length != -1ULL && offset + length < offset) |
9f1d48e1681f
2901 ZFS receive fails for exabyte sparse files
Simon Klinkert <klinkert@webgods.de>
parents:
13700
diff
changeset
|
81 length = -1ULL; |
9f1d48e1681f
2901 ZFS receive fails for exabyte sparse files
Simon Klinkert <klinkert@webgods.de>
parents:
13700
diff
changeset
|
82 |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
83 /* |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
84 * If there is a pending op, but it's not PENDING_FREE, push it out, |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
85 * since free block aggregation can only be done for blocks of the |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
86 * same type (i.e., DRR_FREE records can only be aggregated with |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
87 * other DRR_FREE records. DRR_FREEOBJECTS records can only be |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
88 * aggregated with other DRR_FREEOBJECTS records. |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
89 */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
90 if (dsp->dsa_pending_op != PENDING_NONE && |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
91 dsp->dsa_pending_op != PENDING_FREE) { |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
92 if (dump_bytes(dsp, dsp->dsa_drr, |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
93 sizeof (dmu_replay_record_t)) != 0) |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
94 return (EINTR); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
95 dsp->dsa_pending_op = PENDING_NONE; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
96 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
97 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
98 if (dsp->dsa_pending_op == PENDING_FREE) { |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
99 /* |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
100 * There should never be a PENDING_FREE if length is -1 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
101 * (because dump_dnode is the only place where this |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
102 * function is called with a -1, and only after flushing |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
103 * any pending record). |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
104 */ |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
105 ASSERT(length != -1ULL); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
106 /* |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
107 * Check to see whether this free block can be aggregated |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
108 * with pending one. |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
109 */ |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
110 if (drrf->drr_object == object && drrf->drr_offset + |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
111 drrf->drr_length == offset) { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
112 drrf->drr_length += length; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
113 return (0); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
114 } else { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
115 /* not a continuation. Push out pending record */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
116 if (dump_bytes(dsp, dsp->dsa_drr, |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
117 sizeof (dmu_replay_record_t)) != 0) |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
118 return (EINTR); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
119 dsp->dsa_pending_op = PENDING_NONE; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
120 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
121 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
122 /* create a FREE record and make it pending */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
123 bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t)); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
124 dsp->dsa_drr->drr_type = DRR_FREE; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
125 drrf->drr_object = object; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
126 drrf->drr_offset = offset; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
127 drrf->drr_length = length; |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
128 drrf->drr_toguid = dsp->dsa_toguid; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
129 if (length == -1ULL) { |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
130 if (dump_bytes(dsp, dsp->dsa_drr, |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
131 sizeof (dmu_replay_record_t)) != 0) |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
132 return (EINTR); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
133 } else { |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
134 dsp->dsa_pending_op = PENDING_FREE; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
135 } |
2743 | 136 |
137 return (0); | |
138 } | |
139 | |
140 static int | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
141 dump_data(dmu_sendarg_t *dsp, dmu_object_type_t type, |
11381
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
142 uint64_t object, uint64_t offset, int blksz, const blkptr_t *bp, void *data) |
2743 | 143 { |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
144 struct drr_write *drrw = &(dsp->dsa_drr->drr_u.drr_write); |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
145 |
11381
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
146 |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
147 /* |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
148 * If there is any kind of pending aggregation (currently either |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
149 * a grouping of free objects or free blocks), push it out to |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
150 * the stream, since aggregation can't be done across operations |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
151 * of different types. |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
152 */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
153 if (dsp->dsa_pending_op != PENDING_NONE) { |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
154 if (dump_bytes(dsp, dsp->dsa_drr, |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
155 sizeof (dmu_replay_record_t)) != 0) |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
156 return (EINTR); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
157 dsp->dsa_pending_op = PENDING_NONE; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
158 } |
2743 | 159 /* write a DATA record */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
160 bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t)); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
161 dsp->dsa_drr->drr_type = DRR_WRITE; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
162 drrw->drr_object = object; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
163 drrw->drr_type = type; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
164 drrw->drr_offset = offset; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
165 drrw->drr_length = blksz; |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
166 drrw->drr_toguid = dsp->dsa_toguid; |
11381
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
167 drrw->drr_checksumtype = BP_GET_CHECKSUM(bp); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
168 if (zio_checksum_table[drrw->drr_checksumtype].ci_dedup) |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
169 drrw->drr_checksumflags |= DRR_CHECKSUM_DEDUP; |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
170 DDK_SET_LSIZE(&drrw->drr_key, BP_GET_LSIZE(bp)); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
171 DDK_SET_PSIZE(&drrw->drr_key, BP_GET_PSIZE(bp)); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
172 DDK_SET_COMPRESS(&drrw->drr_key, BP_GET_COMPRESS(bp)); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
173 drrw->drr_key.ddk_cksum = bp->blk_cksum; |
2743 | 174 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
175 if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0) |
2743 | 176 return (EINTR); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
177 if (dump_bytes(dsp, data, blksz) != 0) |
2743 | 178 return (EINTR); |
179 return (0); | |
180 } | |
181 | |
182 static int | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
183 dump_spill(dmu_sendarg_t *dsp, uint64_t object, int blksz, void *data) |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
184 { |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
185 struct drr_spill *drrs = &(dsp->dsa_drr->drr_u.drr_spill); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
186 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
187 if (dsp->dsa_pending_op != PENDING_NONE) { |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
188 if (dump_bytes(dsp, dsp->dsa_drr, |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
189 sizeof (dmu_replay_record_t)) != 0) |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
190 return (EINTR); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
191 dsp->dsa_pending_op = PENDING_NONE; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
192 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
193 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
194 /* write a SPILL record */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
195 bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t)); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
196 dsp->dsa_drr->drr_type = DRR_SPILL; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
197 drrs->drr_object = object; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
198 drrs->drr_length = blksz; |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
199 drrs->drr_toguid = dsp->dsa_toguid; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
200 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
201 if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t))) |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
202 return (EINTR); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
203 if (dump_bytes(dsp, data, blksz)) |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
204 return (EINTR); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
205 return (0); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
206 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
207 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
208 static int |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
209 dump_freeobjects(dmu_sendarg_t *dsp, uint64_t firstobj, uint64_t numobjs) |
2743 | 210 { |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
211 struct drr_freeobjects *drrfo = &(dsp->dsa_drr->drr_u.drr_freeobjects); |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
212 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
213 /* |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
214 * If there is a pending op, but it's not PENDING_FREEOBJECTS, |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
215 * push it out, since free block aggregation can only be done for |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
216 * blocks of the same type (i.e., DRR_FREE records can only be |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
217 * aggregated with other DRR_FREE records. DRR_FREEOBJECTS records |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
218 * can only be aggregated with other DRR_FREEOBJECTS records. |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
219 */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
220 if (dsp->dsa_pending_op != PENDING_NONE && |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
221 dsp->dsa_pending_op != PENDING_FREEOBJECTS) { |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
222 if (dump_bytes(dsp, dsp->dsa_drr, |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
223 sizeof (dmu_replay_record_t)) != 0) |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
224 return (EINTR); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
225 dsp->dsa_pending_op = PENDING_NONE; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
226 } |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
227 if (dsp->dsa_pending_op == PENDING_FREEOBJECTS) { |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
228 /* |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
229 * See whether this free object array can be aggregated |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
230 * with pending one |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
231 */ |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
232 if (drrfo->drr_firstobj + drrfo->drr_numobjs == firstobj) { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
233 drrfo->drr_numobjs += numobjs; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
234 return (0); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
235 } else { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
236 /* can't be aggregated. Push out pending record */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
237 if (dump_bytes(dsp, dsp->dsa_drr, |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
238 sizeof (dmu_replay_record_t)) != 0) |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
239 return (EINTR); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
240 dsp->dsa_pending_op = PENDING_NONE; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
241 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
242 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
243 |
2743 | 244 /* write a FREEOBJECTS record */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
245 bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t)); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
246 dsp->dsa_drr->drr_type = DRR_FREEOBJECTS; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
247 drrfo->drr_firstobj = firstobj; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
248 drrfo->drr_numobjs = numobjs; |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
249 drrfo->drr_toguid = dsp->dsa_toguid; |
2743 | 250 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
251 dsp->dsa_pending_op = PENDING_FREEOBJECTS; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
252 |
2743 | 253 return (0); |
254 } | |
255 | |
256 static int | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
257 dump_dnode(dmu_sendarg_t *dsp, uint64_t object, dnode_phys_t *dnp) |
2743 | 258 { |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
259 struct drr_object *drro = &(dsp->dsa_drr->drr_u.drr_object); |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
260 |
2743 | 261 if (dnp == NULL || dnp->dn_type == DMU_OT_NONE) |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
262 return (dump_freeobjects(dsp, object, 1)); |
2743 | 263 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
264 if (dsp->dsa_pending_op != PENDING_NONE) { |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
265 if (dump_bytes(dsp, dsp->dsa_drr, |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
266 sizeof (dmu_replay_record_t)) != 0) |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
267 return (EINTR); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
268 dsp->dsa_pending_op = PENDING_NONE; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
269 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
270 |
2743 | 271 /* write an OBJECT record */ |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
272 bzero(dsp->dsa_drr, sizeof (dmu_replay_record_t)); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
273 dsp->dsa_drr->drr_type = DRR_OBJECT; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
274 drro->drr_object = object; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
275 drro->drr_type = dnp->dn_type; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
276 drro->drr_bonustype = dnp->dn_bonustype; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
277 drro->drr_blksz = dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
278 drro->drr_bonuslen = dnp->dn_bonuslen; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
279 drro->drr_checksumtype = dnp->dn_checksum; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
280 drro->drr_compress = dnp->dn_compress; |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
281 drro->drr_toguid = dsp->dsa_toguid; |
2743 | 282 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
283 if (dump_bytes(dsp, dsp->dsa_drr, sizeof (dmu_replay_record_t)) != 0) |
2743 | 284 return (EINTR); |
285 | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
286 if (dump_bytes(dsp, DN_BONUS(dnp), P2ROUNDUP(dnp->dn_bonuslen, 8)) != 0) |
2743 | 287 return (EINTR); |
288 | |
289 /* free anything past the end of the file */ | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
290 if (dump_free(dsp, object, (dnp->dn_maxblkid + 1) * |
2743 | 291 (dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT), -1ULL)) |
292 return (EINTR); | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
293 if (dsp->dsa_err) |
2743 | 294 return (EINTR); |
295 return (0); | |
296 } | |
297 | |
298 #define BP_SPAN(dnp, level) \ | |
299 (((uint64_t)dnp->dn_datablkszsec) << (SPA_MINBLOCKSHIFT + \ | |
300 (level) * (dnp->dn_indblkshift - SPA_BLKPTRSHIFT))) | |
301 | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10819
diff
changeset
|
302 /* ARGSUSED */ |
2743 | 303 static int |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
304 backup_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf, |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10819
diff
changeset
|
305 const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) |
2743 | 306 { |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
307 dmu_sendarg_t *dsp = arg; |
2743 | 308 dmu_object_type_t type = bp ? BP_GET_TYPE(bp) : DMU_OT_NONE; |
309 int err = 0; | |
310 | |
311 if (issig(JUSTLOOKING) && issig(FORREAL)) | |
312 return (EINTR); | |
313 | |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10819
diff
changeset
|
314 if (zb->zb_object != DMU_META_DNODE_OBJECT && |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10819
diff
changeset
|
315 DMU_OBJECT_IS_SPECIAL(zb->zb_object)) { |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8986
diff
changeset
|
316 return (0); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10819
diff
changeset
|
317 } else if (bp == NULL && zb->zb_object == DMU_META_DNODE_OBJECT) { |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
318 uint64_t span = BP_SPAN(dnp, zb->zb_level); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
319 uint64_t dnobj = (zb->zb_blkid * span) >> DNODE_SHIFT; |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
320 err = dump_freeobjects(dsp, dnobj, span >> DNODE_SHIFT); |
2743 | 321 } else if (bp == NULL) { |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
322 uint64_t span = BP_SPAN(dnp, zb->zb_level); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
323 err = dump_free(dsp, zb->zb_object, zb->zb_blkid * span, span); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
324 } else if (zb->zb_level > 0 || type == DMU_OT_OBJSET) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
325 return (0); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
326 } else if (type == DMU_OT_DNODE) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
327 dnode_phys_t *blk; |
2743 | 328 int i; |
329 int blksz = BP_GET_LSIZE(bp); | |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
330 uint32_t aflags = ARC_WAIT; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
331 arc_buf_t *abuf; |
2743 | 332 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
333 if (dsl_read(NULL, spa, bp, pbuf, |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
334 arc_getbuf_func, &abuf, ZIO_PRIORITY_ASYNC_READ, |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
335 ZIO_FLAG_CANFAIL, &aflags, zb) != 0) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
336 return (EIO); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
337 |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
338 blk = abuf->b_data; |
2743 | 339 for (i = 0; i < blksz >> DNODE_SHIFT; i++) { |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
340 uint64_t dnobj = (zb->zb_blkid << |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
341 (DNODE_BLOCK_SHIFT - DNODE_SHIFT)) + i; |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
342 err = dump_dnode(dsp, dnobj, blk+i); |
2743 | 343 if (err) |
344 break; | |
345 } | |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
346 (void) arc_buf_remove_ref(abuf, &abuf); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
347 } else if (type == DMU_OT_SA) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
348 uint32_t aflags = ARC_WAIT; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
349 arc_buf_t *abuf; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
350 int blksz = BP_GET_LSIZE(bp); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
351 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
352 if (arc_read_nolock(NULL, spa, bp, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
353 arc_getbuf_func, &abuf, ZIO_PRIORITY_ASYNC_READ, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
354 ZIO_FLAG_CANFAIL, &aflags, zb) != 0) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
355 return (EIO); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
356 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
357 err = dump_spill(dsp, zb->zb_object, blksz, abuf->b_data); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
358 (void) arc_buf_remove_ref(abuf, &abuf); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
359 } else { /* it's a level-0 block of a regular object */ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
360 uint32_t aflags = ARC_WAIT; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
361 arc_buf_t *abuf; |
2743 | 362 int blksz = BP_GET_LSIZE(bp); |
363 | |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
364 if (dsl_read(NULL, spa, bp, pbuf, |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
365 arc_getbuf_func, &abuf, ZIO_PRIORITY_ASYNC_READ, |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
366 ZIO_FLAG_CANFAIL, &aflags, zb) != 0) { |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
367 if (zfs_send_corrupt_data) { |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
368 /* Send a block filled with 0x"zfs badd bloc" */ |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
369 abuf = arc_buf_alloc(spa, blksz, &abuf, |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
370 ARC_BUFC_DATA); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
371 uint64_t *ptr; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
372 for (ptr = abuf->b_data; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
373 (char *)ptr < (char *)abuf->b_data + blksz; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
374 ptr++) |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
375 *ptr = 0x2f5baddb10c; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
376 } else { |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
377 return (EIO); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
378 } |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
379 } |
2743 | 380 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
381 err = dump_data(dsp, type, zb->zb_object, zb->zb_blkid * blksz, |
11381
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
382 blksz, bp, abuf->b_data); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
383 (void) arc_buf_remove_ref(abuf, &abuf); |
2743 | 384 } |
385 | |
386 ASSERT(err == 0 || err == EINTR); | |
387 return (err); | |
388 } | |
389 | |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
390 /* |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
391 * Return TRUE if 'earlier' is an earlier snapshot in 'later's timeline. |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
392 * For example, they could both be snapshots of the same filesystem, and |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
393 * 'earlier' is before 'later'. Or 'earlier' could be the origin of |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
394 * 'later's filesystem. Or 'earlier' could be an older snapshot in the origin's |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
395 * filesystem. Or 'earlier' could be the origin's origin. |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
396 */ |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
397 static boolean_t |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
398 is_before(dsl_dataset_t *later, dsl_dataset_t *earlier) |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
399 { |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
400 dsl_pool_t *dp = later->ds_dir->dd_pool; |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
401 int error; |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
402 boolean_t ret; |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
403 dsl_dataset_t *origin; |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
404 |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
405 if (earlier->ds_phys->ds_creation_txg >= |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
406 later->ds_phys->ds_creation_txg) |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
407 return (B_FALSE); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
408 |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
409 if (later->ds_dir == earlier->ds_dir) |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
410 return (B_TRUE); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
411 if (!dsl_dir_is_clone(later->ds_dir)) |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
412 return (B_FALSE); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
413 |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
414 rw_enter(&dp->dp_config_rwlock, RW_READER); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
415 if (later->ds_dir->dd_phys->dd_origin_obj == earlier->ds_object) { |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
416 rw_exit(&dp->dp_config_rwlock); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
417 return (B_TRUE); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
418 } |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
419 error = dsl_dataset_hold_obj(dp, |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
420 later->ds_dir->dd_phys->dd_origin_obj, FTAG, &origin); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
421 rw_exit(&dp->dp_config_rwlock); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
422 if (error != 0) |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
423 return (B_FALSE); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
424 ret = is_before(origin, earlier); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
425 dsl_dataset_rele(origin, FTAG); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
426 return (ret); |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
427 } |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
428 |
2743 | 429 int |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
430 dmu_send(objset_t *tosnap, objset_t *fromsnap, int outfd, vnode_t *vp, |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
431 offset_t *off) |
2743 | 432 { |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
433 dsl_dataset_t *ds = tosnap->os_dsl_dataset; |
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
434 dsl_dataset_t *fromds = fromsnap ? fromsnap->os_dsl_dataset : NULL; |
2743 | 435 dmu_replay_record_t *drr; |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
436 dmu_sendarg_t *dsp; |
2743 | 437 int err; |
5367 | 438 uint64_t fromtxg = 0; |
2743 | 439 |
440 /* tosnap must be a snapshot */ | |
441 if (ds->ds_phys->ds_next_snap_obj == 0) | |
442 return (EINVAL); | |
443 | |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
444 /* |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
445 * fromsnap must be an earlier snapshot from the same fs as tosnap, |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
446 * or the origin's fs. |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
447 */ |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
448 if (fromds != NULL && !is_before(ds, fromds)) |
2743 | 449 return (EXDEV); |
450 | |
451 drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP); | |
452 drr->drr_type = DRR_BEGIN; | |
453 drr->drr_u.drr_begin.drr_magic = DMU_BACKUP_MAGIC; | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
454 DMU_SET_STREAM_HDRTYPE(drr->drr_u.drr_begin.drr_versioninfo, |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
455 DMU_SUBSTREAM); |
12070
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
456 |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
457 #ifdef _KERNEL |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
458 if (dmu_objset_type(tosnap) == DMU_OST_ZFS) { |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
459 uint64_t version; |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
460 if (zfs_get_zplprop(tosnap, ZFS_PROP_VERSION, &version) != 0) { |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
461 kmem_free(drr, sizeof (dmu_replay_record_t)); |
12070
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
462 return (EINVAL); |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
463 } |
12070
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
464 if (version == ZPL_VERSION_SA) { |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
465 DMU_SET_FEATUREFLAGS( |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
466 drr->drr_u.drr_begin.drr_versioninfo, |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
467 DMU_BACKUP_FEATURE_SA_SPILL); |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
468 } |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
469 } |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
470 #endif |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
471 |
2743 | 472 drr->drr_u.drr_begin.drr_creation_time = |
473 ds->ds_phys->ds_creation_time; | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
474 drr->drr_u.drr_begin.drr_type = tosnap->os_phys->os_type; |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
475 if (fromds != NULL && ds->ds_dir != fromds->ds_dir) |
5367 | 476 drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_CLONE; |
2743 | 477 drr->drr_u.drr_begin.drr_toguid = ds->ds_phys->ds_guid; |
6492
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6479
diff
changeset
|
478 if (ds->ds_phys->ds_flags & DS_FLAG_CI_DATASET) |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6479
diff
changeset
|
479 drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_CI_DATA; |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6479
diff
changeset
|
480 |
2743 | 481 if (fromds) |
482 drr->drr_u.drr_begin.drr_fromguid = fromds->ds_phys->ds_guid; | |
483 dsl_dataset_name(ds, drr->drr_u.drr_begin.drr_toname); | |
484 | |
5367 | 485 if (fromds) |
486 fromtxg = fromds->ds_phys->ds_creation_txg; | |
487 | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
488 dsp = kmem_zalloc(sizeof (dmu_sendarg_t), KM_SLEEP); |
2743 | 489 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
490 dsp->dsa_drr = drr; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
491 dsp->dsa_vp = vp; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
492 dsp->dsa_outfd = outfd; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
493 dsp->dsa_proc = curproc; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
494 dsp->dsa_os = tosnap; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
495 dsp->dsa_off = off; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
496 dsp->dsa_toguid = ds->ds_phys->ds_guid; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
497 ZIO_SET_CHECKSUM(&dsp->dsa_zc, 0, 0, 0, 0); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
498 dsp->dsa_pending_op = PENDING_NONE; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
499 |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
500 mutex_enter(&ds->ds_sendstream_lock); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
501 list_insert_head(&ds->ds_sendstreams, dsp); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
502 mutex_exit(&ds->ds_sendstream_lock); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
503 |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
504 if (dump_bytes(dsp, drr, sizeof (dmu_replay_record_t)) != 0) { |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
505 err = dsp->dsa_err; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
506 goto out; |
2743 | 507 } |
508 | |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7046
diff
changeset
|
509 err = traverse_dataset(ds, fromtxg, TRAVERSE_PRE | TRAVERSE_PREFETCH, |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
510 backup_cb, dsp); |
2743 | 511 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
512 if (dsp->dsa_pending_op != PENDING_NONE) |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
513 if (dump_bytes(dsp, drr, sizeof (dmu_replay_record_t)) != 0) |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
514 err = EINTR; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
515 |
2743 | 516 if (err) { |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
517 if (err == EINTR && dsp->dsa_err) |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
518 err = dsp->dsa_err; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
519 goto out; |
2743 | 520 } |
521 | |
522 bzero(drr, sizeof (dmu_replay_record_t)); | |
523 drr->drr_type = DRR_END; | |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
524 drr->drr_u.drr_end.drr_checksum = dsp->dsa_zc; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
525 drr->drr_u.drr_end.drr_toguid = dsp->dsa_toguid; |
2743 | 526 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
527 if (dump_bytes(dsp, drr, sizeof (dmu_replay_record_t)) != 0) { |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
528 err = dsp->dsa_err; |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
529 goto out; |
3655 | 530 } |
2743 | 531 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
532 out: |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
533 mutex_enter(&ds->ds_sendstream_lock); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
534 list_remove(&ds->ds_sendstreams, dsp); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
535 mutex_exit(&ds->ds_sendstream_lock); |
2743 | 536 |
13686
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
537 kmem_free(drr, sizeof (dmu_replay_record_t)); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
538 kmem_free(dsp, sizeof (dmu_sendarg_t)); |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
539 |
4bc0783f6064
2703 add mechanism to report ZFS send progress
Bill Pijewski <wdp@joyent.com>
parents:
13524
diff
changeset
|
540 return (err); |
2743 | 541 } |
542 | |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
543 int |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
544 dmu_send_estimate(objset_t *tosnap, objset_t *fromsnap, uint64_t *sizep) |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
545 { |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
546 dsl_dataset_t *ds = tosnap->os_dsl_dataset; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
547 dsl_dataset_t *fromds = fromsnap ? fromsnap->os_dsl_dataset : NULL; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
548 dsl_pool_t *dp = ds->ds_dir->dd_pool; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
549 int err; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
550 uint64_t size; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
551 |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
552 /* tosnap must be a snapshot */ |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
553 if (ds->ds_phys->ds_next_snap_obj == 0) |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
554 return (EINVAL); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
555 |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
556 /* |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
557 * fromsnap must be an earlier snapshot from the same fs as tosnap, |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
558 * or the origin's fs. |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
559 */ |
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
560 if (fromds != NULL && !is_before(ds, fromds)) |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
561 return (EXDEV); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
562 |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
563 /* Get uncompressed size estimate of changed data. */ |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
564 if (fromds == NULL) { |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
565 size = ds->ds_phys->ds_uncompressed_bytes; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
566 } else { |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
567 uint64_t used, comp; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
568 err = dsl_dataset_space_written(fromds, ds, |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
569 &used, &comp, &size); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
570 if (err) |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
571 return (err); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
572 } |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
573 |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
574 /* |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
575 * Assume that space (both on-disk and in-stream) is dominated by |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
576 * data. We will adjust for indirect blocks and the copies property, |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
577 * but ignore per-object space used (eg, dnodes and DRR_OBJECT records). |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
578 */ |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
579 |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
580 /* |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
581 * Subtract out approximate space used by indirect blocks. |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
582 * Assume most space is used by data blocks (non-indirect, non-dnode). |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
583 * Assume all blocks are recordsize. Assume ditto blocks and |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
584 * internal fragmentation counter out compression. |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
585 * |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
586 * Therefore, space used by indirect blocks is sizeof(blkptr_t) per |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
587 * block, which we observe in practice. |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
588 */ |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
589 uint64_t recordsize; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
590 rw_enter(&dp->dp_config_rwlock, RW_READER); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
591 err = dsl_prop_get_ds(ds, "recordsize", |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
592 sizeof (recordsize), 1, &recordsize, NULL); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
593 rw_exit(&dp->dp_config_rwlock); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
594 if (err) |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
595 return (err); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
596 size -= size / recordsize * sizeof (blkptr_t); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
597 |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
598 /* Add in the space for the record associated with each block. */ |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
599 size += size / recordsize * sizeof (dmu_replay_record_t); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
600 |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
601 *sizep = size; |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
602 |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
603 return (0); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
604 } |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
605 |
5367 | 606 struct recvbeginsyncarg { |
607 const char *tofs; | |
608 const char *tosnap; | |
609 dsl_dataset_t *origin; | |
610 uint64_t fromguid; | |
611 dmu_objset_type_t type; | |
612 void *tag; | |
613 boolean_t force; | |
6492
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6479
diff
changeset
|
614 uint64_t dsflags; |
5367 | 615 char clonelastname[MAXNAMELEN]; |
616 dsl_dataset_t *ds; /* the ds to recv into; returned from the syncfunc */ | |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
617 cred_t *cr; |
2743 | 618 }; |
619 | |
5367 | 620 /* ARGSUSED */ |
2743 | 621 static int |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
622 recv_new_check(void *arg1, void *arg2, dmu_tx_t *tx) |
5367 | 623 { |
624 dsl_dir_t *dd = arg1; | |
625 struct recvbeginsyncarg *rbsa = arg2; | |
626 objset_t *mos = dd->dd_pool->dp_meta_objset; | |
627 uint64_t val; | |
628 int err; | |
629 | |
630 err = zap_lookup(mos, dd->dd_phys->dd_child_dir_zapobj, | |
631 strrchr(rbsa->tofs, '/') + 1, sizeof (uint64_t), 1, &val); | |
632 | |
633 if (err != ENOENT) | |
634 return (err ? err : EEXIST); | |
635 | |
636 if (rbsa->origin) { | |
637 /* make sure it's a snap in the same pool */ | |
638 if (rbsa->origin->ds_dir->dd_pool != dd->dd_pool) | |
639 return (EXDEV); | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
640 if (!dsl_dataset_is_snapshot(rbsa->origin)) |
5367 | 641 return (EINVAL); |
642 if (rbsa->origin->ds_phys->ds_guid != rbsa->fromguid) | |
643 return (ENODEV); | |
644 } | |
645 | |
646 return (0); | |
647 } | |
648 | |
649 static void | |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
650 recv_new_sync(void *arg1, void *arg2, dmu_tx_t *tx) |
5367 | 651 { |
652 dsl_dir_t *dd = arg1; | |
653 struct recvbeginsyncarg *rbsa = arg2; | |
6689
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
654 uint64_t flags = DS_FLAG_INCONSISTENT | rbsa->dsflags; |
5367 | 655 uint64_t dsobj; |
656 | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
657 /* Create and open new dataset. */ |
5367 | 658 dsobj = dsl_dataset_create_sync(dd, strrchr(rbsa->tofs, '/') + 1, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
659 rbsa->origin, flags, rbsa->cr, tx); |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
660 VERIFY(0 == dsl_dataset_own_obj(dd->dd_pool, dsobj, |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
661 B_TRUE, dmu_recv_tag, &rbsa->ds)); |
5367 | 662 |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
663 if (rbsa->origin == NULL) { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
664 (void) dmu_objset_create_impl(dd->dd_pool->dp_spa, |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
665 rbsa->ds, &rbsa->ds->ds_phys->ds_bp, rbsa->type, tx); |
5367 | 666 } |
667 | |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
668 spa_history_log_internal_ds(rbsa->ds, "receive new", tx, ""); |
5367 | 669 } |
670 | |
671 /* ARGSUSED */ | |
672 static int | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
673 recv_existing_check(void *arg1, void *arg2, dmu_tx_t *tx) |
5367 | 674 { |
675 dsl_dataset_t *ds = arg1; | |
676 struct recvbeginsyncarg *rbsa = arg2; | |
2743 | 677 int err; |
678 uint64_t val; | |
679 | |
5367 | 680 /* must not have any changes since most recent snapshot */ |
681 if (!rbsa->force && dsl_dataset_modified_since_lastsnap(ds)) | |
682 return (ETXTBSY); | |
683 | |
12982
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12798
diff
changeset
|
684 /* new snapshot name must not exist */ |
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12798
diff
changeset
|
685 err = zap_lookup(ds->ds_dir->dd_pool->dp_meta_objset, |
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12798
diff
changeset
|
686 ds->ds_phys->ds_snapnames_zapobj, rbsa->tosnap, 8, 1, &val); |
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12798
diff
changeset
|
687 if (err == 0) |
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12798
diff
changeset
|
688 return (EEXIST); |
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12798
diff
changeset
|
689 if (err != ENOENT) |
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12798
diff
changeset
|
690 return (err); |
5d7f2db1e620
6972862 rollback can leak log blocks
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
12798
diff
changeset
|
691 |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
692 if (rbsa->fromguid) { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
693 /* if incremental, most recent snapshot must match fromguid */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
694 if (ds->ds_prev == NULL) |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
695 return (ENODEV); |
11022
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
696 |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
697 /* |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
698 * most recent snapshot must match fromguid, or there are no |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
699 * changes since the fromguid one |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
700 */ |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
701 if (ds->ds_prev->ds_phys->ds_guid != rbsa->fromguid) { |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
702 uint64_t birth = ds->ds_prev->ds_phys->ds_bp.blk_birth; |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
703 uint64_t obj = ds->ds_prev->ds_phys->ds_prev_snap_obj; |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
704 while (obj != 0) { |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
705 dsl_dataset_t *snap; |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
706 err = dsl_dataset_hold_obj(ds->ds_dir->dd_pool, |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
707 obj, FTAG, &snap); |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
708 if (err) |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
709 return (ENODEV); |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
710 if (snap->ds_phys->ds_creation_txg < birth) { |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
711 dsl_dataset_rele(snap, FTAG); |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
712 return (ENODEV); |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
713 } |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
714 if (snap->ds_phys->ds_guid == rbsa->fromguid) { |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
715 dsl_dataset_rele(snap, FTAG); |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
716 break; /* it's ok */ |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
717 } |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
718 obj = snap->ds_phys->ds_prev_snap_obj; |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
719 dsl_dataset_rele(snap, FTAG); |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
720 } |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
721 if (obj == 0) |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
722 return (ENODEV); |
63ab26072e41
PSARC 2009/510 ZFS received properties
Tom Erickson <Tom.Erickson@Sun.COM>
parents:
11012
diff
changeset
|
723 } |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
724 } else { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
725 /* if full, most recent snapshot must be $ORIGIN */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
726 if (ds->ds_phys->ds_prev_snap_txg >= TXG_INITIAL) |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
727 return (ENODEV); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
728 } |
2743 | 729 |
6083
23e77aa611b1
6655963 Panic: 0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj, name, sizeof (uint64_t), 1, &ddobj, tx)
ek110237
parents:
5378
diff
changeset
|
730 /* temporary clone name must not exist */ |
23e77aa611b1
6655963 Panic: 0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj, name, sizeof (uint64_t), 1, &ddobj, tx)
ek110237
parents:
5378
diff
changeset
|
731 err = zap_lookup(ds->ds_dir->dd_pool->dp_meta_objset, |
23e77aa611b1
6655963 Panic: 0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj, name, sizeof (uint64_t), 1, &ddobj, tx)
ek110237
parents:
5378
diff
changeset
|
732 ds->ds_dir->dd_phys->dd_child_dir_zapobj, |
23e77aa611b1
6655963 Panic: 0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj, name, sizeof (uint64_t), 1, &ddobj, tx)
ek110237
parents:
5378
diff
changeset
|
733 rbsa->clonelastname, 8, 1, &val); |
23e77aa611b1
6655963 Panic: 0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj, name, sizeof (uint64_t), 1, &ddobj, tx)
ek110237
parents:
5378
diff
changeset
|
734 if (err == 0) |
23e77aa611b1
6655963 Panic: 0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj, name, sizeof (uint64_t), 1, &ddobj, tx)
ek110237
parents:
5378
diff
changeset
|
735 return (EEXIST); |
23e77aa611b1
6655963 Panic: 0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj, name, sizeof (uint64_t), 1, &ddobj, tx)
ek110237
parents:
5378
diff
changeset
|
736 if (err != ENOENT) |
23e77aa611b1
6655963 Panic: 0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj, name, sizeof (uint64_t), 1, &ddobj, tx)
ek110237
parents:
5378
diff
changeset
|
737 return (err); |
23e77aa611b1
6655963 Panic: 0 == zap_add(mos, pds->dd_phys->dd_child_dir_zapobj, name, sizeof (uint64_t), 1, &ddobj, tx)
ek110237
parents:
5378
diff
changeset
|
738 |
2743 | 739 return (0); |
740 } | |
741 | |
742 /* ARGSUSED */ | |
5367 | 743 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
744 recv_existing_sync(void *arg1, void *arg2, dmu_tx_t *tx) |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
745 { |
5367 | 746 dsl_dataset_t *ohds = arg1; |
747 struct recvbeginsyncarg *rbsa = arg2; | |
748 dsl_pool_t *dp = ohds->ds_dir->dd_pool; | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
749 dsl_dataset_t *cds; |
6689
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
750 uint64_t flags = DS_FLAG_INCONSISTENT | rbsa->dsflags; |
5367 | 751 uint64_t dsobj; |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
752 |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
753 /* create and open the temporary clone */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
754 dsobj = dsl_dataset_create_sync(ohds->ds_dir, rbsa->clonelastname, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
755 ohds->ds_prev, flags, rbsa->cr, tx); |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
756 VERIFY(0 == dsl_dataset_own_obj(dp, dsobj, B_TRUE, dmu_recv_tag, &cds)); |
5367 | 757 |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
758 /* |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
759 * If we actually created a non-clone, we need to create the |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
760 * objset in our new dataset. |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
761 */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
762 if (BP_IS_HOLE(dsl_dataset_get_blkptr(cds))) { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
763 (void) dmu_objset_create_impl(dp->dp_spa, |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
764 cds, dsl_dataset_get_blkptr(cds), rbsa->type, tx); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
765 } |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
766 |
5367 | 767 rbsa->ds = cds; |
768 | |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
769 spa_history_log_internal_ds(cds, "receive over existing", tx, ""); |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
770 } |
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
771 |
12070
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
772 static boolean_t |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
773 dmu_recv_verify_features(dsl_dataset_t *ds, struct drr_begin *drrb) |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
774 { |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
775 int featureflags; |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
776 |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
777 featureflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
778 |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
779 /* Verify pool version supports SA if SA_SPILL feature set */ |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
780 return ((featureflags & DMU_BACKUP_FEATURE_SA_SPILL) && |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
781 (spa_version(dsl_dataset_get_spa(ds)) < SPA_VERSION_SA)); |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
782 } |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
783 |
5367 | 784 /* |
785 * NB: callers *MUST* call dmu_recv_stream() if dmu_recv_begin() | |
786 * succeeds; otherwise we will leak the holds on the datasets. | |
787 */ | |
788 int | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
789 dmu_recv_begin(char *tofs, char *tosnap, char *top_ds, struct drr_begin *drrb, |
10204
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
790 boolean_t force, objset_t *origin, dmu_recv_cookie_t *drc) |
2743 | 791 { |
5367 | 792 int err = 0; |
793 boolean_t byteswap; | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
794 struct recvbeginsyncarg rbsa = { 0 }; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
795 uint64_t versioninfo; |
5367 | 796 int flags; |
797 dsl_dataset_t *ds; | |
798 | |
799 if (drrb->drr_magic == DMU_BACKUP_MAGIC) | |
800 byteswap = FALSE; | |
801 else if (drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC)) | |
802 byteswap = TRUE; | |
803 else | |
804 return (EINVAL); | |
805 | |
806 rbsa.tofs = tofs; | |
807 rbsa.tosnap = tosnap; | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
808 rbsa.origin = origin ? origin->os_dsl_dataset : NULL; |
5367 | 809 rbsa.fromguid = drrb->drr_fromguid; |
810 rbsa.type = drrb->drr_type; | |
811 rbsa.tag = FTAG; | |
6492
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6479
diff
changeset
|
812 rbsa.dsflags = 0; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
813 rbsa.cr = CRED(); |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
814 versioninfo = drrb->drr_versioninfo; |
5367 | 815 flags = drrb->drr_flags; |
816 | |
817 if (byteswap) { | |
818 rbsa.type = BSWAP_32(rbsa.type); | |
819 rbsa.fromguid = BSWAP_64(rbsa.fromguid); | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
820 versioninfo = BSWAP_64(versioninfo); |
5367 | 821 flags = BSWAP_32(flags); |
822 } | |
823 | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
824 if (DMU_GET_STREAM_HDRTYPE(versioninfo) == DMU_COMPOUNDSTREAM || |
5367 | 825 rbsa.type >= DMU_OST_NUMTYPES || |
826 ((flags & DRR_FLAG_CLONE) && origin == NULL)) | |
827 return (EINVAL); | |
828 | |
6492
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6479
diff
changeset
|
829 if (flags & DRR_FLAG_CI_DATA) |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6479
diff
changeset
|
830 rbsa.dsflags = DS_FLAG_CI_DATASET; |
903545192033
6654808 FIGNORECASE lookups in a zfs xattr dir don't provide 'realname' data
timh
parents:
6479
diff
changeset
|
831 |
5367 | 832 bzero(drc, sizeof (dmu_recv_cookie_t)); |
833 drc->drc_drrb = drrb; | |
834 drc->drc_tosnap = tosnap; | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
835 drc->drc_top_ds = top_ds; |
5367 | 836 drc->drc_force = force; |
837 | |
838 /* | |
839 * Process the begin in syncing context. | |
840 */ | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
841 |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
842 /* open the dataset we are logically receiving into */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
843 err = dsl_dataset_hold(tofs, dmu_recv_tag, &ds); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
844 if (err == 0) { |
12070
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
845 if (dmu_recv_verify_features(ds, drrb)) { |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
846 dsl_dataset_rele(ds, dmu_recv_tag); |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
847 return (ENOTSUP); |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
848 } |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
849 /* target fs already exists; recv into temp clone */ |
5367 | 850 |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
851 /* Can't recv a clone into an existing fs */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
852 if (flags & DRR_FLAG_CLONE) { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
853 dsl_dataset_rele(ds, dmu_recv_tag); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
854 return (EINVAL); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
855 } |
2743 | 856 |
10204
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
857 /* must not have an incremental recv already in progress */ |
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
858 if (!mutex_tryenter(&ds->ds_recvlock)) { |
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
859 dsl_dataset_rele(ds, dmu_recv_tag); |
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
860 return (EBUSY); |
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
861 } |
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
862 |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
863 /* tmp clone name is: tofs/%tosnap" */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
864 (void) snprintf(rbsa.clonelastname, sizeof (rbsa.clonelastname), |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
865 "%%%s", tosnap); |
5367 | 866 rbsa.force = force; |
867 err = dsl_sync_task_do(ds->ds_dir->dd_pool, | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
868 recv_existing_check, recv_existing_sync, ds, &rbsa, 5); |
5367 | 869 if (err) { |
10204
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
870 mutex_exit(&ds->ds_recvlock); |
6689
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
871 dsl_dataset_rele(ds, dmu_recv_tag); |
5367 | 872 return (err); |
873 } | |
874 drc->drc_logical_ds = ds; | |
875 drc->drc_real_ds = rbsa.ds; | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
876 } else if (err == ENOENT) { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
877 /* target fs does not exist; must be a full backup or clone */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
878 char *cp; |
5367 | 879 |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
880 /* |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
881 * If it's a non-clone incremental, we are missing the |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
882 * target fs, so fail the recv. |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
883 */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
884 if (rbsa.fromguid && !(flags & DRR_FLAG_CLONE)) |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
885 return (ENOENT); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
886 |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
887 /* Open the parent of tofs */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
888 cp = strrchr(tofs, '/'); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
889 *cp = '\0'; |
10819
d41e0e73a69e
6891564 7410C - zfs panic in recv_new_check()
Chris Kirby <Chris.Kirby@sun.com>
parents:
10298
diff
changeset
|
890 err = dsl_dataset_hold(tofs, FTAG, &ds); |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
891 *cp = '/'; |
5367 | 892 if (err) |
893 return (err); | |
894 | |
12070
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
895 if (dmu_recv_verify_features(ds, drrb)) { |
12727
b22078d749b2
6964442 panic from dmu_recv_begin: No such hold X on refcount Y
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12527
diff
changeset
|
896 dsl_dataset_rele(ds, FTAG); |
12070
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
897 return (ENOTSUP); |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
898 } |
01261b276236
6940770 panic in sa_find_idx_tab() after receiving into pool when version shouldn't have allowed it
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11935
diff
changeset
|
899 |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
900 err = dsl_sync_task_do(ds->ds_dir->dd_pool, |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
901 recv_new_check, recv_new_sync, ds->ds_dir, &rbsa, 5); |
10819
d41e0e73a69e
6891564 7410C - zfs panic in recv_new_check()
Chris Kirby <Chris.Kirby@sun.com>
parents:
10298
diff
changeset
|
902 dsl_dataset_rele(ds, FTAG); |
5367 | 903 if (err) |
904 return (err); | |
905 drc->drc_logical_ds = drc->drc_real_ds = rbsa.ds; | |
906 drc->drc_newfs = B_TRUE; | |
907 } | |
908 | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
909 return (err); |
2743 | 910 } |
911 | |
5367 | 912 struct restorearg { |
913 int err; | |
914 int byteswap; | |
915 vnode_t *vp; | |
916 char *buf; | |
917 uint64_t voff; | |
918 int bufsize; /* amount of memory allocated for buf */ | |
919 zio_cksum_t cksum; | |
12527
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
920 avl_tree_t *guid_to_ds_map; |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
921 }; |
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
922 |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
923 typedef struct guid_map_entry { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
924 uint64_t guid; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
925 dsl_dataset_t *gme_ds; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
926 avl_node_t avlnode; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
927 } guid_map_entry_t; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
928 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
929 static int |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
930 guid_compare(const void *arg1, const void *arg2) |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
931 { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
932 const guid_map_entry_t *gmep1 = arg1; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
933 const guid_map_entry_t *gmep2 = arg2; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
934 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
935 if (gmep1->guid < gmep2->guid) |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
936 return (-1); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
937 else if (gmep1->guid > gmep2->guid) |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
938 return (1); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
939 return (0); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
940 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
941 |
12527
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
942 static void |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
943 free_guid_map_onexit(void *arg) |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
944 { |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
945 avl_tree_t *ca = arg; |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
946 void *cookie = NULL; |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
947 guid_map_entry_t *gmep; |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
948 |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
949 while ((gmep = avl_destroy_nodes(ca, &cookie)) != NULL) { |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
950 dsl_dataset_rele(gmep->gme_ds, ca); |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
951 kmem_free(gmep, sizeof (guid_map_entry_t)); |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
952 } |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
953 avl_destroy(ca); |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
954 kmem_free(ca, sizeof (avl_tree_t)); |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
955 } |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
956 |
2743 | 957 static void * |
958 restore_read(struct restorearg *ra, int len) | |
959 { | |
960 void *rv; | |
5367 | 961 int done = 0; |
2743 | 962 |
963 /* some things will require 8-byte alignment, so everything must */ | |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
964 ASSERT3U(len % 8, ==, 0); |
2743 | 965 |
5367 | 966 while (done < len) { |
2743 | 967 ssize_t resid; |
968 | |
969 ra->err = vn_rdwr(UIO_READ, ra->vp, | |
5367 | 970 (caddr_t)ra->buf + done, len - done, |
2743 | 971 ra->voff, UIO_SYSSPACE, FAPPEND, |
972 RLIM64_INFINITY, CRED(), &resid); | |
973 | |
5367 | 974 if (resid == len - done) |
2743 | 975 ra->err = EINVAL; |
5367 | 976 ra->voff += len - done - resid; |
977 done = len - resid; | |
2743 | 978 if (ra->err) |
979 return (NULL); | |
980 } | |
981 | |
5367 | 982 ASSERT3U(done, ==, len); |
983 rv = ra->buf; | |
2743 | 984 if (ra->byteswap) |
5367 | 985 fletcher_4_incremental_byteswap(rv, len, &ra->cksum); |
2743 | 986 else |
5367 | 987 fletcher_4_incremental_native(rv, len, &ra->cksum); |
2743 | 988 return (rv); |
989 } | |
990 | |
991 static void | |
992 backup_byteswap(dmu_replay_record_t *drr) | |
993 { | |
994 #define DO64(X) (drr->drr_u.X = BSWAP_64(drr->drr_u.X)) | |
995 #define DO32(X) (drr->drr_u.X = BSWAP_32(drr->drr_u.X)) | |
996 drr->drr_type = BSWAP_32(drr->drr_type); | |
5367 | 997 drr->drr_payloadlen = BSWAP_32(drr->drr_payloadlen); |
2743 | 998 switch (drr->drr_type) { |
999 case DRR_BEGIN: | |
1000 DO64(drr_begin.drr_magic); | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1001 DO64(drr_begin.drr_versioninfo); |
2743 | 1002 DO64(drr_begin.drr_creation_time); |
1003 DO32(drr_begin.drr_type); | |
5367 | 1004 DO32(drr_begin.drr_flags); |
2743 | 1005 DO64(drr_begin.drr_toguid); |
1006 DO64(drr_begin.drr_fromguid); | |
1007 break; | |
1008 case DRR_OBJECT: | |
1009 DO64(drr_object.drr_object); | |
1010 /* DO64(drr_object.drr_allocation_txg); */ | |
1011 DO32(drr_object.drr_type); | |
1012 DO32(drr_object.drr_bonustype); | |
1013 DO32(drr_object.drr_blksz); | |
1014 DO32(drr_object.drr_bonuslen); | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1015 DO64(drr_object.drr_toguid); |
2743 | 1016 break; |
1017 case DRR_FREEOBJECTS: | |
1018 DO64(drr_freeobjects.drr_firstobj); | |
1019 DO64(drr_freeobjects.drr_numobjs); | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1020 DO64(drr_freeobjects.drr_toguid); |
2743 | 1021 break; |
1022 case DRR_WRITE: | |
1023 DO64(drr_write.drr_object); | |
1024 DO32(drr_write.drr_type); | |
1025 DO64(drr_write.drr_offset); | |
1026 DO64(drr_write.drr_length); | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1027 DO64(drr_write.drr_toguid); |
11381
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1028 DO64(drr_write.drr_key.ddk_cksum.zc_word[0]); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1029 DO64(drr_write.drr_key.ddk_cksum.zc_word[1]); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1030 DO64(drr_write.drr_key.ddk_cksum.zc_word[2]); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1031 DO64(drr_write.drr_key.ddk_cksum.zc_word[3]); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1032 DO64(drr_write.drr_key.ddk_prop); |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1033 break; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1034 case DRR_WRITE_BYREF: |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1035 DO64(drr_write_byref.drr_object); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1036 DO64(drr_write_byref.drr_offset); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1037 DO64(drr_write_byref.drr_length); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1038 DO64(drr_write_byref.drr_toguid); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1039 DO64(drr_write_byref.drr_refguid); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1040 DO64(drr_write_byref.drr_refobject); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1041 DO64(drr_write_byref.drr_refoffset); |
11381
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1042 DO64(drr_write_byref.drr_key.ddk_cksum.zc_word[0]); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1043 DO64(drr_write_byref.drr_key.ddk_cksum.zc_word[1]); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1044 DO64(drr_write_byref.drr_key.ddk_cksum.zc_word[2]); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1045 DO64(drr_write_byref.drr_key.ddk_cksum.zc_word[3]); |
c77e4d2b2e75
6907006 zfs over-the-wire dedup recalculates checksums unnecessarily
Lori Alt <Lori.Alt@Sun.COM>
parents:
11209
diff
changeset
|
1046 DO64(drr_write_byref.drr_key.ddk_prop); |
2743 | 1047 break; |
1048 case DRR_FREE: | |
1049 DO64(drr_free.drr_object); | |
1050 DO64(drr_free.drr_offset); | |
1051 DO64(drr_free.drr_length); | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1052 DO64(drr_free.drr_toguid); |
2743 | 1053 break; |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1054 case DRR_SPILL: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1055 DO64(drr_spill.drr_object); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1056 DO64(drr_spill.drr_length); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1057 DO64(drr_spill.drr_toguid); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1058 break; |
2743 | 1059 case DRR_END: |
1060 DO64(drr_end.drr_checksum.zc_word[0]); | |
1061 DO64(drr_end.drr_checksum.zc_word[1]); | |
1062 DO64(drr_end.drr_checksum.zc_word[2]); | |
1063 DO64(drr_end.drr_checksum.zc_word[3]); | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1064 DO64(drr_end.drr_toguid); |
2743 | 1065 break; |
1066 } | |
1067 #undef DO64 | |
1068 #undef DO32 | |
1069 } | |
1070 | |
1071 static int | |
1072 restore_object(struct restorearg *ra, objset_t *os, struct drr_object *drro) | |
1073 { | |
1074 int err; | |
1075 dmu_tx_t *tx; | |
7994
7a573dc88b73
6764159 restore_object() makes a call that can block while having a tx open but not yet committed
Tim Haley <Tim.Haley@Sun.COM>
parents:
7837
diff
changeset
|
1076 void *data = NULL; |
2743 | 1077 |
1078 if (drro->drr_type == DMU_OT_NONE || | |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1079 !DMU_OT_IS_VALID(drro->drr_type) || |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1080 !DMU_OT_IS_VALID(drro->drr_bonustype) || |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1081 drro->drr_checksumtype >= ZIO_CHECKSUM_FUNCTIONS || |
2743 | 1082 drro->drr_compress >= ZIO_COMPRESS_FUNCTIONS || |
1083 P2PHASE(drro->drr_blksz, SPA_MINBLOCKSIZE) || | |
1084 drro->drr_blksz < SPA_MINBLOCKSIZE || | |
1085 drro->drr_blksz > SPA_MAXBLOCKSIZE || | |
1086 drro->drr_bonuslen > DN_MAX_BONUSLEN) { | |
1087 return (EINVAL); | |
1088 } | |
1089 | |
8986
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1090 err = dmu_object_info(os, drro->drr_object, NULL); |
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1091 |
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1092 if (err != 0 && err != ENOENT) |
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1093 return (EINVAL); |
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1094 |
7994
7a573dc88b73
6764159 restore_object() makes a call that can block while having a tx open but not yet committed
Tim Haley <Tim.Haley@Sun.COM>
parents:
7837
diff
changeset
|
1095 if (drro->drr_bonuslen) { |
7a573dc88b73
6764159 restore_object() makes a call that can block while having a tx open but not yet committed
Tim Haley <Tim.Haley@Sun.COM>
parents:
7837
diff
changeset
|
1096 data = restore_read(ra, P2ROUNDUP(drro->drr_bonuslen, 8)); |
7a573dc88b73
6764159 restore_object() makes a call that can block while having a tx open but not yet committed
Tim Haley <Tim.Haley@Sun.COM>
parents:
7837
diff
changeset
|
1097 if (ra->err) |
7a573dc88b73
6764159 restore_object() makes a call that can block while having a tx open but not yet committed
Tim Haley <Tim.Haley@Sun.COM>
parents:
7837
diff
changeset
|
1098 return (ra->err); |
7a573dc88b73
6764159 restore_object() makes a call that can block while having a tx open but not yet committed
Tim Haley <Tim.Haley@Sun.COM>
parents:
7837
diff
changeset
|
1099 } |
7a573dc88b73
6764159 restore_object() makes a call that can block while having a tx open but not yet committed
Tim Haley <Tim.Haley@Sun.COM>
parents:
7837
diff
changeset
|
1100 |
2743 | 1101 if (err == ENOENT) { |
1102 /* currently free, want to be allocated */ | |
8986
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1103 tx = dmu_tx_create(os); |
2743 | 1104 dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT); |
1105 err = dmu_tx_assign(tx, TXG_WAIT); | |
1106 if (err) { | |
1107 dmu_tx_abort(tx); | |
1108 return (err); | |
1109 } | |
1110 err = dmu_object_claim(os, drro->drr_object, | |
1111 drro->drr_type, drro->drr_blksz, | |
1112 drro->drr_bonustype, drro->drr_bonuslen, tx); | |
8986
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1113 dmu_tx_commit(tx); |
2743 | 1114 } else { |
1115 /* currently allocated, want to be allocated */ | |
1116 err = dmu_object_reclaim(os, drro->drr_object, | |
1117 drro->drr_type, drro->drr_blksz, | |
8986
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1118 drro->drr_bonustype, drro->drr_bonuslen); |
2743 | 1119 } |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1120 if (err) { |
8986
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1121 return (EINVAL); |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1122 } |
8986
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1123 |
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1124 tx = dmu_tx_create(os); |
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1125 dmu_tx_hold_bonus(tx, drro->drr_object); |
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1126 err = dmu_tx_assign(tx, TXG_WAIT); |
2743 | 1127 if (err) { |
8986
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1128 dmu_tx_abort(tx); |
45c289aff7c9
6801979 zfs recv can fail with E2BIG
Mark Maybee <Mark.Maybee@Sun.COM>
parents:
8644
diff
changeset
|
1129 return (err); |
2743 | 1130 } |
1131 | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1132 dmu_object_set_checksum(os, drro->drr_object, drro->drr_checksumtype, |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1133 tx); |
2743 | 1134 dmu_object_set_compress(os, drro->drr_object, drro->drr_compress, tx); |
1135 | |
7994
7a573dc88b73
6764159 restore_object() makes a call that can block while having a tx open but not yet committed
Tim Haley <Tim.Haley@Sun.COM>
parents:
7837
diff
changeset
|
1136 if (data != NULL) { |
2743 | 1137 dmu_buf_t *db; |
7994
7a573dc88b73
6764159 restore_object() makes a call that can block while having a tx open but not yet committed
Tim Haley <Tim.Haley@Sun.COM>
parents:
7837
diff
changeset
|
1138 |
2743 | 1139 VERIFY(0 == dmu_bonus_hold(os, drro->drr_object, FTAG, &db)); |
1140 dmu_buf_will_dirty(db, tx); | |
1141 | |
4944
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
1142 ASSERT3U(db->db_size, >=, drro->drr_bonuslen); |
96d96f8de974
6569719 panic dangling dbufs (dn=ffffffff28814d30, dbuf=ffffffff20756008)
maybee
parents:
4543
diff
changeset
|
1143 bcopy(data, db->db_data, drro->drr_bonuslen); |
2743 | 1144 if (ra->byteswap) { |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1145 dmu_object_byteswap_t byteswap = |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1146 DMU_OT_BYTESWAP(drro->drr_bonustype); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1147 dmu_ot_byteswap[byteswap].ob_func(db->db_data, |
2743 | 1148 drro->drr_bonuslen); |
1149 } | |
1150 dmu_buf_rele(db, FTAG); | |
1151 } | |
1152 dmu_tx_commit(tx); | |
1153 return (0); | |
1154 } | |
1155 | |
1156 /* ARGSUSED */ | |
1157 static int | |
1158 restore_freeobjects(struct restorearg *ra, objset_t *os, | |
1159 struct drr_freeobjects *drrfo) | |
1160 { | |
1161 uint64_t obj; | |
1162 | |
1163 if (drrfo->drr_firstobj + drrfo->drr_numobjs < drrfo->drr_firstobj) | |
1164 return (EINVAL); | |
1165 | |
1166 for (obj = drrfo->drr_firstobj; | |
3087 | 1167 obj < drrfo->drr_firstobj + drrfo->drr_numobjs; |
1168 (void) dmu_object_next(os, &obj, FALSE, 0)) { | |
2743 | 1169 int err; |
1170 | |
1171 if (dmu_object_info(os, obj, NULL) != 0) | |
1172 continue; | |
1173 | |
6992 | 1174 err = dmu_free_object(os, obj); |
1175 if (err) | |
2743 | 1176 return (err); |
1177 } | |
1178 return (0); | |
1179 } | |
1180 | |
1181 static int | |
1182 restore_write(struct restorearg *ra, objset_t *os, | |
1183 struct drr_write *drrw) | |
1184 { | |
1185 dmu_tx_t *tx; | |
1186 void *data; | |
1187 int err; | |
1188 | |
1189 if (drrw->drr_offset + drrw->drr_length < drrw->drr_offset || | |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1190 !DMU_OT_IS_VALID(drrw->drr_type)) |
2743 | 1191 return (EINVAL); |
1192 | |
1193 data = restore_read(ra, drrw->drr_length); | |
1194 if (data == NULL) | |
1195 return (ra->err); | |
1196 | |
1197 if (dmu_object_info(os, drrw->drr_object, NULL) != 0) | |
1198 return (EINVAL); | |
1199 | |
1200 tx = dmu_tx_create(os); | |
1201 | |
1202 dmu_tx_hold_write(tx, drrw->drr_object, | |
1203 drrw->drr_offset, drrw->drr_length); | |
1204 err = dmu_tx_assign(tx, TXG_WAIT); | |
1205 if (err) { | |
1206 dmu_tx_abort(tx); | |
1207 return (err); | |
1208 } | |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1209 if (ra->byteswap) { |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1210 dmu_object_byteswap_t byteswap = |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1211 DMU_OT_BYTESWAP(drrw->drr_type); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1212 dmu_ot_byteswap[byteswap].ob_func(data, drrw->drr_length); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
13686
diff
changeset
|
1213 } |
2743 | 1214 dmu_write(os, drrw->drr_object, |
1215 drrw->drr_offset, drrw->drr_length, data, tx); | |
1216 dmu_tx_commit(tx); | |
1217 return (0); | |
1218 } | |
1219 | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1220 /* |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1221 * Handle a DRR_WRITE_BYREF record. This record is used in dedup'ed |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1222 * streams to refer to a copy of the data that is already on the |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1223 * system because it came in earlier in the stream. This function |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1224 * finds the earlier copy of the data, and uses that copy instead of |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1225 * data from the stream to fulfill this write. |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1226 */ |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1227 static int |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1228 restore_write_byref(struct restorearg *ra, objset_t *os, |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1229 struct drr_write_byref *drrwbr) |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1230 { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1231 dmu_tx_t *tx; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1232 int err; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1233 guid_map_entry_t gmesrch; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1234 guid_map_entry_t *gmep; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1235 avl_index_t where; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1236 objset_t *ref_os = NULL; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1237 dmu_buf_t *dbp; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1238 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1239 if (drrwbr->drr_offset + drrwbr->drr_length < drrwbr->drr_offset) |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1240 return (EINVAL); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1241 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1242 /* |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1243 * If the GUID of the referenced dataset is different from the |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1244 * GUID of the target dataset, find the referenced dataset. |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1245 */ |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1246 if (drrwbr->drr_toguid != drrwbr->drr_refguid) { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1247 gmesrch.guid = drrwbr->drr_refguid; |
12527
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1248 if ((gmep = avl_find(ra->guid_to_ds_map, &gmesrch, |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1249 &where)) == NULL) { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1250 return (EINVAL); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1251 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1252 if (dmu_objset_from_ds(gmep->gme_ds, &ref_os)) |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1253 return (EINVAL); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1254 } else { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1255 ref_os = os; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1256 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1257 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1258 if (err = dmu_buf_hold(ref_os, drrwbr->drr_refobject, |
12285
d736d62dcca2
6944833 Avoid prefetching dbufs in dmu_sync() path
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
12070
diff
changeset
|
1259 drrwbr->drr_refoffset, FTAG, &dbp, DMU_READ_PREFETCH)) |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1260 return (err); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1261 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1262 tx = dmu_tx_create(os); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1263 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1264 dmu_tx_hold_write(tx, drrwbr->drr_object, |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1265 drrwbr->drr_offset, drrwbr->drr_length); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1266 err = dmu_tx_assign(tx, TXG_WAIT); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1267 if (err) { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1268 dmu_tx_abort(tx); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1269 return (err); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1270 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1271 dmu_write(os, drrwbr->drr_object, |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1272 drrwbr->drr_offset, drrwbr->drr_length, dbp->db_data, tx); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1273 dmu_buf_rele(dbp, FTAG); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1274 dmu_tx_commit(tx); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1275 return (0); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1276 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1277 |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1278 static int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1279 restore_spill(struct restorearg *ra, objset_t *os, struct drr_spill *drrs) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1280 { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1281 dmu_tx_t *tx; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1282 void *data; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1283 dmu_buf_t *db, *db_spill; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1284 int err; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1285 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1286 if (drrs->drr_length < SPA_MINBLOCKSIZE || |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1287 drrs->drr_length > SPA_MAXBLOCKSIZE) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1288 return (EINVAL); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1289 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1290 data = restore_read(ra, drrs->drr_length); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1291 if (data == NULL) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1292 return (ra->err); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1293 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1294 if (dmu_object_info(os, drrs->drr_object, NULL) != 0) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1295 return (EINVAL); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1296 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1297 VERIFY(0 == dmu_bonus_hold(os, drrs->drr_object, FTAG, &db)); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1298 if ((err = dmu_spill_hold_by_bonus(db, FTAG, &db_spill)) != 0) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1299 dmu_buf_rele(db, FTAG); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1300 return (err); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1301 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1302 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1303 tx = dmu_tx_create(os); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1304 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1305 dmu_tx_hold_spill(tx, db->db_object); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1306 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1307 err = dmu_tx_assign(tx, TXG_WAIT); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1308 if (err) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1309 dmu_buf_rele(db, FTAG); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1310 dmu_buf_rele(db_spill, FTAG); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1311 dmu_tx_abort(tx); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1312 return (err); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1313 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1314 dmu_buf_will_dirty(db_spill, tx); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1315 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1316 if (db_spill->db_size < drrs->drr_length) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1317 VERIFY(0 == dbuf_spill_set_blksz(db_spill, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1318 drrs->drr_length, tx)); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1319 bcopy(data, db_spill->db_data, drrs->drr_length); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1320 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1321 dmu_buf_rele(db, FTAG); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1322 dmu_buf_rele(db_spill, FTAG); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1323 |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1324 dmu_tx_commit(tx); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1325 return (0); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1326 } |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1327 |
2743 | 1328 /* ARGSUSED */ |
1329 static int | |
1330 restore_free(struct restorearg *ra, objset_t *os, | |
1331 struct drr_free *drrf) | |
1332 { | |
1333 int err; | |
1334 | |
1335 if (drrf->drr_length != -1ULL && | |
1336 drrf->drr_offset + drrf->drr_length < drrf->drr_offset) | |
1337 return (EINVAL); | |
1338 | |
1339 if (dmu_object_info(os, drrf->drr_object, NULL) != 0) | |
1340 return (EINVAL); | |
1341 | |
6992 | 1342 err = dmu_free_long_range(os, drrf->drr_object, |
2743 | 1343 drrf->drr_offset, drrf->drr_length); |
1344 return (err); | |
1345 } | |
1346 | |
5367 | 1347 /* |
1348 * NB: callers *must* call dmu_recv_end() if this succeeds. | |
1349 */ | |
1350 int | |
12527
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1351 dmu_recv_stream(dmu_recv_cookie_t *drc, vnode_t *vp, offset_t *voffp, |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1352 int cleanup_fd, uint64_t *action_handlep) |
5367 | 1353 { |
1354 struct restorearg ra = { 0 }; | |
1355 dmu_replay_record_t *drr; | |
1356 objset_t *os; | |
1357 zio_cksum_t pcksum; | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1358 int featureflags; |
5367 | 1359 |
1360 if (drc->drc_drrb->drr_magic == BSWAP_64(DMU_BACKUP_MAGIC)) | |
1361 ra.byteswap = TRUE; | |
2743 | 1362 |
5367 | 1363 { |
1364 /* compute checksum of drr_begin record */ | |
1365 dmu_replay_record_t *drr; | |
1366 drr = kmem_zalloc(sizeof (dmu_replay_record_t), KM_SLEEP); | |
1367 | |
1368 drr->drr_type = DRR_BEGIN; | |
1369 drr->drr_u.drr_begin = *drc->drc_drrb; | |
1370 if (ra.byteswap) { | |
1371 fletcher_4_incremental_byteswap(drr, | |
1372 sizeof (dmu_replay_record_t), &ra.cksum); | |
1373 } else { | |
1374 fletcher_4_incremental_native(drr, | |
1375 sizeof (dmu_replay_record_t), &ra.cksum); | |
1376 } | |
1377 kmem_free(drr, sizeof (dmu_replay_record_t)); | |
2743 | 1378 } |
1379 | |
1380 if (ra.byteswap) { | |
5367 | 1381 struct drr_begin *drrb = drc->drc_drrb; |
2743 | 1382 drrb->drr_magic = BSWAP_64(drrb->drr_magic); |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1383 drrb->drr_versioninfo = BSWAP_64(drrb->drr_versioninfo); |
2743 | 1384 drrb->drr_creation_time = BSWAP_64(drrb->drr_creation_time); |
1385 drrb->drr_type = BSWAP_32(drrb->drr_type); | |
1386 drrb->drr_toguid = BSWAP_64(drrb->drr_toguid); | |
1387 drrb->drr_fromguid = BSWAP_64(drrb->drr_fromguid); | |
1388 } | |
1389 | |
5367 | 1390 ra.vp = vp; |
1391 ra.voff = *voffp; | |
1392 ra.bufsize = 1<<20; | |
1393 ra.buf = kmem_alloc(ra.bufsize, KM_SLEEP); | |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
1394 |
5367 | 1395 /* these were verified in dmu_recv_begin */ |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1396 ASSERT(DMU_GET_STREAM_HDRTYPE(drc->drc_drrb->drr_versioninfo) == |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1397 DMU_SUBSTREAM); |
5367 | 1398 ASSERT(drc->drc_drrb->drr_type < DMU_OST_NUMTYPES); |
2743 | 1399 |
1400 /* | |
1401 * Open the objset we are modifying. | |
1402 */ | |
10298
a0d52501437c
6860996 %temporary clones are not automatically destroyed on error
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10272
diff
changeset
|
1403 VERIFY(dmu_objset_from_ds(drc->drc_real_ds, &os) == 0); |
2743 | 1404 |
5367 | 1405 ASSERT(drc->drc_real_ds->ds_phys->ds_flags & DS_FLAG_INCONSISTENT); |
2743 | 1406 |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1407 featureflags = DMU_GET_FEATUREFLAGS(drc->drc_drrb->drr_versioninfo); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1408 |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1409 /* if this stream is dedup'ed, set up the avl tree for guid mapping */ |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1410 if (featureflags & DMU_BACKUP_FEATURE_DEDUP) { |
12798
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1411 minor_t minor; |
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1412 |
12527
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1413 if (cleanup_fd == -1) { |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1414 ra.err = EBADF; |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1415 goto out; |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1416 } |
12798
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1417 ra.err = zfs_onexit_fd_hold(cleanup_fd, &minor); |
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1418 if (ra.err) { |
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1419 cleanup_fd = -1; |
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1420 goto out; |
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1421 } |
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1422 |
12527
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1423 if (*action_handlep == 0) { |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1424 ra.guid_to_ds_map = |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1425 kmem_alloc(sizeof (avl_tree_t), KM_SLEEP); |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1426 avl_create(ra.guid_to_ds_map, guid_compare, |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1427 sizeof (guid_map_entry_t), |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1428 offsetof(guid_map_entry_t, avlnode)); |
12798
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1429 ra.err = zfs_onexit_add_cb(minor, |
12527
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1430 free_guid_map_onexit, ra.guid_to_ds_map, |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1431 action_handlep); |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1432 if (ra.err) |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1433 goto out; |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1434 } else { |
12798
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1435 ra.err = zfs_onexit_cb_data(minor, *action_handlep, |
12527
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1436 (void **)&ra.guid_to_ds_map); |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1437 if (ra.err) |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1438 goto out; |
693dd2cad55f
6884007 zfs_send() can leave temporary holds around
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12470
diff
changeset
|
1439 } |
13329
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1440 |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1441 drc->drc_guid_to_ds_map = ra.guid_to_ds_map; |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1442 } |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1443 |
2743 | 1444 /* |
1445 * Read records and process them. | |
1446 */ | |
5367 | 1447 pcksum = ra.cksum; |
2743 | 1448 while (ra.err == 0 && |
1449 NULL != (drr = restore_read(&ra, sizeof (*drr)))) { | |
1450 if (issig(JUSTLOOKING) && issig(FORREAL)) { | |
1451 ra.err = EINTR; | |
1452 goto out; | |
1453 } | |
1454 | |
1455 if (ra.byteswap) | |
1456 backup_byteswap(drr); | |
1457 | |
1458 switch (drr->drr_type) { | |
1459 case DRR_OBJECT: | |
1460 { | |
1461 /* | |
1462 * We need to make a copy of the record header, | |
1463 * because restore_{object,write} may need to | |
1464 * restore_read(), which will invalidate drr. | |
1465 */ | |
1466 struct drr_object drro = drr->drr_u.drr_object; | |
1467 ra.err = restore_object(&ra, os, &drro); | |
1468 break; | |
1469 } | |
1470 case DRR_FREEOBJECTS: | |
1471 { | |
1472 struct drr_freeobjects drrfo = | |
1473 drr->drr_u.drr_freeobjects; | |
1474 ra.err = restore_freeobjects(&ra, os, &drrfo); | |
1475 break; | |
1476 } | |
1477 case DRR_WRITE: | |
1478 { | |
1479 struct drr_write drrw = drr->drr_u.drr_write; | |
1480 ra.err = restore_write(&ra, os, &drrw); | |
1481 break; | |
1482 } | |
11007
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1483 case DRR_WRITE_BYREF: |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1484 { |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1485 struct drr_write_byref drrwbr = |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1486 drr->drr_u.drr_write_byref; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1487 ra.err = restore_write_byref(&ra, os, &drrwbr); |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1488 break; |
216d8396182e
PSARC/2009/557 ZFS send dedup
Lori Alt <Lori.Alt@Sun.COM>
parents:
10922
diff
changeset
|
1489 } |
2743 | 1490 case DRR_FREE: |
1491 { | |
1492 struct drr_free drrf = drr->drr_u.drr_free; | |
1493 ra.err = restore_free(&ra, os, &drrf); | |
1494 break; | |
1495 } | |
1496 case DRR_END: | |
1497 { | |
1498 struct drr_end drre = drr->drr_u.drr_end; | |
1499 /* | |
1500 * We compare against the *previous* checksum | |
1501 * value, because the stored checksum is of | |
1502 * everything before the DRR_END record. | |
1503 */ | |
6479 | 1504 if (!ZIO_CHECKSUM_EQUAL(drre.drr_checksum, pcksum)) |
2743 | 1505 ra.err = ECKSUM; |
1506 goto out; | |
1507 } | |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1508 case DRR_SPILL: |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1509 { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1510 struct drr_spill drrs = drr->drr_u.drr_spill; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1511 ra.err = restore_spill(&ra, os, &drrs); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1512 break; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11381
diff
changeset
|
1513 } |
2743 | 1514 default: |
1515 ra.err = EINVAL; | |
1516 goto out; | |
1517 } | |
5367 | 1518 pcksum = ra.cksum; |
2743 | 1519 } |
6479 | 1520 ASSERT(ra.err != 0); |
2743 | 1521 |
1522 out: | |
12798
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1523 if ((featureflags & DMU_BACKUP_FEATURE_DEDUP) && (cleanup_fd != -1)) |
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1524 zfs_onexit_fd_rele(cleanup_fd); |
f6c8601080b4
6938335 zfs send -R can still miss renamed snapshots
Chris Kirby <Chris.Kirby@oracle.com>
parents:
12727
diff
changeset
|
1525 |
5367 | 1526 if (ra.err != 0) { |
2743 | 1527 /* |
10204
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
1528 * destroy what we created, so we don't leave it in the |
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
1529 * inconsistent restoring state. |
2743 | 1530 */ |
5367 | 1531 txg_wait_synced(drc->drc_real_ds->ds_dir->dd_pool, 0); |
10204
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
1532 |
10242
c40d075fbca6
PSARC/2009/297 zfs snapshot holds
Chris Kirby <chris.kirby@sun.com>
parents:
10204
diff
changeset
|
1533 (void) dsl_dataset_destroy(drc->drc_real_ds, dmu_recv_tag, |
c40d075fbca6
PSARC/2009/297 zfs snapshot holds
Chris Kirby <chris.kirby@sun.com>
parents:
10204
diff
changeset
|
1534 B_FALSE); |
10204
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
1535 if (drc->drc_real_ds != drc->drc_logical_ds) { |
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
1536 mutex_exit(&drc->drc_logical_ds->ds_recvlock); |
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
1537 dsl_dataset_rele(drc->drc_logical_ds, dmu_recv_tag); |
83c3a84aecef
6760420 zfs unmount -f causes recv to fail
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
9396
diff
changeset
|
1538 } |
2743 | 1539 } |
1540 | |
1541 kmem_free(ra.buf, ra.bufsize); | |
5367 | 1542 *voffp = ra.voff; |
2743 | 1543 return (ra.err); |
1544 } | |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
1545 |
5367 | 1546 struct recvendsyncarg { |
1547 char *tosnap; | |
1548 uint64_t creation_time; | |
1549 uint64_t toguid; | |
1550 }; | |
1551 | |
1552 static int | |
1553 recv_end_check(void *arg1, void *arg2, dmu_tx_t *tx) | |
1554 { | |
1555 dsl_dataset_t *ds = arg1; | |
1556 struct recvendsyncarg *resa = arg2; | |
1557 | |
1558 return (dsl_dataset_snapshot_check(ds, resa->tosnap, tx)); | |
1559 } | |
1560 | |
1561 static void | |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
1562 recv_end_sync(void *arg1, void *arg2, dmu_tx_t *tx) |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
1563 { |
5367 | 1564 dsl_dataset_t *ds = arg1; |
1565 struct recvendsyncarg *resa = arg2; | |
1566 | |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12285
diff
changeset
|
1567 dsl_dataset_snapshot_sync(ds, resa->tosnap, tx); |
5367 | 1568 |
1569 /* set snapshot's creation time and guid */ | |
1570 dmu_buf_will_dirty(ds->ds_prev->ds_dbuf, tx); | |
1571 ds->ds_prev->ds_phys->ds_creation_time = resa->creation_time; | |
1572 ds->ds_prev->ds_phys->ds_guid = resa->toguid; | |
1573 ds->ds_prev->ds_phys->ds_flags &= ~DS_FLAG_INCONSISTENT; | |
1574 | |
1575 dmu_buf_will_dirty(ds->ds_dbuf, tx); | |
1576 ds->ds_phys->ds_flags &= ~DS_FLAG_INCONSISTENT; | |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13736
diff
changeset
|
1577 spa_history_log_internal_ds(ds, "finished receiving", tx, ""); |
5367 | 1578 } |
1579 | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1580 static int |
13329
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1581 add_ds_to_guidmap(avl_tree_t *guid_map, dsl_dataset_t *ds) |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1582 { |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1583 dsl_pool_t *dp = ds->ds_dir->dd_pool; |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1584 uint64_t snapobj = ds->ds_phys->ds_prev_snap_obj; |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1585 dsl_dataset_t *snapds; |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1586 guid_map_entry_t *gmep; |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1587 int err; |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1588 |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1589 ASSERT(guid_map != NULL); |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1590 |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1591 rw_enter(&dp->dp_config_rwlock, RW_READER); |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1592 err = dsl_dataset_hold_obj(dp, snapobj, guid_map, &snapds); |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1593 if (err == 0) { |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1594 gmep = kmem_alloc(sizeof (guid_map_entry_t), KM_SLEEP); |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1595 gmep->guid = snapds->ds_phys->ds_guid; |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1596 gmep->gme_ds = snapds; |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1597 avl_add(guid_map, gmep); |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1598 } |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1599 |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1600 rw_exit(&dp->dp_config_rwlock); |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1601 return (err); |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1602 } |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1603 |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1604 static int |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1605 dmu_recv_existing_end(dmu_recv_cookie_t *drc) |
5367 | 1606 { |
6689
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1607 struct recvendsyncarg resa; |
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1608 dsl_dataset_t *ds = drc->drc_logical_ds; |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
1609 int err, myerr; |
5367 | 1610 |
1611 /* | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1612 * XXX hack; seems the ds is still dirty and dsl_pool_zil_clean() |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1613 * expects it to have a ds_user_ptr (and zil), but clone_swap() |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1614 * can close it. |
5367 | 1615 */ |
6689
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1616 txg_wait_synced(ds->ds_dir->dd_pool, 0); |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
1617 |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1618 if (dsl_dataset_tryown(ds, FALSE, dmu_recv_tag)) { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1619 err = dsl_dataset_clone_swap(drc->drc_real_ds, ds, |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1620 drc->drc_force); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1621 if (err) |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1622 goto out; |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1623 } else { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1624 mutex_exit(&ds->ds_recvlock); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1625 dsl_dataset_rele(ds, dmu_recv_tag); |
10242
c40d075fbca6
PSARC/2009/297 zfs snapshot holds
Chris Kirby <chris.kirby@sun.com>
parents:
10204
diff
changeset
|
1626 (void) dsl_dataset_destroy(drc->drc_real_ds, dmu_recv_tag, |
c40d075fbca6
PSARC/2009/297 zfs snapshot holds
Chris Kirby <chris.kirby@sun.com>
parents:
10204
diff
changeset
|
1627 B_FALSE); |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1628 return (EBUSY); |
5367 | 1629 } |
1630 | |
6689
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1631 resa.creation_time = drc->drc_drrb->drr_creation_time; |
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1632 resa.toguid = drc->drc_drrb->drr_toguid; |
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1633 resa.tosnap = drc->drc_tosnap; |
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1634 |
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1635 err = dsl_sync_task_do(ds->ds_dir->dd_pool, |
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1636 recv_end_check, recv_end_sync, ds, &resa, 3); |
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1637 if (err) { |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1638 /* swap back */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1639 (void) dsl_dataset_clone_swap(drc->drc_real_ds, ds, B_TRUE); |
5367 | 1640 } |
1641 | |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1642 out: |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1643 mutex_exit(&ds->ds_recvlock); |
13329
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1644 if (err == 0 && drc->drc_guid_to_ds_map != NULL) |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1645 (void) add_ds_to_guidmap(drc->drc_guid_to_ds_map, ds); |
6689
47572a2f5e73
6610506 Eliminate or improve retry logic from callers of dmu_objset_open()
maybee
parents:
6492
diff
changeset
|
1646 dsl_dataset_disown(ds, dmu_recv_tag); |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
1647 myerr = dsl_dataset_destroy(drc->drc_real_ds, dmu_recv_tag, B_FALSE); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
1648 ASSERT3U(myerr, ==, 0); |
5326
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
1649 return (err); |
6752aa2bd5bc
6425096 want online 'zfs recv' (read only and read/write)
ek110237
parents:
4944
diff
changeset
|
1650 } |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1651 |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1652 static int |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1653 dmu_recv_new_end(dmu_recv_cookie_t *drc) |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1654 { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1655 struct recvendsyncarg resa; |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1656 dsl_dataset_t *ds = drc->drc_logical_ds; |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1657 int err; |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1658 |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1659 /* |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1660 * XXX hack; seems the ds is still dirty and dsl_pool_zil_clean() |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1661 * expects it to have a ds_user_ptr (and zil), but clone_swap() |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1662 * can close it. |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1663 */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1664 txg_wait_synced(ds->ds_dir->dd_pool, 0); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1665 |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1666 resa.creation_time = drc->drc_drrb->drr_creation_time; |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1667 resa.toguid = drc->drc_drrb->drr_toguid; |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1668 resa.tosnap = drc->drc_tosnap; |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1669 |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1670 err = dsl_sync_task_do(ds->ds_dir->dd_pool, |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1671 recv_end_check, recv_end_sync, ds, &resa, 3); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1672 if (err) { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1673 /* clean up the fs we just recv'd into */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1674 (void) dsl_dataset_destroy(ds, dmu_recv_tag, B_FALSE); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1675 } else { |
13329
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1676 if (drc->drc_guid_to_ds_map != NULL) |
c48b8bf84ab7
755 dmu_recv_stream builds incomplete guid_to_ds_map
Alexander Stetsenko <ams@nexenta.com>
parents:
12982
diff
changeset
|
1677 (void) add_ds_to_guidmap(drc->drc_guid_to_ds_map, ds); |
10272
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1678 /* release the hold from dmu_recv_begin */ |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1679 dsl_dataset_disown(ds, dmu_recv_tag); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1680 } |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1681 return (err); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1682 } |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1683 |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1684 int |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1685 dmu_recv_end(dmu_recv_cookie_t *drc) |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1686 { |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1687 if (drc->drc_logical_ds != drc->drc_real_ds) |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1688 return (dmu_recv_existing_end(drc)); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1689 else |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1690 return (dmu_recv_new_end(drc)); |
a0669934e974
6861581 ZFS frees in synching context during rollback
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10242
diff
changeset
|
1691 } |