ZTS: Add LUKS sanity test
[zfs.git] / module / zfs / zfs_replay.c
blob80c11d80f6c45fb879ad1e92a68d01ac868403ba
1 /*
2 * CDDL HEADER START
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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or https://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
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]
19 * CDDL HEADER END
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012 Cyril Plisko. All rights reserved.
24 * Copyright (c) 2013, 2017 by Delphix. All rights reserved.
25 * Copyright (c) 2021, 2022 by Pawel Jakub Dawidek
28 #include <sys/types.h>
29 #include <sys/param.h>
30 #include <sys/sysmacros.h>
31 #include <sys/cmn_err.h>
32 #include <sys/kmem.h>
33 #include <sys/thread.h>
34 #include <sys/file.h>
35 #include <sys/fcntl.h>
36 #include <sys/vfs.h>
37 #include <sys/fs/zfs.h>
38 #include <sys/zfs_znode.h>
39 #include <sys/zfs_dir.h>
40 #include <sys/zfs_acl.h>
41 #include <sys/zfs_fuid.h>
42 #include <sys/zfs_vnops.h>
43 #include <sys/spa.h>
44 #include <sys/zil.h>
45 #include <sys/byteorder.h>
46 #include <sys/stat.h>
47 #include <sys/acl.h>
48 #include <sys/atomic.h>
49 #include <sys/cred.h>
50 #include <sys/zpl.h>
51 #include <sys/dmu_objset.h>
52 #include <sys/zfeature.h>
55 * NB: FreeBSD expects to be able to do vnode locking in lookup and
56 * hold the locks across all subsequent VOPs until vput is called.
57 * This means that its zfs vnops routines can't do any internal locking.
58 * In order to have the same contract as the Linux vnops there would
59 * needed to be duplicate locked vnops. If the vnops were used more widely
60 * in common code this would likely be preferable. However, currently
61 * this is the only file where this is the case.
65 * Functions to replay ZFS intent log (ZIL) records
66 * The functions are called through a function vector (zfs_replay_vector)
67 * which is indexed by the transaction type.
70 static void
71 zfs_init_vattr(vattr_t *vap, uint64_t mask, uint64_t mode,
72 uint64_t uid, uint64_t gid, uint64_t rdev, uint64_t nodeid)
74 memset(vap, 0, sizeof (*vap));
75 vap->va_mask = (uint_t)mask;
76 vap->va_mode = mode;
77 #if defined(__FreeBSD__) || defined(__APPLE__)
78 vap->va_type = IFTOVT(mode);
79 #endif
80 vap->va_uid = (uid_t)(IS_EPHEMERAL(uid)) ? -1 : uid;
81 vap->va_gid = (gid_t)(IS_EPHEMERAL(gid)) ? -1 : gid;
82 vap->va_rdev = zfs_cmpldev(rdev);
83 vap->va_nodeid = nodeid;
86 static int
87 zfs_replay_error(void *arg1, void *arg2, boolean_t byteswap)
89 (void) arg1, (void) arg2, (void) byteswap;
90 return (SET_ERROR(ENOTSUP));
93 static void
94 zfs_replay_xvattr(lr_attr_t *lrattr, xvattr_t *xvap)
96 xoptattr_t *xoap = NULL;
97 uint64_t *attrs;
98 uint64_t *crtime;
99 uint32_t *bitmap;
100 void *scanstamp;
101 int i;
103 xvap->xva_vattr.va_mask |= ATTR_XVATTR;
104 if ((xoap = xva_getxoptattr(xvap)) == NULL) {
105 xvap->xva_vattr.va_mask &= ~ATTR_XVATTR; /* shouldn't happen */
106 return;
109 ASSERT(lrattr->lr_attr_masksize == xvap->xva_mapsize);
111 bitmap = &lrattr->lr_attr_bitmap;
112 for (i = 0; i != lrattr->lr_attr_masksize; i++, bitmap++)
113 xvap->xva_reqattrmap[i] = *bitmap;
115 attrs = (uint64_t *)(lrattr + lrattr->lr_attr_masksize - 1);
116 crtime = attrs + 1;
117 scanstamp = (caddr_t)(crtime + 2);
119 if (XVA_ISSET_REQ(xvap, XAT_HIDDEN))
120 xoap->xoa_hidden = ((*attrs & XAT0_HIDDEN) != 0);
121 if (XVA_ISSET_REQ(xvap, XAT_SYSTEM))
122 xoap->xoa_system = ((*attrs & XAT0_SYSTEM) != 0);
123 if (XVA_ISSET_REQ(xvap, XAT_ARCHIVE))
124 xoap->xoa_archive = ((*attrs & XAT0_ARCHIVE) != 0);
125 if (XVA_ISSET_REQ(xvap, XAT_READONLY))
126 xoap->xoa_readonly = ((*attrs & XAT0_READONLY) != 0);
127 if (XVA_ISSET_REQ(xvap, XAT_IMMUTABLE))
128 xoap->xoa_immutable = ((*attrs & XAT0_IMMUTABLE) != 0);
129 if (XVA_ISSET_REQ(xvap, XAT_NOUNLINK))
130 xoap->xoa_nounlink = ((*attrs & XAT0_NOUNLINK) != 0);
131 if (XVA_ISSET_REQ(xvap, XAT_APPENDONLY))
132 xoap->xoa_appendonly = ((*attrs & XAT0_APPENDONLY) != 0);
133 if (XVA_ISSET_REQ(xvap, XAT_NODUMP))
134 xoap->xoa_nodump = ((*attrs & XAT0_NODUMP) != 0);
135 if (XVA_ISSET_REQ(xvap, XAT_OPAQUE))
136 xoap->xoa_opaque = ((*attrs & XAT0_OPAQUE) != 0);
137 if (XVA_ISSET_REQ(xvap, XAT_AV_MODIFIED))
138 xoap->xoa_av_modified = ((*attrs & XAT0_AV_MODIFIED) != 0);
139 if (XVA_ISSET_REQ(xvap, XAT_AV_QUARANTINED))
140 xoap->xoa_av_quarantined =
141 ((*attrs & XAT0_AV_QUARANTINED) != 0);
142 if (XVA_ISSET_REQ(xvap, XAT_CREATETIME))
143 ZFS_TIME_DECODE(&xoap->xoa_createtime, crtime);
144 if (XVA_ISSET_REQ(xvap, XAT_AV_SCANSTAMP)) {
145 ASSERT(!XVA_ISSET_REQ(xvap, XAT_PROJID));
147 memcpy(xoap->xoa_av_scanstamp, scanstamp, AV_SCANSTAMP_SZ);
148 } else if (XVA_ISSET_REQ(xvap, XAT_PROJID)) {
150 * XAT_PROJID and XAT_AV_SCANSTAMP will never be valid
151 * at the same time, so we can share the same space.
153 memcpy(&xoap->xoa_projid, scanstamp, sizeof (uint64_t));
155 if (XVA_ISSET_REQ(xvap, XAT_REPARSE))
156 xoap->xoa_reparse = ((*attrs & XAT0_REPARSE) != 0);
157 if (XVA_ISSET_REQ(xvap, XAT_OFFLINE))
158 xoap->xoa_offline = ((*attrs & XAT0_OFFLINE) != 0);
159 if (XVA_ISSET_REQ(xvap, XAT_SPARSE))
160 xoap->xoa_sparse = ((*attrs & XAT0_SPARSE) != 0);
161 if (XVA_ISSET_REQ(xvap, XAT_PROJINHERIT))
162 xoap->xoa_projinherit = ((*attrs & XAT0_PROJINHERIT) != 0);
165 static int
166 zfs_replay_domain_cnt(uint64_t uid, uint64_t gid)
168 uint64_t uid_idx;
169 uint64_t gid_idx;
170 int domcnt = 0;
172 uid_idx = FUID_INDEX(uid);
173 gid_idx = FUID_INDEX(gid);
174 if (uid_idx)
175 domcnt++;
176 if (gid_idx > 0 && gid_idx != uid_idx)
177 domcnt++;
179 return (domcnt);
182 static void *
183 zfs_replay_fuid_domain_common(zfs_fuid_info_t *fuid_infop, void *start,
184 int domcnt)
186 int i;
188 for (i = 0; i != domcnt; i++) {
189 fuid_infop->z_domain_table[i] = start;
190 start = (caddr_t)start + strlen(start) + 1;
193 return (start);
197 * Set the uid/gid in the fuid_info structure.
199 static void
200 zfs_replay_fuid_ugid(zfs_fuid_info_t *fuid_infop, uint64_t uid, uint64_t gid)
203 * If owner or group are log specific FUIDs then slurp up
204 * domain information and build zfs_fuid_info_t
206 if (IS_EPHEMERAL(uid))
207 fuid_infop->z_fuid_owner = uid;
209 if (IS_EPHEMERAL(gid))
210 fuid_infop->z_fuid_group = gid;
214 * Load fuid domains into fuid_info_t
216 static zfs_fuid_info_t *
217 zfs_replay_fuid_domain(void *buf, void **end, uint64_t uid, uint64_t gid)
219 int domcnt;
221 zfs_fuid_info_t *fuid_infop;
223 fuid_infop = zfs_fuid_info_alloc();
225 domcnt = zfs_replay_domain_cnt(uid, gid);
227 if (domcnt == 0)
228 return (fuid_infop);
230 fuid_infop->z_domain_table =
231 kmem_zalloc(domcnt * sizeof (char *), KM_SLEEP);
233 zfs_replay_fuid_ugid(fuid_infop, uid, gid);
235 fuid_infop->z_domain_cnt = domcnt;
236 *end = zfs_replay_fuid_domain_common(fuid_infop, buf, domcnt);
237 return (fuid_infop);
241 * load zfs_fuid_t's and fuid_domains into fuid_info_t
243 static zfs_fuid_info_t *
244 zfs_replay_fuids(void *start, void **end, int idcnt, int domcnt, uint64_t uid,
245 uint64_t gid)
247 uint64_t *log_fuid = (uint64_t *)start;
248 zfs_fuid_info_t *fuid_infop;
249 int i;
251 fuid_infop = zfs_fuid_info_alloc();
252 fuid_infop->z_domain_cnt = domcnt;
254 fuid_infop->z_domain_table =
255 kmem_zalloc(domcnt * sizeof (char *), KM_SLEEP);
257 for (i = 0; i != idcnt; i++) {
258 zfs_fuid_t *zfuid;
260 zfuid = kmem_alloc(sizeof (zfs_fuid_t), KM_SLEEP);
261 zfuid->z_logfuid = *log_fuid;
262 zfuid->z_id = -1;
263 zfuid->z_domidx = 0;
264 list_insert_tail(&fuid_infop->z_fuids, zfuid);
265 log_fuid++;
268 zfs_replay_fuid_ugid(fuid_infop, uid, gid);
270 *end = zfs_replay_fuid_domain_common(fuid_infop, log_fuid, domcnt);
271 return (fuid_infop);
274 static void
275 zfs_replay_swap_attrs(lr_attr_t *lrattr)
277 /* swap the lr_attr structure */
278 byteswap_uint32_array(lrattr, sizeof (*lrattr));
279 /* swap the bitmap */
280 byteswap_uint32_array(lrattr + 1, (lrattr->lr_attr_masksize - 1) *
281 sizeof (uint32_t));
282 /* swap the attributes, create time + 64 bit word for attributes */
283 byteswap_uint64_array((caddr_t)(lrattr + 1) + (sizeof (uint32_t) *
284 (lrattr->lr_attr_masksize - 1)), 3 * sizeof (uint64_t));
288 * Replay file create with optional ACL, xvattr information as well
289 * as option FUID information.
291 static int
292 zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
294 zfsvfs_t *zfsvfs = arg1;
295 lr_acl_create_t *lracl = arg2;
296 _lr_create_t *lr = &lracl->lr_create;
297 char *name = NULL; /* location determined later */
298 znode_t *dzp;
299 znode_t *zp;
300 xvattr_t xva;
301 int vflg = 0;
302 vsecattr_t vsec = { 0 };
303 lr_attr_t *lrattr;
304 uint8_t *aclstart;
305 uint8_t *fuidstart;
306 size_t xvatlen = 0;
307 uint64_t txtype;
308 uint64_t objid;
309 uint64_t dnodesize;
310 int error;
312 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lracl));
314 txtype = (lr->lr_common.lrc_txtype & ~TX_CI);
315 if (byteswap) {
316 byteswap_uint64_array(lracl, sizeof (*lracl));
317 if (txtype == TX_CREATE_ACL_ATTR ||
318 txtype == TX_MKDIR_ACL_ATTR) {
319 lrattr = (lr_attr_t *)&lracl->lr_data[0];
320 zfs_replay_swap_attrs(lrattr);
321 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
324 aclstart = &lracl->lr_data[xvatlen];
325 zfs_ace_byteswap(aclstart, lracl->lr_acl_bytes, B_FALSE);
327 /* swap fuids */
328 if (lracl->lr_fuidcnt) {
329 byteswap_uint64_array(
330 &aclstart[ZIL_ACE_LENGTH(lracl->lr_acl_bytes)],
331 lracl->lr_fuidcnt * sizeof (uint64_t));
335 if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
336 return (error);
338 objid = LR_FOID_GET_OBJ(lr->lr_foid);
339 dnodesize = LR_FOID_GET_SLOTS(lr->lr_foid) << DNODE_SHIFT;
341 xva_init(&xva);
342 zfs_init_vattr(&xva.xva_vattr, ATTR_MODE | ATTR_UID | ATTR_GID,
343 lr->lr_mode, lr->lr_uid, lr->lr_gid, lr->lr_rdev, objid);
346 * All forms of zfs create (create, mkdir, mkxattrdir, symlink)
347 * eventually end up in zfs_mknode(), which assigns the object's
348 * creation time, generation number, and dnode size. The generic
349 * zfs_create() has no concept of these attributes, so we smuggle
350 * the values inside the vattr's otherwise unused va_ctime,
351 * va_nblocks, and va_fsid fields.
353 ZFS_TIME_DECODE(&xva.xva_vattr.va_ctime, lr->lr_crtime);
354 xva.xva_vattr.va_nblocks = lr->lr_gen;
355 xva.xva_vattr.va_fsid = dnodesize;
357 error = dnode_try_claim(zfsvfs->z_os, objid, dnodesize >> DNODE_SHIFT);
358 if (error)
359 goto bail;
361 if (lr->lr_common.lrc_txtype & TX_CI)
362 vflg |= FIGNORECASE;
363 switch (txtype) {
364 case TX_CREATE_ACL:
365 aclstart = &lracl->lr_data[0];
366 fuidstart = &aclstart[ZIL_ACE_LENGTH(lracl->lr_acl_bytes)];
367 zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
368 (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
369 lr->lr_uid, lr->lr_gid);
370 zfs_fallthrough;
371 case TX_CREATE_ACL_ATTR:
372 if (name == NULL) {
373 lrattr = (lr_attr_t *)&lracl->lr_data[0];
374 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
375 xva.xva_vattr.va_mask |= ATTR_XVATTR;
376 zfs_replay_xvattr(lrattr, &xva);
378 vsec.vsa_mask = VSA_ACE | VSA_ACE_ACLFLAGS;
379 vsec.vsa_aclentp = &lracl->lr_data[xvatlen];
380 vsec.vsa_aclcnt = lracl->lr_aclcnt;
381 vsec.vsa_aclentsz = lracl->lr_acl_bytes;
382 vsec.vsa_aclflags = lracl->lr_acl_flags;
383 if (zfsvfs->z_fuid_replay == NULL) {
384 fuidstart = &lracl->lr_data[xvatlen +
385 ZIL_ACE_LENGTH(lracl->lr_acl_bytes)];
386 zfsvfs->z_fuid_replay =
387 zfs_replay_fuids(fuidstart,
388 (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
389 lr->lr_uid, lr->lr_gid);
392 #if defined(__linux__)
393 error = zfs_create(dzp, name, &xva.xva_vattr,
394 0, 0, &zp, kcred, vflg, &vsec, zfs_init_idmap);
395 #else
396 error = zfs_create(dzp, name, &xva.xva_vattr,
397 0, 0, &zp, kcred, vflg, &vsec, NULL);
398 #endif
399 break;
400 case TX_MKDIR_ACL:
401 aclstart = &lracl->lr_data[0];
402 fuidstart = &aclstart[ZIL_ACE_LENGTH(lracl->lr_acl_bytes)];
403 zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
404 (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
405 lr->lr_uid, lr->lr_gid);
406 zfs_fallthrough;
407 case TX_MKDIR_ACL_ATTR:
408 if (name == NULL) {
409 lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
410 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
411 zfs_replay_xvattr(lrattr, &xva);
413 vsec.vsa_mask = VSA_ACE | VSA_ACE_ACLFLAGS;
414 vsec.vsa_aclentp = &lracl->lr_data[xvatlen];
415 vsec.vsa_aclcnt = lracl->lr_aclcnt;
416 vsec.vsa_aclentsz = lracl->lr_acl_bytes;
417 vsec.vsa_aclflags = lracl->lr_acl_flags;
418 if (zfsvfs->z_fuid_replay == NULL) {
419 fuidstart = &lracl->lr_data[xvatlen +
420 ZIL_ACE_LENGTH(lracl->lr_acl_bytes)];
421 zfsvfs->z_fuid_replay =
422 zfs_replay_fuids(fuidstart,
423 (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
424 lr->lr_uid, lr->lr_gid);
426 #if defined(__linux__)
427 error = zfs_mkdir(dzp, name, &xva.xva_vattr,
428 &zp, kcred, vflg, &vsec, zfs_init_idmap);
429 #else
430 error = zfs_mkdir(dzp, name, &xva.xva_vattr,
431 &zp, kcred, vflg, &vsec, NULL);
432 #endif
433 break;
434 default:
435 error = SET_ERROR(ENOTSUP);
438 bail:
439 if (error == 0 && zp != NULL) {
440 #ifdef __FreeBSD__
441 VOP_UNLOCK(ZTOV(zp));
442 #endif
443 zrele(zp);
445 zrele(dzp);
447 if (zfsvfs->z_fuid_replay)
448 zfs_fuid_info_free(zfsvfs->z_fuid_replay);
449 zfsvfs->z_fuid_replay = NULL;
451 return (error);
454 static int
455 zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
457 zfsvfs_t *zfsvfs = arg1;
458 lr_create_t *lrc = arg2;
459 _lr_create_t *lr = &lrc->lr_create;
460 char *name = NULL; /* location determined later */
461 char *link; /* symlink content follows name */
462 znode_t *dzp;
463 znode_t *zp = NULL;
464 xvattr_t xva;
465 int vflg = 0;
466 lr_attr_t *lrattr;
467 void *start;
468 size_t xvatlen;
469 uint64_t txtype;
470 uint64_t objid;
471 uint64_t dnodesize;
472 int error;
474 ASSERT3U(lr->lr_common.lrc_reclen, >, sizeof (*lr));
476 txtype = (lr->lr_common.lrc_txtype & ~TX_CI);
477 if (byteswap) {
478 byteswap_uint64_array(lrc, sizeof (*lrc));
479 if (txtype == TX_CREATE_ATTR || txtype == TX_MKDIR_ATTR)
480 zfs_replay_swap_attrs((lr_attr_t *)&lrc->lr_data[0]);
484 if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
485 return (error);
487 objid = LR_FOID_GET_OBJ(lr->lr_foid);
488 dnodesize = LR_FOID_GET_SLOTS(lr->lr_foid) << DNODE_SHIFT;
490 xva_init(&xva);
491 zfs_init_vattr(&xva.xva_vattr, ATTR_MODE | ATTR_UID | ATTR_GID,
492 lr->lr_mode, lr->lr_uid, lr->lr_gid, lr->lr_rdev, objid);
495 * All forms of zfs create (create, mkdir, mkxattrdir, symlink)
496 * eventually end up in zfs_mknode(), which assigns the object's
497 * creation time, generation number, and dnode slot count. The
498 * generic zfs_create() has no concept of these attributes, so
499 * we smuggle the values inside the vattr's otherwise unused
500 * va_ctime, va_nblocks, and va_fsid fields.
502 ZFS_TIME_DECODE(&xva.xva_vattr.va_ctime, lr->lr_crtime);
503 xva.xva_vattr.va_nblocks = lr->lr_gen;
504 xva.xva_vattr.va_fsid = dnodesize;
506 error = dnode_try_claim(zfsvfs->z_os, objid, dnodesize >> DNODE_SHIFT);
507 if (error)
508 goto out;
510 if (lr->lr_common.lrc_txtype & TX_CI)
511 vflg |= FIGNORECASE;
514 * Symlinks don't have fuid info, and CIFS never creates
515 * symlinks.
517 * The _ATTR versions will grab the fuid info in their subcases.
519 if (txtype != TX_SYMLINK &&
520 txtype != TX_MKDIR_ATTR &&
521 txtype != TX_CREATE_ATTR) {
522 start = (void *)&lrc->lr_data[0];
523 zfsvfs->z_fuid_replay =
524 zfs_replay_fuid_domain(start, &start,
525 lr->lr_uid, lr->lr_gid);
528 switch (txtype) {
529 case TX_CREATE_ATTR:
530 lrattr = (lr_attr_t *)&lrc->lr_data[0];
531 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
532 zfs_replay_xvattr(lrattr, &xva);
533 start = (void *)&lrc->lr_data[xvatlen];
534 zfsvfs->z_fuid_replay =
535 zfs_replay_fuid_domain(start, &start,
536 lr->lr_uid, lr->lr_gid);
537 name = (char *)start;
538 zfs_fallthrough;
540 case TX_CREATE:
541 if (name == NULL)
542 name = (char *)start;
544 #if defined(__linux__)
545 error = zfs_create(dzp, name, &xva.xva_vattr,
546 0, 0, &zp, kcred, vflg, NULL, zfs_init_idmap);
547 #else
548 error = zfs_create(dzp, name, &xva.xva_vattr,
549 0, 0, &zp, kcred, vflg, NULL, NULL);
550 #endif
551 break;
552 case TX_MKDIR_ATTR:
553 lrattr = (lr_attr_t *)&lrc->lr_data[0];
554 xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
555 zfs_replay_xvattr(lrattr, &xva);
556 start = &lrc->lr_data[xvatlen];
557 zfsvfs->z_fuid_replay =
558 zfs_replay_fuid_domain(start, &start,
559 lr->lr_uid, lr->lr_gid);
560 name = (char *)start;
561 zfs_fallthrough;
563 case TX_MKDIR:
564 if (name == NULL)
565 name = (char *)&lrc->lr_data[0];
567 #if defined(__linux__)
568 error = zfs_mkdir(dzp, name, &xva.xva_vattr,
569 &zp, kcred, vflg, NULL, zfs_init_idmap);
570 #else
571 error = zfs_mkdir(dzp, name, &xva.xva_vattr,
572 &zp, kcred, vflg, NULL, NULL);
573 #endif
575 break;
576 case TX_MKXATTR:
577 error = zfs_make_xattrdir(dzp, &xva.xva_vattr, &zp, kcred);
578 break;
579 case TX_SYMLINK:
580 name = &lrc->lr_data[0];
581 link = &lrc->lr_data[strlen(name) + 1];
582 #if defined(__linux__)
583 error = zfs_symlink(dzp, name, &xva.xva_vattr,
584 link, &zp, kcred, vflg, zfs_init_idmap);
585 #else
586 error = zfs_symlink(dzp, name, &xva.xva_vattr,
587 link, &zp, kcred, vflg, NULL);
588 #endif
589 break;
590 default:
591 error = SET_ERROR(ENOTSUP);
594 out:
595 if (error == 0 && zp != NULL) {
596 #ifdef __FreeBSD__
597 VOP_UNLOCK(ZTOV(zp));
598 #endif
599 zrele(zp);
601 zrele(dzp);
603 if (zfsvfs->z_fuid_replay)
604 zfs_fuid_info_free(zfsvfs->z_fuid_replay);
605 zfsvfs->z_fuid_replay = NULL;
606 return (error);
609 static int
610 zfs_replay_remove(void *arg1, void *arg2, boolean_t byteswap)
612 zfsvfs_t *zfsvfs = arg1;
613 lr_remove_t *lr = arg2;
614 char *name = (char *)&lr->lr_data[0]; /* name follows lr_remove_t */
615 znode_t *dzp;
616 int error;
617 int vflg = 0;
619 ASSERT3U(lr->lr_common.lrc_reclen, >, sizeof (*lr));
621 if (byteswap)
622 byteswap_uint64_array(lr, sizeof (*lr));
624 if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
625 return (error);
627 if (lr->lr_common.lrc_txtype & TX_CI)
628 vflg |= FIGNORECASE;
630 switch ((int)lr->lr_common.lrc_txtype) {
631 case TX_REMOVE:
632 error = zfs_remove(dzp, name, kcred, vflg);
633 break;
634 case TX_RMDIR:
635 error = zfs_rmdir(dzp, name, NULL, kcred, vflg);
636 break;
637 default:
638 error = SET_ERROR(ENOTSUP);
641 zrele(dzp);
643 return (error);
646 static int
647 zfs_replay_link(void *arg1, void *arg2, boolean_t byteswap)
649 zfsvfs_t *zfsvfs = arg1;
650 lr_link_t *lr = arg2;
651 char *name = &lr->lr_data[0]; /* name follows lr_link_t */
652 znode_t *dzp, *zp;
653 int error;
654 int vflg = 0;
656 ASSERT3U(lr->lr_common.lrc_reclen, >, sizeof (*lr));
658 if (byteswap)
659 byteswap_uint64_array(lr, sizeof (*lr));
661 if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
662 return (error);
664 if ((error = zfs_zget(zfsvfs, lr->lr_link_obj, &zp)) != 0) {
665 zrele(dzp);
666 return (error);
669 if (lr->lr_common.lrc_txtype & TX_CI)
670 vflg |= FIGNORECASE;
672 error = zfs_link(dzp, zp, name, kcred, vflg);
673 zrele(zp);
674 zrele(dzp);
676 return (error);
679 static int
680 do_zfs_replay_rename(zfsvfs_t *zfsvfs, _lr_rename_t *lr, char *sname,
681 char *tname, uint64_t rflags, vattr_t *wo_vap)
683 znode_t *sdzp, *tdzp;
684 int error, vflg = 0;
686 /* Only Linux currently supports RENAME_* flags. */
687 #ifdef __linux__
688 VERIFY0(rflags & ~(RENAME_EXCHANGE | RENAME_WHITEOUT));
690 /* wo_vap must be non-NULL iff. we're doing RENAME_WHITEOUT */
691 VERIFY_EQUIV(rflags & RENAME_WHITEOUT, wo_vap != NULL);
692 #else
693 VERIFY0(rflags);
694 #endif
696 if ((error = zfs_zget(zfsvfs, lr->lr_sdoid, &sdzp)) != 0)
697 return (error);
699 if ((error = zfs_zget(zfsvfs, lr->lr_tdoid, &tdzp)) != 0) {
700 zrele(sdzp);
701 return (error);
704 if (lr->lr_common.lrc_txtype & TX_CI)
705 vflg |= FIGNORECASE;
707 #if defined(__linux__)
708 error = zfs_rename(sdzp, sname, tdzp, tname, kcred, vflg, rflags,
709 wo_vap, zfs_init_idmap);
710 #else
711 error = zfs_rename(sdzp, sname, tdzp, tname, kcred, vflg, rflags,
712 wo_vap, NULL);
713 #endif
715 zrele(tdzp);
716 zrele(sdzp);
717 return (error);
720 static int
721 zfs_replay_rename(void *arg1, void *arg2, boolean_t byteswap)
723 zfsvfs_t *zfsvfs = arg1;
724 lr_rename_t *lrr = arg2;
725 _lr_rename_t *lr = &lrr->lr_rename;
727 ASSERT3U(lr->lr_common.lrc_reclen, >, sizeof (*lr));
729 if (byteswap)
730 byteswap_uint64_array(lrr, sizeof (*lrr));
732 /* sname and tname follow lr_rename_t */
733 char *sname = (char *)&lrr->lr_data[0];
734 char *tname = (char *)&lrr->lr_data[strlen(sname)+1];
735 return (do_zfs_replay_rename(zfsvfs, lr, sname, tname, 0, NULL));
738 static int
739 zfs_replay_rename_exchange(void *arg1, void *arg2, boolean_t byteswap)
741 #ifdef __linux__
742 zfsvfs_t *zfsvfs = arg1;
743 lr_rename_t *lrr = arg2;
744 _lr_rename_t *lr = &lrr->lr_rename;
746 ASSERT3U(lr->lr_common.lrc_reclen, >, sizeof (*lr));
748 if (byteswap)
749 byteswap_uint64_array(lrr, sizeof (*lrr));
751 /* sname and tname follow lr_rename_t */
752 char *sname = (char *)&lrr->lr_data[0];
753 char *tname = (char *)&lrr->lr_data[strlen(sname)+1];
754 return (do_zfs_replay_rename(zfsvfs, lr, sname, tname, RENAME_EXCHANGE,
755 NULL));
756 #else
757 return (SET_ERROR(ENOTSUP));
758 #endif
761 static int
762 zfs_replay_rename_whiteout(void *arg1, void *arg2, boolean_t byteswap)
764 #ifdef __linux__
765 zfsvfs_t *zfsvfs = arg1;
766 lr_rename_whiteout_t *lrrw = arg2;
767 _lr_rename_t *lr = &lrrw->lr_rename;
768 int error;
769 /* For the whiteout file. */
770 xvattr_t xva;
771 uint64_t objid;
772 uint64_t dnodesize;
774 ASSERT3U(lr->lr_common.lrc_reclen, >, sizeof (*lr));
776 if (byteswap)
777 byteswap_uint64_array(lrrw, sizeof (*lrrw));
779 objid = LR_FOID_GET_OBJ(lrrw->lr_wfoid);
780 dnodesize = LR_FOID_GET_SLOTS(lrrw->lr_wfoid) << DNODE_SHIFT;
782 xva_init(&xva);
783 zfs_init_vattr(&xva.xva_vattr, ATTR_MODE | ATTR_UID | ATTR_GID,
784 lrrw->lr_wmode, lrrw->lr_wuid, lrrw->lr_wgid, lrrw->lr_wrdev,
785 objid);
788 * As with TX_CREATE, RENAME_WHITEOUT ends up in zfs_mknode(), which
789 * assigns the object's creation time, generation number, and dnode
790 * slot count. The generic zfs_rename() has no concept of these
791 * attributes, so we smuggle the values inside the vattr's otherwise
792 * unused va_ctime, va_nblocks, and va_fsid fields.
794 ZFS_TIME_DECODE(&xva.xva_vattr.va_ctime, lrrw->lr_wcrtime);
795 xva.xva_vattr.va_nblocks = lrrw->lr_wgen;
796 xva.xva_vattr.va_fsid = dnodesize;
798 error = dnode_try_claim(zfsvfs->z_os, objid, dnodesize >> DNODE_SHIFT);
799 if (error)
800 return (error);
802 /* sname and tname follow lr_rename_whiteout_t */
803 char *sname = (char *)&lrrw->lr_data[0];
804 char *tname = (char *)&lrrw->lr_data[strlen(sname)+1];
805 return (do_zfs_replay_rename(zfsvfs, lr, sname, tname,
806 RENAME_WHITEOUT, &xva.xva_vattr));
807 #else
808 return (SET_ERROR(ENOTSUP));
809 #endif
812 static int
813 zfs_replay_write(void *arg1, void *arg2, boolean_t byteswap)
815 zfsvfs_t *zfsvfs = arg1;
816 lr_write_t *lr = arg2;
817 char *data = &lr->lr_data[0]; /* data follows lr_write_t */
818 znode_t *zp;
819 int error;
820 uint64_t eod, offset, length;
822 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr));
824 if (byteswap)
825 byteswap_uint64_array(lr, sizeof (*lr));
827 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) {
829 * As we can log writes out of order, it's possible the
830 * file has been removed. In this case just drop the write
831 * and return success.
833 if (error == ENOENT)
834 error = 0;
835 return (error);
838 offset = lr->lr_offset;
839 length = lr->lr_length;
840 eod = offset + length; /* end of data for this write */
843 * This may be a write from a dmu_sync() for a whole block,
844 * and may extend beyond the current end of the file.
845 * We can't just replay what was written for this TX_WRITE as
846 * a future TX_WRITE2 may extend the eof and the data for that
847 * write needs to be there. So we write the whole block and
848 * reduce the eof. This needs to be done within the single dmu
849 * transaction created within vn_rdwr -> zfs_write. So a possible
850 * new end of file is passed through in zfsvfs->z_replay_eof
853 zfsvfs->z_replay_eof = 0; /* 0 means don't change end of file */
855 /* If it's a dmu_sync() block, write the whole block */
856 if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) {
857 uint64_t blocksize = BP_GET_LSIZE(&lr->lr_blkptr);
858 if (length < blocksize) {
859 offset -= offset % blocksize;
860 length = blocksize;
862 if (zp->z_size < eod)
863 zfsvfs->z_replay_eof = eod;
865 error = zfs_write_simple(zp, data, length, offset, NULL);
866 zrele(zp);
867 zfsvfs->z_replay_eof = 0; /* safety */
869 return (error);
873 * TX_WRITE2 are only generated when dmu_sync() returns EALREADY
874 * meaning the pool block is already being synced. So now that we always write
875 * out full blocks, all we have to do is expand the eof if
876 * the file is grown.
878 static int
879 zfs_replay_write2(void *arg1, void *arg2, boolean_t byteswap)
881 zfsvfs_t *zfsvfs = arg1;
882 lr_write_t *lr = arg2;
883 znode_t *zp;
884 int error;
885 uint64_t end;
887 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr));
889 if (byteswap)
890 byteswap_uint64_array(lr, sizeof (*lr));
892 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
893 return (error);
895 top:
896 end = lr->lr_offset + lr->lr_length;
897 if (end > zp->z_size) {
898 dmu_tx_t *tx = dmu_tx_create(zfsvfs->z_os);
900 zp->z_size = end;
901 dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
902 error = dmu_tx_assign(tx, TXG_WAIT);
903 if (error) {
904 zrele(zp);
905 if (error == ERESTART) {
906 dmu_tx_wait(tx);
907 dmu_tx_abort(tx);
908 goto top;
910 dmu_tx_abort(tx);
911 return (error);
913 (void) sa_update(zp->z_sa_hdl, SA_ZPL_SIZE(zfsvfs),
914 (void *)&zp->z_size, sizeof (uint64_t), tx);
916 /* Ensure the replayed seq is updated */
917 (void) zil_replaying(zfsvfs->z_log, tx);
919 dmu_tx_commit(tx);
922 zrele(zp);
924 return (error);
927 static int
928 zfs_replay_truncate(void *arg1, void *arg2, boolean_t byteswap)
930 zfsvfs_t *zfsvfs = arg1;
931 lr_truncate_t *lr = arg2;
932 znode_t *zp;
933 flock64_t fl = {0};
934 int error;
936 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr));
938 if (byteswap)
939 byteswap_uint64_array(lr, sizeof (*lr));
941 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
942 return (error);
944 fl.l_type = F_WRLCK;
945 fl.l_whence = SEEK_SET;
946 fl.l_start = lr->lr_offset;
947 fl.l_len = lr->lr_length;
949 error = zfs_space(zp, F_FREESP, &fl, O_RDWR | O_LARGEFILE,
950 lr->lr_offset, kcred);
952 zrele(zp);
954 return (error);
957 static int
958 zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
960 zfsvfs_t *zfsvfs = arg1;
961 lr_setattr_t *lr = arg2;
962 znode_t *zp;
963 xvattr_t xva;
964 vattr_t *vap = &xva.xva_vattr;
965 int error;
966 void *start;
968 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr));
970 xva_init(&xva);
971 if (byteswap) {
972 byteswap_uint64_array(lr, sizeof (*lr));
974 if ((lr->lr_mask & ATTR_XVATTR) &&
975 zfsvfs->z_version >= ZPL_VERSION_INITIAL)
976 zfs_replay_swap_attrs((lr_attr_t *)&lr->lr_data[0]);
979 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
980 return (error);
982 zfs_init_vattr(vap, lr->lr_mask, lr->lr_mode,
983 lr->lr_uid, lr->lr_gid, 0, lr->lr_foid);
985 vap->va_size = lr->lr_size;
986 ZFS_TIME_DECODE(&vap->va_atime, lr->lr_atime);
987 ZFS_TIME_DECODE(&vap->va_mtime, lr->lr_mtime);
988 gethrestime(&vap->va_ctime);
989 vap->va_mask |= ATTR_CTIME;
992 * Fill in xvattr_t portions if necessary.
995 start = (void *)&lr->lr_data[0];
996 if (vap->va_mask & ATTR_XVATTR) {
997 zfs_replay_xvattr((lr_attr_t *)start, &xva);
998 start = &lr->lr_data[
999 ZIL_XVAT_SIZE(((lr_attr_t *)start)->lr_attr_masksize)];
1000 } else
1001 xva.xva_vattr.va_mask &= ~ATTR_XVATTR;
1003 zfsvfs->z_fuid_replay = zfs_replay_fuid_domain(start, &start,
1004 lr->lr_uid, lr->lr_gid);
1006 #if defined(__linux__)
1007 error = zfs_setattr(zp, vap, 0, kcred, zfs_init_idmap);
1008 #else
1009 error = zfs_setattr(zp, vap, 0, kcred, NULL);
1010 #endif
1012 zfs_fuid_info_free(zfsvfs->z_fuid_replay);
1013 zfsvfs->z_fuid_replay = NULL;
1014 zrele(zp);
1016 return (error);
1019 static int
1020 zfs_replay_setsaxattr(void *arg1, void *arg2, boolean_t byteswap)
1022 zfsvfs_t *zfsvfs = arg1;
1023 lr_setsaxattr_t *lr = arg2;
1024 znode_t *zp;
1025 nvlist_t *nvl;
1026 size_t sa_size;
1027 char *name;
1028 char *value;
1029 size_t size;
1030 int error = 0;
1032 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr));
1033 ASSERT3U(lr->lr_common.lrc_reclen, >, sizeof (*lr) + lr->lr_size);
1035 ASSERT(spa_feature_is_active(zfsvfs->z_os->os_spa,
1036 SPA_FEATURE_ZILSAXATTR));
1037 if (byteswap)
1038 byteswap_uint64_array(lr, sizeof (*lr));
1040 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
1041 return (error);
1043 rw_enter(&zp->z_xattr_lock, RW_WRITER);
1044 mutex_enter(&zp->z_lock);
1045 if (zp->z_xattr_cached == NULL)
1046 error = zfs_sa_get_xattr(zp);
1047 mutex_exit(&zp->z_lock);
1049 if (error)
1050 goto out;
1052 ASSERT(zp->z_xattr_cached);
1053 nvl = zp->z_xattr_cached;
1055 /* Get xattr name, value and size from log record */
1056 size = lr->lr_size;
1057 name = (char *)&lr->lr_data[0];
1058 if (size == 0) {
1059 value = NULL;
1060 error = nvlist_remove(nvl, name, DATA_TYPE_BYTE_ARRAY);
1061 } else {
1062 value = &lr->lr_data[strlen(name) + 1];
1063 /* Limited to 32k to keep nvpair memory allocations small */
1064 if (size > DXATTR_MAX_ENTRY_SIZE) {
1065 error = SET_ERROR(EFBIG);
1066 goto out;
1069 /* Prevent the DXATTR SA from consuming the entire SA region */
1070 error = nvlist_size(nvl, &sa_size, NV_ENCODE_XDR);
1071 if (error)
1072 goto out;
1074 if (sa_size > DXATTR_MAX_SA_SIZE) {
1075 error = SET_ERROR(EFBIG);
1076 goto out;
1079 error = nvlist_add_byte_array(nvl, name, (uchar_t *)value,
1080 size);
1084 * Update the SA for additions, modifications, and removals. On
1085 * error drop the inconsistent cached version of the nvlist, it
1086 * will be reconstructed from the ARC when next accessed.
1088 if (error == 0)
1089 error = zfs_sa_set_xattr(zp, name, value, size);
1091 if (error) {
1092 nvlist_free(nvl);
1093 zp->z_xattr_cached = NULL;
1096 out:
1097 rw_exit(&zp->z_xattr_lock);
1098 zrele(zp);
1099 return (error);
1102 static int
1103 zfs_replay_acl_v0(void *arg1, void *arg2, boolean_t byteswap)
1105 zfsvfs_t *zfsvfs = arg1;
1106 lr_acl_v0_t *lr = arg2;
1107 ace_t *ace = (ace_t *)&lr->lr_data[0];
1108 vsecattr_t vsa = {0};
1109 znode_t *zp;
1110 int error;
1112 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr));
1113 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr) +
1114 sizeof (ace_t) * lr->lr_aclcnt);
1116 if (byteswap) {
1117 byteswap_uint64_array(lr, sizeof (*lr));
1118 zfs_oldace_byteswap(ace, lr->lr_aclcnt);
1121 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
1122 return (error);
1124 vsa.vsa_mask = VSA_ACE | VSA_ACECNT;
1125 vsa.vsa_aclcnt = lr->lr_aclcnt;
1126 vsa.vsa_aclentsz = sizeof (ace_t) * vsa.vsa_aclcnt;
1127 vsa.vsa_aclflags = 0;
1128 vsa.vsa_aclentp = ace;
1130 error = zfs_setsecattr(zp, &vsa, 0, kcred);
1132 zrele(zp);
1134 return (error);
1138 * Replaying ACLs is complicated by FUID support.
1139 * The log record may contain some optional data
1140 * to be used for replaying FUID's. These pieces
1141 * are the actual FUIDs that were created initially.
1142 * The FUID table index may no longer be valid and
1143 * during zfs_create() a new index may be assigned.
1144 * Because of this the log will contain the original
1145 * domain+rid in order to create a new FUID.
1147 * The individual ACEs may contain an ephemeral uid/gid which is no
1148 * longer valid and will need to be replaced with an actual FUID.
1151 static int
1152 zfs_replay_acl(void *arg1, void *arg2, boolean_t byteswap)
1154 zfsvfs_t *zfsvfs = arg1;
1155 lr_acl_t *lr = arg2;
1156 ace_t *ace = (ace_t *)&lr->lr_data[0];
1157 vsecattr_t vsa = {0};
1158 znode_t *zp;
1159 int error;
1161 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr));
1162 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr) + lr->lr_acl_bytes);
1164 if (byteswap) {
1165 byteswap_uint64_array(lr, sizeof (*lr));
1166 zfs_ace_byteswap(ace, lr->lr_acl_bytes, B_FALSE);
1167 if (lr->lr_fuidcnt) {
1168 byteswap_uint64_array(&lr->lr_data[
1169 ZIL_ACE_LENGTH(lr->lr_acl_bytes)],
1170 lr->lr_fuidcnt * sizeof (uint64_t));
1174 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0)
1175 return (error);
1177 vsa.vsa_mask = VSA_ACE | VSA_ACECNT | VSA_ACE_ACLFLAGS;
1178 vsa.vsa_aclcnt = lr->lr_aclcnt;
1179 vsa.vsa_aclentp = ace;
1180 vsa.vsa_aclentsz = lr->lr_acl_bytes;
1181 vsa.vsa_aclflags = lr->lr_acl_flags;
1183 if (lr->lr_fuidcnt) {
1184 void *fuidstart = &lr->lr_data[
1185 ZIL_ACE_LENGTH(lr->lr_acl_bytes)];
1187 zfsvfs->z_fuid_replay =
1188 zfs_replay_fuids(fuidstart, &fuidstart,
1189 lr->lr_fuidcnt, lr->lr_domcnt, 0, 0);
1192 error = zfs_setsecattr(zp, &vsa, 0, kcred);
1194 if (zfsvfs->z_fuid_replay)
1195 zfs_fuid_info_free(zfsvfs->z_fuid_replay);
1197 zfsvfs->z_fuid_replay = NULL;
1198 zrele(zp);
1200 return (error);
1203 static int
1204 zfs_replay_clone_range(void *arg1, void *arg2, boolean_t byteswap)
1206 zfsvfs_t *zfsvfs = arg1;
1207 lr_clone_range_t *lr = arg2;
1208 znode_t *zp;
1209 int error;
1211 ASSERT3U(lr->lr_common.lrc_reclen, >=, sizeof (*lr));
1212 ASSERT3U(lr->lr_common.lrc_reclen, >=, offsetof(lr_clone_range_t,
1213 lr_bps[lr->lr_nbps]));
1215 if (byteswap)
1216 byteswap_uint64_array(lr, sizeof (*lr));
1218 if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) {
1220 * Clones can be logged out of order, so don't be surprised if
1221 * the file is gone - just return success.
1223 if (error == ENOENT)
1224 error = 0;
1225 return (error);
1228 error = zfs_clone_range_replay(zp, lr->lr_offset, lr->lr_length,
1229 lr->lr_blksz, lr->lr_bps, lr->lr_nbps);
1231 zrele(zp);
1232 return (error);
1236 * Callback vectors for replaying records
1238 zil_replay_func_t *const zfs_replay_vector[TX_MAX_TYPE] = {
1239 zfs_replay_error, /* no such type */
1240 zfs_replay_create, /* TX_CREATE */
1241 zfs_replay_create, /* TX_MKDIR */
1242 zfs_replay_create, /* TX_MKXATTR */
1243 zfs_replay_create, /* TX_SYMLINK */
1244 zfs_replay_remove, /* TX_REMOVE */
1245 zfs_replay_remove, /* TX_RMDIR */
1246 zfs_replay_link, /* TX_LINK */
1247 zfs_replay_rename, /* TX_RENAME */
1248 zfs_replay_write, /* TX_WRITE */
1249 zfs_replay_truncate, /* TX_TRUNCATE */
1250 zfs_replay_setattr, /* TX_SETATTR */
1251 zfs_replay_acl_v0, /* TX_ACL_V0 */
1252 zfs_replay_acl, /* TX_ACL */
1253 zfs_replay_create_acl, /* TX_CREATE_ACL */
1254 zfs_replay_create, /* TX_CREATE_ATTR */
1255 zfs_replay_create_acl, /* TX_CREATE_ACL_ATTR */
1256 zfs_replay_create_acl, /* TX_MKDIR_ACL */
1257 zfs_replay_create, /* TX_MKDIR_ATTR */
1258 zfs_replay_create_acl, /* TX_MKDIR_ACL_ATTR */
1259 zfs_replay_write2, /* TX_WRITE2 */
1260 zfs_replay_setsaxattr, /* TX_SETSAXATTR */
1261 zfs_replay_rename_exchange, /* TX_RENAME_EXCHANGE */
1262 zfs_replay_rename_whiteout, /* TX_RENAME_WHITEOUT */
1263 zfs_replay_clone_range, /* TX_CLONE_RANGE */