]> git.proxmox.com Git - mirror_zfs.git/blame - module/zfs/zfs_replay.c
Support idmapped mount
[mirror_zfs.git] / module / zfs / zfs_replay.c
CommitLineData
34dc7c2f
BB
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
1d3ba0bf 9 * or https://opensource.org/licenses/CDDL-1.0.
34dc7c2f
BB
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/*
572e2857 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
49d39798 23 * Copyright (c) 2012 Cyril Plisko. All rights reserved.
1e0457e7 24 * Copyright (c) 2013, 2017 by Delphix. All rights reserved.
34dc7c2f
BB
25 */
26
34dc7c2f
BB
27#include <sys/types.h>
28#include <sys/param.h>
34dc7c2f
BB
29#include <sys/sysmacros.h>
30#include <sys/cmn_err.h>
31#include <sys/kmem.h>
32#include <sys/thread.h>
33#include <sys/file.h>
34#include <sys/fcntl.h>
35#include <sys/vfs.h>
36#include <sys/fs/zfs.h>
37#include <sys/zfs_znode.h>
38#include <sys/zfs_dir.h>
39#include <sys/zfs_acl.h>
40#include <sys/zfs_fuid.h>
5484965a 41#include <sys/zfs_vnops.h>
34dc7c2f
BB
42#include <sys/spa.h>
43#include <sys/zil.h>
44#include <sys/byteorder.h>
45#include <sys/stat.h>
34dc7c2f
BB
46#include <sys/acl.h>
47#include <sys/atomic.h>
48#include <sys/cred.h>
5484965a 49#include <sys/zpl.h>
361a7e82
JP
50#include <sys/dmu_objset.h>
51#include <sys/zfeature.h>
34dc7c2f 52
ba434b18
MM
53/*
54 * NB: FreeBSD expects to be able to do vnode locking in lookup and
55 * hold the locks across all subsequent VOPs until vput is called.
56 * This means that its zfs vnops routines can't do any internal locking.
57 * In order to have the same contract as the Linux vnops there would
58 * needed to be duplicate locked vnops. If the vnops were used more widely
59 * in common code this would likely be preferable. However, currently
60 * this is the only file where this is the case.
61 */
62
34dc7c2f
BB
63/*
64 * Functions to replay ZFS intent log (ZIL) records
65 * The functions are called through a function vector (zfs_replay_vector)
66 * which is indexed by the transaction type.
67 */
68
69static void
5484965a 70zfs_init_vattr(vattr_t *vap, uint64_t mask, uint64_t mode,
e9aa730c 71 uint64_t uid, uint64_t gid, uint64_t rdev, uint64_t nodeid)
34dc7c2f 72{
861166b0 73 memset(vap, 0, sizeof (*vap));
5484965a 74 vap->va_mask = (uint_t)mask;
5484965a 75 vap->va_mode = mode;
273730d5 76#if defined(__FreeBSD__) || defined(__APPLE__)
3d91490f
MM
77 vap->va_type = IFTOVT(mode);
78#endif
5484965a
BB
79 vap->va_uid = (uid_t)(IS_EPHEMERAL(uid)) ? -1 : uid;
80 vap->va_gid = (gid_t)(IS_EPHEMERAL(gid)) ? -1 : gid;
13a9a6f5 81 vap->va_rdev = zfs_cmpldev(rdev);
5484965a 82 vap->va_nodeid = nodeid;
34dc7c2f
BB
83}
84
34dc7c2f 85static int
867959b5 86zfs_replay_error(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 87{
ef70eff1 88 (void) arg1, (void) arg2, (void) byteswap;
2e528b49 89 return (SET_ERROR(ENOTSUP));
34dc7c2f
BB
90}
91
92static void
93zfs_replay_xvattr(lr_attr_t *lrattr, xvattr_t *xvap)
94{
95 xoptattr_t *xoap = NULL;
96 uint64_t *attrs;
97 uint64_t *crtime;
98 uint32_t *bitmap;
99 void *scanstamp;
100 int i;
101
5484965a 102 xvap->xva_vattr.va_mask |= ATTR_XVATTR;
34dc7c2f 103 if ((xoap = xva_getxoptattr(xvap)) == NULL) {
5484965a 104 xvap->xva_vattr.va_mask &= ~ATTR_XVATTR; /* shouldn't happen */
34dc7c2f
BB
105 return;
106 }
107
108 ASSERT(lrattr->lr_attr_masksize == xvap->xva_mapsize);
109
110 bitmap = &lrattr->lr_attr_bitmap;
111 for (i = 0; i != lrattr->lr_attr_masksize; i++, bitmap++)
112 xvap->xva_reqattrmap[i] = *bitmap;
113
114 attrs = (uint64_t *)(lrattr + lrattr->lr_attr_masksize - 1);
115 crtime = attrs + 1;
116 scanstamp = (caddr_t)(crtime + 2);
117
118 if (XVA_ISSET_REQ(xvap, XAT_HIDDEN))
119 xoap->xoa_hidden = ((*attrs & XAT0_HIDDEN) != 0);
120 if (XVA_ISSET_REQ(xvap, XAT_SYSTEM))
121 xoap->xoa_system = ((*attrs & XAT0_SYSTEM) != 0);
122 if (XVA_ISSET_REQ(xvap, XAT_ARCHIVE))
123 xoap->xoa_archive = ((*attrs & XAT0_ARCHIVE) != 0);
124 if (XVA_ISSET_REQ(xvap, XAT_READONLY))
125 xoap->xoa_readonly = ((*attrs & XAT0_READONLY) != 0);
126 if (XVA_ISSET_REQ(xvap, XAT_IMMUTABLE))
127 xoap->xoa_immutable = ((*attrs & XAT0_IMMUTABLE) != 0);
128 if (XVA_ISSET_REQ(xvap, XAT_NOUNLINK))
129 xoap->xoa_nounlink = ((*attrs & XAT0_NOUNLINK) != 0);
130 if (XVA_ISSET_REQ(xvap, XAT_APPENDONLY))
131 xoap->xoa_appendonly = ((*attrs & XAT0_APPENDONLY) != 0);
132 if (XVA_ISSET_REQ(xvap, XAT_NODUMP))
133 xoap->xoa_nodump = ((*attrs & XAT0_NODUMP) != 0);
134 if (XVA_ISSET_REQ(xvap, XAT_OPAQUE))
135 xoap->xoa_opaque = ((*attrs & XAT0_OPAQUE) != 0);
136 if (XVA_ISSET_REQ(xvap, XAT_AV_MODIFIED))
137 xoap->xoa_av_modified = ((*attrs & XAT0_AV_MODIFIED) != 0);
138 if (XVA_ISSET_REQ(xvap, XAT_AV_QUARANTINED))
139 xoap->xoa_av_quarantined =
140 ((*attrs & XAT0_AV_QUARANTINED) != 0);
141 if (XVA_ISSET_REQ(xvap, XAT_CREATETIME))
142 ZFS_TIME_DECODE(&xoap->xoa_createtime, crtime);
9c5167d1
NF
143 if (XVA_ISSET_REQ(xvap, XAT_AV_SCANSTAMP)) {
144 ASSERT(!XVA_ISSET_REQ(xvap, XAT_PROJID));
145
861166b0 146 memcpy(xoap->xoa_av_scanstamp, scanstamp, AV_SCANSTAMP_SZ);
9c5167d1
NF
147 } else if (XVA_ISSET_REQ(xvap, XAT_PROJID)) {
148 /*
149 * XAT_PROJID and XAT_AV_SCANSTAMP will never be valid
150 * at the same time, so we can share the same space.
151 */
861166b0 152 memcpy(&xoap->xoa_projid, scanstamp, sizeof (uint64_t));
9c5167d1 153 }
428870ff
BB
154 if (XVA_ISSET_REQ(xvap, XAT_REPARSE))
155 xoap->xoa_reparse = ((*attrs & XAT0_REPARSE) != 0);
572e2857
BB
156 if (XVA_ISSET_REQ(xvap, XAT_OFFLINE))
157 xoap->xoa_offline = ((*attrs & XAT0_OFFLINE) != 0);
158 if (XVA_ISSET_REQ(xvap, XAT_SPARSE))
159 xoap->xoa_sparse = ((*attrs & XAT0_SPARSE) != 0);
9c5167d1
NF
160 if (XVA_ISSET_REQ(xvap, XAT_PROJINHERIT))
161 xoap->xoa_projinherit = ((*attrs & XAT0_PROJINHERIT) != 0);
34dc7c2f
BB
162}
163
164static int
165zfs_replay_domain_cnt(uint64_t uid, uint64_t gid)
166{
167 uint64_t uid_idx;
168 uint64_t gid_idx;
169 int domcnt = 0;
170
171 uid_idx = FUID_INDEX(uid);
172 gid_idx = FUID_INDEX(gid);
173 if (uid_idx)
174 domcnt++;
175 if (gid_idx > 0 && gid_idx != uid_idx)
176 domcnt++;
177
178 return (domcnt);
179}
180
181static void *
182zfs_replay_fuid_domain_common(zfs_fuid_info_t *fuid_infop, void *start,
183 int domcnt)
184{
185 int i;
186
187 for (i = 0; i != domcnt; i++) {
188 fuid_infop->z_domain_table[i] = start;
189 start = (caddr_t)start + strlen(start) + 1;
190 }
191
192 return (start);
193}
194
195/*
196 * Set the uid/gid in the fuid_info structure.
197 */
198static void
199zfs_replay_fuid_ugid(zfs_fuid_info_t *fuid_infop, uint64_t uid, uint64_t gid)
200{
201 /*
202 * If owner or group are log specific FUIDs then slurp up
203 * domain information and build zfs_fuid_info_t
204 */
205 if (IS_EPHEMERAL(uid))
206 fuid_infop->z_fuid_owner = uid;
207
208 if (IS_EPHEMERAL(gid))
209 fuid_infop->z_fuid_group = gid;
210}
211
212/*
213 * Load fuid domains into fuid_info_t
214 */
215static zfs_fuid_info_t *
216zfs_replay_fuid_domain(void *buf, void **end, uint64_t uid, uint64_t gid)
217{
218 int domcnt;
219
220 zfs_fuid_info_t *fuid_infop;
221
222 fuid_infop = zfs_fuid_info_alloc();
223
224 domcnt = zfs_replay_domain_cnt(uid, gid);
225
226 if (domcnt == 0)
227 return (fuid_infop);
228
229 fuid_infop->z_domain_table =
160987b5 230 kmem_zalloc(domcnt * sizeof (char *), KM_SLEEP);
34dc7c2f
BB
231
232 zfs_replay_fuid_ugid(fuid_infop, uid, gid);
233
234 fuid_infop->z_domain_cnt = domcnt;
235 *end = zfs_replay_fuid_domain_common(fuid_infop, buf, domcnt);
236 return (fuid_infop);
237}
238
239/*
240 * load zfs_fuid_t's and fuid_domains into fuid_info_t
241 */
242static zfs_fuid_info_t *
243zfs_replay_fuids(void *start, void **end, int idcnt, int domcnt, uint64_t uid,
244 uint64_t gid)
245{
246 uint64_t *log_fuid = (uint64_t *)start;
247 zfs_fuid_info_t *fuid_infop;
248 int i;
249
250 fuid_infop = zfs_fuid_info_alloc();
251 fuid_infop->z_domain_cnt = domcnt;
252
253 fuid_infop->z_domain_table =
160987b5 254 kmem_zalloc(domcnt * sizeof (char *), KM_SLEEP);
34dc7c2f
BB
255
256 for (i = 0; i != idcnt; i++) {
257 zfs_fuid_t *zfuid;
258
259 zfuid = kmem_alloc(sizeof (zfs_fuid_t), KM_SLEEP);
260 zfuid->z_logfuid = *log_fuid;
261 zfuid->z_id = -1;
262 zfuid->z_domidx = 0;
263 list_insert_tail(&fuid_infop->z_fuids, zfuid);
264 log_fuid++;
265 }
266
267 zfs_replay_fuid_ugid(fuid_infop, uid, gid);
268
269 *end = zfs_replay_fuid_domain_common(fuid_infop, log_fuid, domcnt);
270 return (fuid_infop);
271}
272
273static void
274zfs_replay_swap_attrs(lr_attr_t *lrattr)
275{
276 /* swap the lr_attr structure */
277 byteswap_uint32_array(lrattr, sizeof (*lrattr));
278 /* swap the bitmap */
279 byteswap_uint32_array(lrattr + 1, (lrattr->lr_attr_masksize - 1) *
280 sizeof (uint32_t));
281 /* swap the attributes, create time + 64 bit word for attributes */
282 byteswap_uint64_array((caddr_t)(lrattr + 1) + (sizeof (uint32_t) *
283 (lrattr->lr_attr_masksize - 1)), 3 * sizeof (uint64_t));
284}
285
286/*
287 * Replay file create with optional ACL, xvattr information as well
288 * as option FUID information.
289 */
290static int
867959b5 291zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 292{
867959b5
BB
293 zfsvfs_t *zfsvfs = arg1;
294 lr_acl_create_t *lracl = arg2;
34dc7c2f
BB
295 char *name = NULL; /* location determined later */
296 lr_create_t *lr = (lr_create_t *)lracl;
297 znode_t *dzp;
657ce253 298 znode_t *zp;
34dc7c2f 299 xvattr_t xva;
633e8030 300 int vflg = 0;
5484965a 301 vsecattr_t vsec = { 0 };
34dc7c2f
BB
302 lr_attr_t *lrattr;
303 void *aclstart;
304 void *fuidstart;
305 size_t xvatlen = 0;
306 uint64_t txtype;
50c957f7
NB
307 uint64_t objid;
308 uint64_t dnodesize;
34dc7c2f
BB
309 int error;
310
428870ff 311 txtype = (lr->lr_common.lrc_txtype & ~TX_CI);
34dc7c2f
BB
312 if (byteswap) {
313 byteswap_uint64_array(lracl, sizeof (*lracl));
34dc7c2f
BB
314 if (txtype == TX_CREATE_ACL_ATTR ||
315 txtype == TX_MKDIR_ACL_ATTR) {
316 lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
317 zfs_replay_swap_attrs(lrattr);
318 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
319 }
320
321 aclstart = (caddr_t)(lracl + 1) + xvatlen;
322 zfs_ace_byteswap(aclstart, lracl->lr_acl_bytes, B_FALSE);
323 /* swap fuids */
324 if (lracl->lr_fuidcnt) {
325 byteswap_uint64_array((caddr_t)aclstart +
326 ZIL_ACE_LENGTH(lracl->lr_acl_bytes),
327 lracl->lr_fuidcnt * sizeof (uint64_t));
328 }
329 }
330
0037b49e 331 if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
34dc7c2f
BB
332 return (error);
333
50c957f7
NB
334 objid = LR_FOID_GET_OBJ(lr->lr_foid);
335 dnodesize = LR_FOID_GET_SLOTS(lr->lr_foid) << DNODE_SHIFT;
336
34dc7c2f 337 xva_init(&xva);
6742abf9 338 zfs_init_vattr(&xva.xva_vattr, ATTR_MODE | ATTR_UID | ATTR_GID,
50c957f7 339 lr->lr_mode, lr->lr_uid, lr->lr_gid, lr->lr_rdev, objid);
34dc7c2f
BB
340
341 /*
342 * All forms of zfs create (create, mkdir, mkxattrdir, symlink)
343 * eventually end up in zfs_mknode(), which assigns the object's
50c957f7
NB
344 * creation time, generation number, and dnode size. The generic
345 * zfs_create() has no concept of these attributes, so we smuggle
346 * the values inside the vattr's otherwise unused va_ctime,
347 * va_nblocks, and va_fsid fields.
34dc7c2f
BB
348 */
349 ZFS_TIME_DECODE(&xva.xva_vattr.va_ctime, lr->lr_crtime);
350 xva.xva_vattr.va_nblocks = lr->lr_gen;
50c957f7 351 xva.xva_vattr.va_fsid = dnodesize;
34dc7c2f 352
035e9611
CC
353 error = dnode_try_claim(zfsvfs->z_os, objid, dnodesize >> DNODE_SHIFT);
354 if (error)
34dc7c2f
BB
355 goto bail;
356
357 if (lr->lr_common.lrc_txtype & TX_CI)
358 vflg |= FIGNORECASE;
428870ff 359 switch (txtype) {
34dc7c2f
BB
360 case TX_CREATE_ACL:
361 aclstart = (caddr_t)(lracl + 1);
362 fuidstart = (caddr_t)aclstart +
363 ZIL_ACE_LENGTH(lracl->lr_acl_bytes);
0037b49e 364 zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
34dc7c2f
BB
365 (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
366 lr->lr_uid, lr->lr_gid);
9a70e97f 367 zfs_fallthrough;
34dc7c2f
BB
368 case TX_CREATE_ACL_ATTR:
369 if (name == NULL) {
370 lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
371 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
5484965a 372 xva.xva_vattr.va_mask |= ATTR_XVATTR;
34dc7c2f
BB
373 zfs_replay_xvattr(lrattr, &xva);
374 }
375 vsec.vsa_mask = VSA_ACE | VSA_ACE_ACLFLAGS;
376 vsec.vsa_aclentp = (caddr_t)(lracl + 1) + xvatlen;
377 vsec.vsa_aclcnt = lracl->lr_aclcnt;
378 vsec.vsa_aclentsz = lracl->lr_acl_bytes;
379 vsec.vsa_aclflags = lracl->lr_acl_flags;
0037b49e 380 if (zfsvfs->z_fuid_replay == NULL) {
34dc7c2f
BB
381 fuidstart = (caddr_t)(lracl + 1) + xvatlen +
382 ZIL_ACE_LENGTH(lracl->lr_acl_bytes);
0037b49e 383 zfsvfs->z_fuid_replay =
34dc7c2f
BB
384 zfs_replay_fuids(fuidstart,
385 (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
386 lr->lr_uid, lr->lr_gid);
387 }
388
657ce253 389 error = zfs_create(dzp, name, &xva.xva_vattr,
2a068a13 390 0, 0, &zp, kcred, vflg, &vsec, NULL);
34dc7c2f
BB
391 break;
392 case TX_MKDIR_ACL:
393 aclstart = (caddr_t)(lracl + 1);
394 fuidstart = (caddr_t)aclstart +
395 ZIL_ACE_LENGTH(lracl->lr_acl_bytes);
0037b49e 396 zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
34dc7c2f
BB
397 (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
398 lr->lr_uid, lr->lr_gid);
9a70e97f 399 zfs_fallthrough;
34dc7c2f
BB
400 case TX_MKDIR_ACL_ATTR:
401 if (name == NULL) {
402 lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
403 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
404 zfs_replay_xvattr(lrattr, &xva);
405 }
406 vsec.vsa_mask = VSA_ACE | VSA_ACE_ACLFLAGS;
407 vsec.vsa_aclentp = (caddr_t)(lracl + 1) + xvatlen;
408 vsec.vsa_aclcnt = lracl->lr_aclcnt;
409 vsec.vsa_aclentsz = lracl->lr_acl_bytes;
410 vsec.vsa_aclflags = lracl->lr_acl_flags;
0037b49e 411 if (zfsvfs->z_fuid_replay == NULL) {
34dc7c2f
BB
412 fuidstart = (caddr_t)(lracl + 1) + xvatlen +
413 ZIL_ACE_LENGTH(lracl->lr_acl_bytes);
0037b49e 414 zfsvfs->z_fuid_replay =
34dc7c2f
BB
415 zfs_replay_fuids(fuidstart,
416 (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
417 lr->lr_uid, lr->lr_gid);
418 }
657ce253 419 error = zfs_mkdir(dzp, name, &xva.xva_vattr,
2a068a13 420 &zp, kcred, vflg, &vsec, NULL);
34dc7c2f
BB
421 break;
422 default:
2e528b49 423 error = SET_ERROR(ENOTSUP);
34dc7c2f
BB
424 }
425
426bail:
3d91490f
MM
427 if (error == 0 && zp != NULL) {
428#ifdef __FreeBSD__
429 VOP_UNLOCK1(ZTOV(zp));
430#endif
657ce253 431 zrele(zp);
3d91490f 432 }
657ce253 433 zrele(dzp);
34dc7c2f 434
0037b49e
BB
435 if (zfsvfs->z_fuid_replay)
436 zfs_fuid_info_free(zfsvfs->z_fuid_replay);
437 zfsvfs->z_fuid_replay = NULL;
34dc7c2f
BB
438
439 return (error);
440}
441
442static int
867959b5 443zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 444{
867959b5
BB
445 zfsvfs_t *zfsvfs = arg1;
446 lr_create_t *lr = arg2;
34dc7c2f
BB
447 char *name = NULL; /* location determined later */
448 char *link; /* symlink content follows name */
449 znode_t *dzp;
657ce253 450 znode_t *zp = NULL;
34dc7c2f
BB
451 xvattr_t xva;
452 int vflg = 0;
453 size_t lrsize = sizeof (lr_create_t);
454 lr_attr_t *lrattr;
633e8030 455 void *start;
5484965a 456 size_t xvatlen;
34dc7c2f 457 uint64_t txtype;
50c957f7
NB
458 uint64_t objid;
459 uint64_t dnodesize;
34dc7c2f
BB
460 int error;
461
428870ff 462 txtype = (lr->lr_common.lrc_txtype & ~TX_CI);
34dc7c2f
BB
463 if (byteswap) {
464 byteswap_uint64_array(lr, sizeof (*lr));
34dc7c2f
BB
465 if (txtype == TX_CREATE_ATTR || txtype == TX_MKDIR_ATTR)
466 zfs_replay_swap_attrs((lr_attr_t *)(lr + 1));
467 }
468
469
0037b49e 470 if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
34dc7c2f
BB
471 return (error);
472
50c957f7
NB
473 objid = LR_FOID_GET_OBJ(lr->lr_foid);
474 dnodesize = LR_FOID_GET_SLOTS(lr->lr_foid) << DNODE_SHIFT;
475
34dc7c2f 476 xva_init(&xva);
6742abf9 477 zfs_init_vattr(&xva.xva_vattr, ATTR_MODE | ATTR_UID | ATTR_GID,
50c957f7 478 lr->lr_mode, lr->lr_uid, lr->lr_gid, lr->lr_rdev, objid);
34dc7c2f
BB
479
480 /*
481 * All forms of zfs create (create, mkdir, mkxattrdir, symlink)
482 * eventually end up in zfs_mknode(), which assigns the object's
50c957f7
NB
483 * creation time, generation number, and dnode slot count. The
484 * generic zfs_create() has no concept of these attributes, so
1e0457e7
MA
485 * we smuggle the values inside the vattr's otherwise unused
486 * va_ctime, va_nblocks, and va_fsid fields.
34dc7c2f
BB
487 */
488 ZFS_TIME_DECODE(&xva.xva_vattr.va_ctime, lr->lr_crtime);
489 xva.xva_vattr.va_nblocks = lr->lr_gen;
50c957f7 490 xva.xva_vattr.va_fsid = dnodesize;
34dc7c2f 491
035e9611
CC
492 error = dnode_try_claim(zfsvfs->z_os, objid, dnodesize >> DNODE_SHIFT);
493 if (error)
34dc7c2f
BB
494 goto out;
495
496 if (lr->lr_common.lrc_txtype & TX_CI)
497 vflg |= FIGNORECASE;
498
499 /*
500 * Symlinks don't have fuid info, and CIFS never creates
501 * symlinks.
502 *
503 * The _ATTR versions will grab the fuid info in their subcases.
504 */
505 if ((int)lr->lr_common.lrc_txtype != TX_SYMLINK &&
506 (int)lr->lr_common.lrc_txtype != TX_MKDIR_ATTR &&
507 (int)lr->lr_common.lrc_txtype != TX_CREATE_ATTR) {
508 start = (lr + 1);
0037b49e 509 zfsvfs->z_fuid_replay =
34dc7c2f
BB
510 zfs_replay_fuid_domain(start, &start,
511 lr->lr_uid, lr->lr_gid);
512 }
513
428870ff 514 switch (txtype) {
34dc7c2f
BB
515 case TX_CREATE_ATTR:
516 lrattr = (lr_attr_t *)(caddr_t)(lr + 1);
517 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
518 zfs_replay_xvattr((lr_attr_t *)((caddr_t)lr + lrsize), &xva);
519 start = (caddr_t)(lr + 1) + xvatlen;
0037b49e 520 zfsvfs->z_fuid_replay =
34dc7c2f
BB
521 zfs_replay_fuid_domain(start, &start,
522 lr->lr_uid, lr->lr_gid);
523 name = (char *)start;
9a70e97f 524 zfs_fallthrough;
34dc7c2f 525
34dc7c2f
BB
526 case TX_CREATE:
527 if (name == NULL)
528 name = (char *)start;
529
657ce253 530 error = zfs_create(dzp, name, &xva.xva_vattr,
2a068a13 531 0, 0, &zp, kcred, vflg, NULL, NULL);
34dc7c2f
BB
532 break;
533 case TX_MKDIR_ATTR:
534 lrattr = (lr_attr_t *)(caddr_t)(lr + 1);
535 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
536 zfs_replay_xvattr((lr_attr_t *)((caddr_t)lr + lrsize), &xva);
537 start = (caddr_t)(lr + 1) + xvatlen;
0037b49e 538 zfsvfs->z_fuid_replay =
34dc7c2f
BB
539 zfs_replay_fuid_domain(start, &start,
540 lr->lr_uid, lr->lr_gid);
541 name = (char *)start;
9a70e97f 542 zfs_fallthrough;
34dc7c2f 543
34dc7c2f
BB
544 case TX_MKDIR:
545 if (name == NULL)
546 name = (char *)(lr + 1);
547
657ce253 548 error = zfs_mkdir(dzp, name, &xva.xva_vattr,
2a068a13 549 &zp, kcred, vflg, NULL, NULL);
34dc7c2f
BB
550 break;
551 case TX_MKXATTR:
657ce253 552 error = zfs_make_xattrdir(dzp, &xva.xva_vattr, &zp, kcred);
34dc7c2f
BB
553 break;
554 case TX_SYMLINK:
555 name = (char *)(lr + 1);
556 link = name + strlen(name) + 1;
657ce253 557 error = zfs_symlink(dzp, name, &xva.xva_vattr,
2a068a13 558 link, &zp, kcred, vflg, NULL);
34dc7c2f
BB
559 break;
560 default:
2e528b49 561 error = SET_ERROR(ENOTSUP);
34dc7c2f
BB
562 }
563
3d91490f
MM
564out:
565 if (error == 0 && zp != NULL) {
13a9a6f5 566#ifdef __FreeBSD__
3d91490f 567 VOP_UNLOCK1(ZTOV(zp));
13a9a6f5 568#endif
657ce253 569 zrele(zp);
3d91490f 570 }
657ce253 571 zrele(dzp);
34dc7c2f 572
0037b49e
BB
573 if (zfsvfs->z_fuid_replay)
574 zfs_fuid_info_free(zfsvfs->z_fuid_replay);
575 zfsvfs->z_fuid_replay = NULL;
34dc7c2f
BB
576 return (error);
577}
578
579static int
867959b5 580zfs_replay_remove(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 581{
867959b5
BB
582 zfsvfs_t *zfsvfs = arg1;
583 lr_remove_t *lr = arg2;
34dc7c2f
BB
584 char *name = (char *)(lr + 1); /* name follows lr_remove_t */
585 znode_t *dzp;
586 int error;
587 int vflg = 0;
588
589 if (byteswap)
590 byteswap_uint64_array(lr, sizeof (*lr));
591
0037b49e 592 if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
34dc7c2f
BB
593 return (error);
594
595 if (lr->lr_common.lrc_txtype & TX_CI)
596 vflg |= FIGNORECASE;
597
598 switch ((int)lr->lr_common.lrc_txtype) {
599 case TX_REMOVE:
657ce253 600 error = zfs_remove(dzp, name, kcred, vflg);
34dc7c2f
BB
601 break;
602 case TX_RMDIR:
657ce253 603 error = zfs_rmdir(dzp, name, NULL, kcred, vflg);
34dc7c2f
BB
604 break;
605 default:
2e528b49 606 error = SET_ERROR(ENOTSUP);
34dc7c2f
BB
607 }
608
657ce253 609 zrele(dzp);
34dc7c2f
BB
610
611 return (error);
612}
613
614static int
867959b5 615zfs_replay_link(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 616{
867959b5
BB
617 zfsvfs_t *zfsvfs = arg1;
618 lr_link_t *lr = arg2;
34dc7c2f
BB
619 char *name = (char *)(lr + 1); /* name follows lr_link_t */
620 znode_t *dzp, *zp;
621 int error;
5484965a 622 int vflg = 0;
34dc7c2f
BB
623
624 if (byteswap)
625 byteswap_uint64_array(lr, sizeof (*lr));
626
0037b49e 627 if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
34dc7c2f
BB
628 return (error);
629
0037b49e 630 if ((error = zfs_zget(zfsvfs, lr->lr_link_obj, &zp)) != 0) {
657ce253 631 zrele(dzp);
34dc7c2f
BB
632 return (error);
633 }
634
635 if (lr->lr_common.lrc_txtype & TX_CI)
636 vflg |= FIGNORECASE;
637
657ce253 638 error = zfs_link(dzp, zp, name, kcred, vflg);
657ce253
MM
639 zrele(zp);
640 zrele(dzp);
34dc7c2f
BB
641
642 return (error);
643}
644
645static int
867959b5 646zfs_replay_rename(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 647{
867959b5
BB
648 zfsvfs_t *zfsvfs = arg1;
649 lr_rename_t *lr = arg2;
34dc7c2f
BB
650 char *sname = (char *)(lr + 1); /* sname and tname follow lr_rename_t */
651 char *tname = sname + strlen(sname) + 1;
652 znode_t *sdzp, *tdzp;
653 int error;
654 int vflg = 0;
655
656 if (byteswap)
657 byteswap_uint64_array(lr, sizeof (*lr));
658
0037b49e 659 if ((error = zfs_zget(zfsvfs, lr->lr_sdoid, &sdzp)) != 0)
34dc7c2f
BB
660 return (error);
661
0037b49e 662 if ((error = zfs_zget(zfsvfs, lr->lr_tdoid, &tdzp)) != 0) {
657ce253 663 zrele(sdzp);
34dc7c2f
BB
664 return (error);
665 }
666
667 if (lr->lr_common.lrc_txtype & TX_CI)
668 vflg |= FIGNORECASE;
669
2a068a13 670 error = zfs_rename(sdzp, sname, tdzp, tname, kcred, vflg, NULL);
34dc7c2f 671
657ce253
MM
672 zrele(tdzp);
673 zrele(sdzp);
34dc7c2f
BB
674 return (error);
675}
676
677static int
867959b5 678zfs_replay_write(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 679{
867959b5
BB
680 zfsvfs_t *zfsvfs = arg1;
681 lr_write_t *lr = arg2;
34dc7c2f
BB
682 char *data = (char *)(lr + 1); /* data follows lr_write_t */
683 znode_t *zp;
13a9a6f5 684 int error;
572e2857 685 uint64_t eod, offset, length;
34dc7c2f
BB
686
687 if (byteswap)
688 byteswap_uint64_array(lr, sizeof (*lr));
689
0037b49e 690 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) {
34dc7c2f
BB
691 /*
692 * As we can log writes out of order, it's possible the
693 * file has been removed. In this case just drop the write
694 * and return success.
695 */
696 if (error == ENOENT)
697 error = 0;
698 return (error);
699 }
700
428870ff
BB
701 offset = lr->lr_offset;
702 length = lr->lr_length;
572e2857 703 eod = offset + length; /* end of data for this write */
428870ff 704
572e2857
BB
705 /*
706 * This may be a write from a dmu_sync() for a whole block,
707 * and may extend beyond the current end of the file.
708 * We can't just replay what was written for this TX_WRITE as
709 * a future TX_WRITE2 may extend the eof and the data for that
710 * write needs to be there. So we write the whole block and
711 * reduce the eof. This needs to be done within the single dmu
712 * transaction created within vn_rdwr -> zfs_write. So a possible
0037b49e 713 * new end of file is passed through in zfsvfs->z_replay_eof
572e2857
BB
714 */
715
0037b49e 716 zfsvfs->z_replay_eof = 0; /* 0 means don't change end of file */
428870ff
BB
717
718 /* If it's a dmu_sync() block, write the whole block */
719 if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) {
720 uint64_t blocksize = BP_GET_LSIZE(&lr->lr_blkptr);
721 if (length < blocksize) {
722 offset -= offset % blocksize;
723 length = blocksize;
724 }
572e2857 725 if (zp->z_size < eod)
0037b49e 726 zfsvfs->z_replay_eof = eod;
428870ff 727 }
13a9a6f5 728 error = zfs_write_simple(zp, data, length, offset, NULL);
657ce253 729 zrele(zp);
0037b49e 730 zfsvfs->z_replay_eof = 0; /* safety */
428870ff
BB
731
732 return (error);
733}
734
735/*
736 * TX_WRITE2 are only generated when dmu_sync() returns EALREADY
737 * meaning the pool block is already being synced. So now that we always write
738 * out full blocks, all we have to do is expand the eof if
739 * the file is grown.
740 */
741static int
867959b5 742zfs_replay_write2(void *arg1, void *arg2, boolean_t byteswap)
428870ff 743{
867959b5
BB
744 zfsvfs_t *zfsvfs = arg1;
745 lr_write_t *lr = arg2;
428870ff
BB
746 znode_t *zp;
747 int error;
748 uint64_t end;
749
750 if (byteswap)
751 byteswap_uint64_array(lr, sizeof (*lr));
752
0037b49e 753 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
428870ff
BB
754 return (error);
755
572e2857 756top:
428870ff
BB
757 end = lr->lr_offset + lr->lr_length;
758 if (end > zp->z_size) {
0037b49e 759 dmu_tx_t *tx = dmu_tx_create(zfsvfs->z_os);
572e2857 760
428870ff 761 zp->z_size = end;
572e2857
BB
762 dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
763 error = dmu_tx_assign(tx, TXG_WAIT);
764 if (error) {
657ce253 765 zrele(zp);
572e2857
BB
766 if (error == ERESTART) {
767 dmu_tx_wait(tx);
768 dmu_tx_abort(tx);
769 goto top;
770 }
771 dmu_tx_abort(tx);
772 return (error);
773 }
0037b49e 774 (void) sa_update(zp->z_sa_hdl, SA_ZPL_SIZE(zfsvfs),
572e2857
BB
775 (void *)&zp->z_size, sizeof (uint64_t), tx);
776
777 /* Ensure the replayed seq is updated */
0037b49e 778 (void) zil_replaying(zfsvfs->z_log, tx);
572e2857
BB
779
780 dmu_tx_commit(tx);
428870ff 781 }
34dc7c2f 782
657ce253 783 zrele(zp);
34dc7c2f
BB
784
785 return (error);
786}
787
788static int
867959b5 789zfs_replay_truncate(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 790{
867959b5
BB
791 zfsvfs_t *zfsvfs = arg1;
792 lr_truncate_t *lr = arg2;
34dc7c2f 793 znode_t *zp;
861166b0 794 flock64_t fl = {0};
34dc7c2f
BB
795 int error;
796
797 if (byteswap)
798 byteswap_uint64_array(lr, sizeof (*lr));
799
0037b49e 800 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
34dc7c2f 801 return (error);
34dc7c2f 802
34dc7c2f 803 fl.l_type = F_WRLCK;
126d0fa7 804 fl.l_whence = SEEK_SET;
34dc7c2f
BB
805 fl.l_start = lr->lr_offset;
806 fl.l_len = lr->lr_length;
807
657ce253 808 error = zfs_space(zp, F_FREESP, &fl, O_RDWR | O_LARGEFILE,
633e8030 809 lr->lr_offset, kcred);
34dc7c2f 810
657ce253 811 zrele(zp);
34dc7c2f
BB
812
813 return (error);
814}
815
816static int
867959b5 817zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 818{
867959b5
BB
819 zfsvfs_t *zfsvfs = arg1;
820 lr_setattr_t *lr = arg2;
34dc7c2f
BB
821 znode_t *zp;
822 xvattr_t xva;
5484965a 823 vattr_t *vap = &xva.xva_vattr;
34dc7c2f
BB
824 int error;
825 void *start;
826
827 xva_init(&xva);
828 if (byteswap) {
829 byteswap_uint64_array(lr, sizeof (*lr));
830
5484965a 831 if ((lr->lr_mask & ATTR_XVATTR) &&
0037b49e 832 zfsvfs->z_version >= ZPL_VERSION_INITIAL)
34dc7c2f
BB
833 zfs_replay_swap_attrs((lr_attr_t *)(lr + 1));
834 }
835
0037b49e 836 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
34dc7c2f 837 return (error);
34dc7c2f 838
5484965a
BB
839 zfs_init_vattr(vap, lr->lr_mask, lr->lr_mode,
840 lr->lr_uid, lr->lr_gid, 0, lr->lr_foid);
34dc7c2f 841
5484965a
BB
842 vap->va_size = lr->lr_size;
843 ZFS_TIME_DECODE(&vap->va_atime, lr->lr_atime);
844 ZFS_TIME_DECODE(&vap->va_mtime, lr->lr_mtime);
87f9371a
NB
845 gethrestime(&vap->va_ctime);
846 vap->va_mask |= ATTR_CTIME;
34dc7c2f
BB
847
848 /*
849 * Fill in xvattr_t portions if necessary.
850 */
851
852 start = (lr_setattr_t *)(lr + 1);
5484965a 853 if (vap->va_mask & ATTR_XVATTR) {
34dc7c2f
BB
854 zfs_replay_xvattr((lr_attr_t *)start, &xva);
855 start = (caddr_t)start +
856 ZIL_XVAT_SIZE(((lr_attr_t *)start)->lr_attr_masksize);
857 } else
5484965a 858 xva.xva_vattr.va_mask &= ~ATTR_XVATTR;
34dc7c2f 859
0037b49e 860 zfsvfs->z_fuid_replay = zfs_replay_fuid_domain(start, &start,
34dc7c2f
BB
861 lr->lr_uid, lr->lr_gid);
862
2a068a13 863 error = zfs_setattr(zp, vap, 0, kcred, NULL);
34dc7c2f 864
0037b49e
BB
865 zfs_fuid_info_free(zfsvfs->z_fuid_replay);
866 zfsvfs->z_fuid_replay = NULL;
657ce253 867 zrele(zp);
34dc7c2f
BB
868
869 return (error);
870}
871
361a7e82
JP
872static int
873zfs_replay_setsaxattr(void *arg1, void *arg2, boolean_t byteswap)
874{
875 zfsvfs_t *zfsvfs = arg1;
876 lr_setsaxattr_t *lr = arg2;
877 znode_t *zp;
878 nvlist_t *nvl;
879 size_t sa_size;
880 char *name;
881 char *value;
882 size_t size;
883 int error = 0;
884
885 ASSERT(spa_feature_is_active(zfsvfs->z_os->os_spa,
886 SPA_FEATURE_ZILSAXATTR));
887 if (byteswap)
888 byteswap_uint64_array(lr, sizeof (*lr));
889
890 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
891 return (error);
892
893 rw_enter(&zp->z_xattr_lock, RW_WRITER);
894 mutex_enter(&zp->z_lock);
895 if (zp->z_xattr_cached == NULL)
896 error = zfs_sa_get_xattr(zp);
897 mutex_exit(&zp->z_lock);
898
899 if (error)
900 goto out;
901
902 ASSERT(zp->z_xattr_cached);
903 nvl = zp->z_xattr_cached;
904
905 /* Get xattr name, value and size from log record */
906 size = lr->lr_size;
907 name = (char *)(lr + 1);
908 if (size == 0) {
909 value = NULL;
910 error = nvlist_remove(nvl, name, DATA_TYPE_BYTE_ARRAY);
911 } else {
912 value = name + strlen(name) + 1;
913 /* Limited to 32k to keep nvpair memory allocations small */
914 if (size > DXATTR_MAX_ENTRY_SIZE) {
915 error = SET_ERROR(EFBIG);
916 goto out;
917 }
918
919 /* Prevent the DXATTR SA from consuming the entire SA region */
920 error = nvlist_size(nvl, &sa_size, NV_ENCODE_XDR);
921 if (error)
922 goto out;
923
924 if (sa_size > DXATTR_MAX_SA_SIZE) {
925 error = SET_ERROR(EFBIG);
926 goto out;
927 }
928
929 error = nvlist_add_byte_array(nvl, name, (uchar_t *)value,
930 size);
931 }
932
933 /*
934 * Update the SA for additions, modifications, and removals. On
935 * error drop the inconsistent cached version of the nvlist, it
936 * will be reconstructed from the ARC when next accessed.
937 */
938 if (error == 0)
939 error = zfs_sa_set_xattr(zp, name, value, size);
940
941 if (error) {
942 nvlist_free(nvl);
943 zp->z_xattr_cached = NULL;
944 }
945
946out:
947 rw_exit(&zp->z_xattr_lock);
948 zrele(zp);
949 return (error);
950}
951
34dc7c2f 952static int
867959b5 953zfs_replay_acl_v0(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 954{
867959b5
BB
955 zfsvfs_t *zfsvfs = arg1;
956 lr_acl_v0_t *lr = arg2;
34dc7c2f 957 ace_t *ace = (ace_t *)(lr + 1); /* ace array follows lr_acl_t */
861166b0 958 vsecattr_t vsa = {0};
34dc7c2f
BB
959 znode_t *zp;
960 int error;
961
962 if (byteswap) {
963 byteswap_uint64_array(lr, sizeof (*lr));
964 zfs_oldace_byteswap(ace, lr->lr_aclcnt);
965 }
966
0037b49e 967 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
34dc7c2f 968 return (error);
34dc7c2f 969
34dc7c2f
BB
970 vsa.vsa_mask = VSA_ACE | VSA_ACECNT;
971 vsa.vsa_aclcnt = lr->lr_aclcnt;
b128c09f
BB
972 vsa.vsa_aclentsz = sizeof (ace_t) * vsa.vsa_aclcnt;
973 vsa.vsa_aclflags = 0;
34dc7c2f
BB
974 vsa.vsa_aclentp = ace;
975
657ce253 976 error = zfs_setsecattr(zp, &vsa, 0, kcred);
34dc7c2f 977
657ce253 978 zrele(zp);
34dc7c2f
BB
979
980 return (error);
981}
982
983/*
984 * Replaying ACLs is complicated by FUID support.
985 * The log record may contain some optional data
986 * to be used for replaying FUID's. These pieces
987 * are the actual FUIDs that were created initially.
988 * The FUID table index may no longer be valid and
989 * during zfs_create() a new index may be assigned.
990 * Because of this the log will contain the original
4e33ba4c 991 * domain+rid in order to create a new FUID.
34dc7c2f
BB
992 *
993 * The individual ACEs may contain an ephemeral uid/gid which is no
994 * longer valid and will need to be replaced with an actual FUID.
995 *
996 */
997static int
867959b5 998zfs_replay_acl(void *arg1, void *arg2, boolean_t byteswap)
34dc7c2f 999{
867959b5
BB
1000 zfsvfs_t *zfsvfs = arg1;
1001 lr_acl_t *lr = arg2;
34dc7c2f 1002 ace_t *ace = (ace_t *)(lr + 1);
861166b0 1003 vsecattr_t vsa = {0};
34dc7c2f
BB
1004 znode_t *zp;
1005 int error;
1006
1007 if (byteswap) {
1008 byteswap_uint64_array(lr, sizeof (*lr));
1009 zfs_ace_byteswap(ace, lr->lr_acl_bytes, B_FALSE);
1010 if (lr->lr_fuidcnt) {
1011 byteswap_uint64_array((caddr_t)ace +
1012 ZIL_ACE_LENGTH(lr->lr_acl_bytes),
1013 lr->lr_fuidcnt * sizeof (uint64_t));
1014 }
1015 }
1016
0037b49e 1017 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
34dc7c2f 1018 return (error);
34dc7c2f 1019
34dc7c2f
BB
1020 vsa.vsa_mask = VSA_ACE | VSA_ACECNT | VSA_ACE_ACLFLAGS;
1021 vsa.vsa_aclcnt = lr->lr_aclcnt;
1022 vsa.vsa_aclentp = ace;
1023 vsa.vsa_aclentsz = lr->lr_acl_bytes;
1024 vsa.vsa_aclflags = lr->lr_acl_flags;
1025
1026 if (lr->lr_fuidcnt) {
1027 void *fuidstart = (caddr_t)ace +
1028 ZIL_ACE_LENGTH(lr->lr_acl_bytes);
1029
0037b49e 1030 zfsvfs->z_fuid_replay =
34dc7c2f
BB
1031 zfs_replay_fuids(fuidstart, &fuidstart,
1032 lr->lr_fuidcnt, lr->lr_domcnt, 0, 0);
1033 }
1034
657ce253 1035 error = zfs_setsecattr(zp, &vsa, 0, kcred);
34dc7c2f 1036
0037b49e
BB
1037 if (zfsvfs->z_fuid_replay)
1038 zfs_fuid_info_free(zfsvfs->z_fuid_replay);
34dc7c2f 1039
0037b49e 1040 zfsvfs->z_fuid_replay = NULL;
657ce253 1041 zrele(zp);
34dc7c2f
BB
1042
1043 return (error);
1044}
1045
1046/*
1047 * Callback vectors for replaying records
1048 */
18168da7 1049zil_replay_func_t *const zfs_replay_vector[TX_MAX_TYPE] = {
867959b5
BB
1050 zfs_replay_error, /* no such type */
1051 zfs_replay_create, /* TX_CREATE */
1052 zfs_replay_create, /* TX_MKDIR */
1053 zfs_replay_create, /* TX_MKXATTR */
1054 zfs_replay_create, /* TX_SYMLINK */
1055 zfs_replay_remove, /* TX_REMOVE */
1056 zfs_replay_remove, /* TX_RMDIR */
1057 zfs_replay_link, /* TX_LINK */
1058 zfs_replay_rename, /* TX_RENAME */
1059 zfs_replay_write, /* TX_WRITE */
1060 zfs_replay_truncate, /* TX_TRUNCATE */
1061 zfs_replay_setattr, /* TX_SETATTR */
1062 zfs_replay_acl_v0, /* TX_ACL_V0 */
1063 zfs_replay_acl, /* TX_ACL */
1064 zfs_replay_create_acl, /* TX_CREATE_ACL */
1065 zfs_replay_create, /* TX_CREATE_ATTR */
1066 zfs_replay_create_acl, /* TX_CREATE_ACL_ATTR */
1067 zfs_replay_create_acl, /* TX_MKDIR_ACL */
1068 zfs_replay_create, /* TX_MKDIR_ATTR */
1069 zfs_replay_create_acl, /* TX_MKDIR_ACL_ATTR */
1070 zfs_replay_write2, /* TX_WRITE2 */
361a7e82 1071 zfs_replay_setsaxattr, /* TX_SETSAXATTR */
34dc7c2f 1072};