xref: /titanic_41/usr/src/uts/common/fs/zev/zev_callbacks.c (revision a9b5625ad449e28716053a1fd299e7e3271f750d)
1 #include <sys/mode.h>
2 #include <sys/zfs_znode.h>
3 #include <sys/fs/zfs.h>
4 #include <sys/fs/zev.h>
5 #include <sys/zfs_events.h>
6 #include <sys/zev_checksums.h>
7 #include <sys/dmu_tx.h>
8 #include <sys/mntent.h>
9 
10 #define ZEV_FILL_INODE_INFO(name, znode)				\
11 	do {								\
12 		uint64_t mtime[2], ctime[2];				\
13 		sa_bulk_attr_t bulk[2];					\
14 		int count = 0;						\
15 		timestruc_t mtime_s, ctime_s;				\
16 		SA_ADD_BULK_ATTR(bulk, count,				\
17 			         SA_ZPL_MTIME(znode->z_zfsvfs),		\
18 		                 NULL, &mtime, 16);			\
19 		SA_ADD_BULK_ATTR(bulk, count,				\
20 			         SA_ZPL_CTIME(znode->z_zfsvfs),		\
21 		                 NULL, &ctime, 16);			\
22 		if ((sa_bulk_lookup(znode->z_sa_hdl, bulk, count)) != 0) { \
23 			zev_queue_error(op, "znode write: "		\
24 			                "mtime/ctime unavailable");	\
25 			/* continue anyway, use fake data */		\
26 			mtime_s.tv_sec = ctime_s.tv_sec = 0;		\
27 		}							\
28 		ZFS_TIME_DECODE(&mtime_s, mtime);			\
29 		ZFS_TIME_DECODE(&ctime_s, ctime);			\
30 		rec->name.ino = znode->z_id;				\
31 		rec->name.gen = znode->z_gen;				\
32 		rec->name.mtime = mtime_s.tv_sec;			\
33 		rec->name.ctime = ctime_s.tv_sec;			\
34 		rec->name.size = znode->z_size;				\
35 		rec->name.type = znode->z_vnode->v_type;		\
36 		rec->name.mode =					\
37 			znode->z_mode | VTTOIF(znode->z_vnode->v_type);	\
38 		rec->name.links = znode->z_links;			\
39 		rec->name.flags = znode->z_pflags & ZFS_XATTR ?		\
40 			ZEV_FL_XATTR : 0;				\
41 	} while(0)
42 
43 void
44 zev_zfs_mount_cb(vfs_t *vfs, vnode_t *mpt, char *dataset, boolean_t remount)
45 {
46 	int op = ZEV_OP_ZFS_MOUNT;
47 	char mountpoint[MAXPATHLEN+1];
48 	int mountpoint_len;
49 	int dataset_len;
50 	zev_zfs_mount_t *rec;
51 	zev_msg_t *msg = NULL;
52 	int msg_size;
53 	znode_t *zp_root;
54 
55 	zfsvfs_t *zfsvfs = (zfsvfs_t *)vfs->vfs_data;
56 	if (zfsvfs->z_os->os_dsl_dataset->ds_is_snapshot)
57 		return;
58 	if (zev_skip_pool(zfsvfs->z_os))
59 		return;
60 	if (zev_skip_fs(zfsvfs))
61 		return;
62 	/* expensive, but we don't have many mount ops. */
63 	if ((vnodetopath(NULL, mpt, mountpoint, sizeof(mountpoint),
64 	    kcred)) != 0) {
65 		zev_queue_error(op, "unresolvable mountpoint, dataset=%s",
66 		                dataset);
67 		return;
68 	}
69 	if (zfs_zget(zfsvfs, zfsvfs->z_root, &zp_root) != 0) {
70 		zev_queue_error(op, "can't get root znode, dataset=%s",
71 		                dataset);
72 		return;
73 	}
74 
75 	dataset_len = strlen(dataset);
76 	mountpoint_len = strlen(mountpoint);
77 	msg_size = sizeof(*rec) + dataset_len + 1 + mountpoint_len + 1;
78 	msg = zev_alloc(sizeof(*msg) + msg_size);
79 	msg->size = msg_size;
80 	rec = (zev_zfs_mount_t *)(msg + 1);
81 	rec->record_len = msg_size;
82 	rec->op = op;
83 	rec->op_time = ddi_get_time();
84 	rec->guid = dsl_dataset_phys(zfsvfs->z_os->os_dsl_dataset)->ds_guid;
85 	rec->remount = remount;
86 	rec->dataset_len = dataset_len;
87 	rec->mountpoint_len = mountpoint_len;
88 	ZEV_FILL_INODE_INFO(root, zp_root);
89 	VN_RELE(ZTOV(zp_root));
90 	(void) memcpy(ZEV_DATASET(rec), dataset, dataset_len + 1);
91 	(void) memcpy(ZEV_MOUNTPOINT(rec), mountpoint, mountpoint_len + 1);
92 	zev_queue_message(op, msg);
93 }
94 
95 void
96 zev_zfs_umount_cb(vfs_t *vfs)
97 {
98 	int op = ZEV_OP_ZFS_UMOUNT;
99 	zev_zfs_umount_t *rec;
100 	zev_msg_t *msg = NULL;
101 	int msg_size;
102 	struct vnode *vp;
103 	znode_t *zp;
104 
105 	zfsvfs_t *zfsvfs = (zfsvfs_t *)vfs->vfs_data;
106 	if (zfsvfs->z_os->os_dsl_dataset->ds_is_snapshot)
107 		return;
108 	if (zev_skip_pool(zfsvfs->z_os))
109 		return;
110 	if (zev_skip_fs(zfsvfs))
111 		return;
112 
113 	msg_size = sizeof(*rec);
114 	msg = zev_alloc(sizeof(*msg) + msg_size);
115 	msg->size = msg_size;
116 	rec = (zev_zfs_umount_t *)(msg + 1);
117 	rec->record_len = msg_size;
118 	rec->op = op;
119 	rec->op_time = ddi_get_time();
120 	rec->guid = dsl_dataset_phys(zfsvfs->z_os->os_dsl_dataset)->ds_guid;
121 
122 	vp = vfs->vfs_vnodecovered;
123 	if (strcmp(vfssw[vp->v_vfsp->vfs_fstype].vsw_name, MNTTYPE_ZFS)) {
124 		cmn_err(CE_WARN, "covered inode not on zfs filesystem, "
125 		        "reporting all-zero inode struct.");
126 		memset(&rec->covered, 0, sizeof(rec->covered));
127 	} else {
128 		zp = VTOZ(vfs->vfs_vnodecovered);
129 		ZEV_FILL_INODE_INFO(covered, zp);
130 	}
131 
132 	zev_queue_message(op, msg);
133 }
134 
135 void
136 zev_zvol_truncate_cb(char *dataset,
137                      objset_t *os,
138                      dmu_tx_t *tx,
139                      uint64_t off,
140                      uint64_t len)
141 {
142 	int op = ZEV_OP_ZVOL_TRUNCATE;
143 	zev_zvol_truncate_t *rec;
144 	zev_msg_t *msg = NULL;
145 	int msg_size;
146 	int dataset_len;
147 
148 	if (zev_skip_pool(os))
149 		return;
150 
151 	dataset_len = strlen(dataset);
152 	msg_size = sizeof(*rec) + dataset_len + 1;
153 	msg = zev_alloc(sizeof(*msg) + msg_size);
154 	msg->size = msg_size;
155 	rec = (zev_zvol_truncate_t *)(msg + 1);
156 	rec->record_len = msg_size;
157 	rec->op = op;
158 	rec->op_time = ddi_get_time();
159 	rec->guid = dsl_dataset_phys(os->os_dsl_dataset)->ds_guid;
160 	rec->txg = tx->tx_txg;
161 	rec->offset = off;
162 	rec->length = len;
163 	rec->dataset_len = dataset_len;
164 	(void) memcpy(ZEV_DATASET(rec), dataset, dataset_len + 1);
165 	zev_queue_message(op, msg);
166 }
167 
168 void
169 zev_zvol_write_cb(char *dataset,
170                   objset_t *os,
171                   dmu_tx_t *tx,
172                   uint64_t off,
173                   uint64_t len)
174 {
175 	int op = ZEV_OP_ZVOL_WRITE;
176 	zev_zvol_write_t *rec;
177 	zev_msg_t *msg = NULL;
178 	int msg_size;
179 	int dataset_len;
180 
181 	if (zev_skip_pool(os))
182 		return;
183 
184 	dataset_len = strlen(dataset);
185 	msg_size = sizeof(*rec) + dataset_len + 1;
186 	msg = zev_alloc(sizeof(*msg) + msg_size);
187 	msg->size = msg_size;
188 	rec = (zev_zvol_write_t *)(msg + 1);
189 	rec->record_len = msg_size;
190 	rec->op = op;
191 	rec->op_time = ddi_get_time();
192 	rec->guid = dsl_dataset_phys(os->os_dsl_dataset)->ds_guid;
193 	rec->txg = tx->tx_txg;
194 	rec->offset = off;
195 	rec->length = len;
196 	rec->dataset_len = dataset_len;
197 	(void) memcpy(ZEV_DATASET(rec), dataset, dataset_len + 1);
198 	zev_queue_message(op, msg);
199 }
200 
201 void
202 zev_znode_close_after_update_cb(znode_t *zp)
203 {
204 	int op = ZEV_OP_ZNODE_CLOSE_AFTER_UPDATE;
205 	zev_znode_close_after_update_t *rec;
206 	zev_msg_t *msg = NULL;
207 	int msg_size;
208 
209 	if (zev_skip_pool(zp->z_zfsvfs->z_os))
210 		return;
211 	if (zev_skip_fs(zp->z_zfsvfs))
212 		return;
213 
214 	msg_size = sizeof(*rec);
215 	msg = zev_alloc(sizeof(*msg) + msg_size);
216 	msg->size = msg_size;
217 	rec = (zev_znode_close_after_update_t *)(msg + 1);
218 	rec->record_len = msg_size;
219 	rec->op = op;
220 	rec->op_time = ddi_get_time();
221 	rec->guid =
222 		dsl_dataset_phys(zp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
223 	ZEV_FILL_INODE_INFO(file, zp);
224 	zev_queue_message(op, msg);
225 }
226 
227 void
228 zev_znode_create_cb(znode_t *dzp,
229                     znode_t *zp,
230                     dmu_tx_t *tx,
231                     char *name,
232                     uint64_t txtype)
233 {
234 	int op = ZEV_OP_ZNODE_CREATE;
235 	zev_znode_create_t *rec;
236 	zev_msg_t *msg = NULL;
237 	int msg_size;
238 	int name_len;
239 
240 	if (zev_skip_pool(zp->z_zfsvfs->z_os))
241 		return;
242 	if (zev_skip_fs(zp->z_zfsvfs))
243 		return;
244 
245 	int type = (int)txtype;
246 	switch(type) {
247 	case TX_CREATE:
248 	case TX_CREATE_ACL:
249 	case TX_CREATE_ATTR:
250 	case TX_CREATE_ACL_ATTR:
251 		op = ZEV_OP_ZNODE_CREATE;
252 		break;
253 	case TX_MKDIR:
254 	case TX_MKDIR_ACL:
255 	case TX_MKDIR_ATTR:
256 	case TX_MKDIR_ACL_ATTR:
257 		op = ZEV_OP_ZNODE_MKDIR;
258 		break;
259 	case TX_MKXATTR:
260 		op = ZEV_OP_ZNODE_MAKE_XATTR_DIR;
261 		break;
262 	default:
263 		zev_queue_error(ZEV_OP_ZNODE_CREATE,
264 		    "ERROR: ZNODE_CREATE: unknown txtype %d "
265 		    "(dir_inode=%d:%d inode=%d:%d name='%s')\n",
266 		    type,
267 		    dzp->z_gen,
268 		    dzp->z_id,
269 		    zp->z_gen,
270 		    zp->z_id,
271 		    name);
272 		return;
273 	}
274 
275 	/* all three types use the same struct, so this works for all types: */
276 	name_len = strlen(name);
277 	msg_size = sizeof(*rec) + name_len + 1;
278 	msg = zev_alloc(sizeof(*msg) + msg_size);
279 	msg->size = msg_size;
280 	rec = (zev_znode_create_t *)(msg + 1);
281 	rec->record_len = msg_size;
282 	rec->op = op;
283 	rec->op_time = ddi_get_time();
284 	rec->guid =
285 		dsl_dataset_phys(zp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
286 	rec->txg = tx->tx_txg;
287 	ZEV_FILL_INODE_INFO(parent, dzp);
288 	ZEV_FILL_INODE_INFO(file, zp);
289 	rec->name_len = name_len;
290 	(void) memcpy(ZEV_NAME(rec), name, name_len + 1);
291 	zev_create_checksum(rec, zp);
292 	zev_queue_message(op, msg);
293 }
294 
295 void
296 zev_znode_remove_cb(znode_t *dzp,
297                     znode_t *zp,
298                     dmu_tx_t *tx,
299                     char *name,
300                     uint64_t txtype)
301 {
302 	int op = ZEV_OP_ZNODE_REMOVE;
303 	zev_znode_remove_t *rec;
304 	zev_msg_t *msg = NULL;
305 	int msg_size;
306 	int name_len;
307 
308 	if (zev_skip_pool(dzp->z_zfsvfs->z_os))
309 		return;
310 	if (zev_skip_fs(dzp->z_zfsvfs))
311 		return;
312 
313 	int type = (int)txtype;
314 	switch(type) {
315 	case TX_REMOVE:
316 		op = ZEV_OP_ZNODE_REMOVE;
317 		break;
318 	case TX_RMDIR:
319 		op = ZEV_OP_ZNODE_RMDIR;
320 		break;
321 	default:
322 		zev_queue_error(ZEV_OP_ZNODE_REMOVE,
323 		    "ERROR: ZNODE_REMOVE: unknown txtype %d "
324 		    "(dir_inode=%d:%d name='%s')\n",
325 		    type,
326 		    dzp->z_gen,
327 		    dzp->z_id,
328 		    name);
329 		return;
330 	}
331 
332 	/* both types use the same struct, so this works for all types: */
333 	name_len = strlen(name);
334 	msg_size = sizeof(*rec) + name_len + 1;
335 	msg = zev_alloc(sizeof(*msg) + msg_size);
336 	msg->size = msg_size;
337 	rec = (zev_znode_remove_t *)(msg + 1);
338 	rec->record_len = msg_size;
339 	rec->op = op;
340 	rec->op_time = ddi_get_time();
341 	rec->guid =
342 		dsl_dataset_phys(dzp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
343 	rec->txg = tx->tx_txg;
344 	ZEV_FILL_INODE_INFO(file, zp);
345 	ZEV_FILL_INODE_INFO(parent, dzp);
346 	rec->name_len = name_len;
347 	(void) memcpy(ZEV_NAME(rec), name, name_len + 1);
348 	zev_queue_message(op, msg);
349 }
350 
351 void
352 zev_znode_link_cb(znode_t *dzp, znode_t *zp, dmu_tx_t *tx, char *name)
353 {
354 	int op = ZEV_OP_ZNODE_LINK;
355 	zev_znode_link_t *rec;
356 	zev_msg_t *msg = NULL;
357 	int msg_size;
358 	int name_len;
359 
360 	if (zev_skip_pool(zp->z_zfsvfs->z_os))
361 		return;
362 	if (zev_skip_fs(zp->z_zfsvfs))
363 		return;
364 
365 	name_len = strlen(name);
366 	msg_size = sizeof(*rec) + name_len + 1;
367 	msg = zev_alloc(sizeof(*msg) + msg_size);
368 	msg->size = msg_size;
369 	rec = (zev_znode_link_t *)(msg + 1);
370 	rec->record_len = msg_size;
371 	rec->op = op;
372 	rec->op_time = ddi_get_time();
373 	rec->guid =
374 		dsl_dataset_phys(zp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
375 	rec->txg = tx->tx_txg;
376 	ZEV_FILL_INODE_INFO(parent, dzp);
377 	ZEV_FILL_INODE_INFO(file, zp);
378 	rec->name_len = name_len;
379 	(void) memcpy(ZEV_NAME(rec), name, name_len + 1);
380 	zev_queue_message(op, msg);
381 }
382 
383 void
384 zev_znode_symlink_cb(znode_t *dzp,
385                      znode_t *zp,
386                      dmu_tx_t *tx,
387                      char *name,
388                      char *link)
389 {
390 	int op = ZEV_OP_ZNODE_SYMLINK;
391 	zev_znode_symlink_t *rec;
392 	zev_msg_t *msg = NULL;
393 	int msg_size;
394 	int name_len;
395 	int link_len;
396 
397 	if (zev_skip_pool(zp->z_zfsvfs->z_os))
398 		return;
399 	if (zev_skip_fs(zp->z_zfsvfs))
400 		return;
401 
402 	name_len = strlen(name);
403 	link_len = strlen(link);
404 	msg_size = sizeof(*rec) + name_len + 1 + link_len + 1;
405 	msg = zev_alloc(sizeof(*msg) + msg_size);
406 	msg->size = msg_size;
407 	rec = (zev_znode_symlink_t *)(msg + 1);
408 	rec->record_len = msg_size;
409 	rec->op = op;
410 	rec->op_time = ddi_get_time();
411 	rec->guid =
412 		dsl_dataset_phys(dzp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
413 	rec->txg = tx->tx_txg;
414 	ZEV_FILL_INODE_INFO(parent, dzp);
415 	ZEV_FILL_INODE_INFO(file, zp);
416 	rec->name_len = name_len;
417 	rec->link_len = link_len;
418 	(void) memcpy(ZEV_NAME(rec), name, name_len + 1);
419 	(void) memcpy(ZEV_LINK(rec), link, link_len + 1);
420 	zev_symlink_checksum(rec, link);
421 	zev_queue_message(op, msg);
422 }
423 
424 void
425 zev_znode_rename_cb(znode_t *sdzp,
426                     char *sname,
427                     znode_t *tdzp,
428                     char *tname,
429                     znode_t *szp,
430                     znode_t *tzp,
431                     dmu_tx_t *tx)
432 {
433 	int op = ZEV_OP_ZNODE_RENAME;
434 	zev_znode_rename_t *rec;
435 	zev_msg_t *msg = NULL;
436 	int msg_size;
437 	int srcname_len;
438 	int dstname_len;
439 
440 	if (zev_skip_pool(szp->z_zfsvfs->z_os))
441 		return;
442 	if (zev_skip_fs(szp->z_zfsvfs))
443 		return;
444 
445 	srcname_len = strlen(sname);
446 	dstname_len = strlen(tname);
447 	msg_size = sizeof(*rec) + srcname_len + 1 + dstname_len + 1;
448 	msg = zev_alloc(sizeof(*msg) + msg_size);
449 	msg->size = msg_size;
450 	rec = (zev_znode_rename_t *)(msg + 1);
451 	rec->record_len = msg_size;
452 	rec->op = op;
453 	rec->op_time = ddi_get_time();
454 	rec->guid =
455 		dsl_dataset_phys(szp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
456 	rec->txg = tx->tx_txg;
457 	ZEV_FILL_INODE_INFO(srcdir, sdzp);
458 	ZEV_FILL_INODE_INFO(dstdir, tdzp);
459 	ZEV_FILL_INODE_INFO(file, szp);
460 	if (tzp) {
461 		ZEV_FILL_INODE_INFO(clobbered_file, tzp);
462 	} else {
463 		memset(&rec->clobbered_file, 0, sizeof(rec->clobbered_file));
464 	}
465 	rec->srcname_len = srcname_len;
466 	rec->dstname_len = dstname_len;
467 	(void) memcpy(ZEV_SRCNAME(rec), sname, srcname_len + 1);
468 	(void) memcpy(ZEV_DSTNAME(rec), tname, dstname_len + 1);
469 	zev_queue_message(op, msg);
470 }
471 
472 void
473 zev_znode_write_cb(znode_t *zp, dmu_tx_t *tx, uint64_t off, uint64_t len)
474 {
475 	int op = ZEV_OP_ZNODE_WRITE;
476 	zev_znode_write_t *rec;
477 	zev_msg_t *msg = NULL;
478 	int msg_size;
479 	zev_sig_t *sig_buf;
480 	uint64_t sig_buf_len;
481 	uint64_t sig_len;
482 	uint64_t sig_cnt;
483 	int ret;
484 
485 	if (zev_skip_pool(zp->z_zfsvfs->z_os))
486 		return;
487 	if (zev_skip_fs(zp->z_zfsvfs))
488 		return;
489 
490 	ret = zev_get_checksums(&sig_buf, &sig_buf_len, &sig_cnt, 0,
491 	                        zp, off, len, zev_write);
492 	if (ret) {
493 		zev_queue_error(op,
494 		    "ERROR: ZNODE_WRITE: can't get checksum (inode=%d:%d)\n",
495 		    zp->z_gen,
496 		    zp->z_id);
497 		return;
498 	}
499 	sig_len = sig_cnt * sizeof(zev_sig_t);
500 
501 	msg_size = sizeof(*rec) + sig_len;
502 	msg = zev_alloc(sizeof(*msg) + msg_size);
503 	msg->size = msg_size;
504 	rec = (zev_znode_write_t *)(msg + 1);
505 	rec->record_len = msg_size;
506 	rec->op = op;
507 	rec->op_time = ddi_get_time();
508 	rec->guid =
509 		dsl_dataset_phys(zp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
510 	rec->txg = tx->tx_txg;
511 	ZEV_FILL_INODE_INFO(file, zp);
512 	rec->offset = off;
513 	rec->length = len;
514 	rec->signature_cnt = sig_cnt;
515 	if (sig_cnt && sig_buf)
516 		memcpy(ZEV_SIGNATURES(rec), sig_buf, sig_len);
517 	if (sig_buf)
518 		zev_free(sig_buf, sig_buf_len);
519 	zev_queue_message(op, msg);
520 }
521 
522 void
523 zev_znode_truncate_cb(znode_t *zp, dmu_tx_t *tx, uint64_t off, uint64_t len)
524 {
525 	int op = ZEV_OP_ZNODE_TRUNCATE;
526 	zev_znode_truncate_t *rec;
527 	zev_msg_t *msg = NULL;
528 	int msg_size;
529 	zev_sig_t *sig_buf;
530 	uint64_t sig_buf_len;
531 	uint64_t sig_len;
532 	uint64_t sig_cnt;
533 	int ret;
534 
535 	if (zev_skip_pool(zp->z_zfsvfs->z_os))
536 		return;
537 	if (zev_skip_fs(zp->z_zfsvfs))
538 		return;
539 
540 	ret = zev_get_checksums(&sig_buf, &sig_buf_len, &sig_cnt, 0,
541 	                        zp, off, len, zev_truncate);
542 	if (ret) {
543 		zev_queue_error(op,
544 		    "ERROR: ZNODE_TRUNCATE: can't get checksum (inode=%d:%d)\n",
545 		    zp->z_gen,
546 		    zp->z_id);
547 		return;
548 	}
549 	sig_len = sig_cnt * sizeof(zev_sig_t);
550 
551 	msg_size = sizeof(*rec) + sig_len;
552 	msg = zev_alloc(sizeof(*msg) + msg_size);
553 	msg->size = msg_size;
554 	rec = (zev_znode_truncate_t *)(msg + 1);
555 	rec->record_len = msg_size;
556 	rec->op = op;
557 	rec->op_time = ddi_get_time();
558 	rec->guid =
559 		dsl_dataset_phys(zp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
560 	rec->txg = tx->tx_txg;
561 	ZEV_FILL_INODE_INFO(file, zp);
562 	rec->offset = off;
563 	rec->length = len;
564 	rec->signature_cnt = sig_cnt;
565 	if (sig_cnt && sig_buf)
566 		memcpy(ZEV_SIGNATURES(rec), sig_buf, sig_len);
567 	if (sig_buf)
568 		zev_free(sig_buf, sig_buf_len);
569 	zev_queue_message(op, msg);
570 }
571 
572 void
573 zev_znode_setattr_cb(znode_t *zp, dmu_tx_t *tx)
574 {
575 	int op = ZEV_OP_ZNODE_SETATTR;
576 	zev_znode_setattr_t *rec;
577 	zev_msg_t *msg = NULL;
578 	int msg_size;
579 
580 	if (zev_skip_pool(zp->z_zfsvfs->z_os))
581 		return;
582 	if (zev_skip_fs(zp->z_zfsvfs))
583 		return;
584 
585 	msg_size = sizeof(*rec);
586 	msg = zev_alloc(sizeof(*msg) + msg_size);
587 	msg->size = msg_size;
588 	rec = (zev_znode_setattr_t *)(msg + 1);
589 	rec->record_len = msg_size;
590 	rec->op = op;
591 	rec->op_time = ddi_get_time();
592 	rec->guid =
593 		dsl_dataset_phys(zp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
594 	rec->txg = tx->tx_txg;
595 	ZEV_FILL_INODE_INFO(file, zp);
596 	zev_queue_message(op, msg);
597 }
598 
599 void
600 zev_znode_acl_cb(znode_t *zp, dmu_tx_t *tx)
601 {
602 	int op = ZEV_OP_ZNODE_ACL;
603 	zev_znode_acl_t *rec;
604 	zev_msg_t *msg = NULL;
605 	int msg_size;
606 
607 	if (zev_skip_pool(zp->z_zfsvfs->z_os))
608 		return;
609 	if (zev_skip_fs(zp->z_zfsvfs))
610 		return;
611 
612 	msg_size = sizeof(*rec);
613 	msg = zev_alloc(sizeof(*msg) + msg_size);
614 	msg->size = msg_size;
615 	rec = (zev_znode_acl_t *)(msg + 1);
616 	rec->record_len = msg_size;
617 	rec->op = op;
618 	rec->op_time = ddi_get_time();
619 	rec->guid =
620 		dsl_dataset_phys(zp->z_zfsvfs->z_os->os_dsl_dataset)->ds_guid;
621 	rec->txg = tx->tx_txg;
622 	ZEV_FILL_INODE_INFO(file, zp);
623 	zev_queue_message(op, msg);
624 }
625 
626 rz_zev_callbacks_t zev_callbacks = {
627 	/* zfsvfs events */
628 	.rz_zev_zfs_mount                = zev_zfs_mount_cb,
629 	.rz_zev_zfs_umount               = zev_zfs_umount_cb,
630 
631 	/* zvol zil events */
632 	.rz_zev_zvol_truncate            = zev_zvol_truncate_cb,
633 	.rz_zev_zvol_write               = zev_zvol_write_cb,
634 
635 	/* znode zil events */
636 	.rz_zev_znode_close_after_update = zev_znode_close_after_update_cb,
637 	.rz_zev_znode_create             = zev_znode_create_cb,
638 	.rz_zev_znode_remove             = zev_znode_remove_cb,
639 	.rz_zev_znode_link               = zev_znode_link_cb,
640 	.rz_zev_znode_symlink            = zev_znode_symlink_cb,
641 	.rz_zev_znode_rename             = zev_znode_rename_cb,
642 	.rz_zev_znode_write              = zev_znode_write_cb,
643 	.rz_zev_znode_truncate           = zev_znode_truncate_cb,
644 	.rz_zev_znode_setattr            = zev_znode_setattr_cb,
645 	.rz_zev_znode_acl                = zev_znode_acl_cb,
646 };
647 
648