From baa40d45cbb336765b2f89d934cd9ea690e4f7c9 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 4 Oct 2010 16:21:04 -0700 Subject: Fix missing 'zpool events' It turns out that 'zpool events' over 1024 bytes in size where being silently dropped. This was discovered while writing the zfault.sh tests to validate common failure modes. This could occur because the zfs interface for passing an arbitrary size nvlist_t over an ioctl() is to provide a buffer for the packed nvlist which is usually big enough. In this case 1024 byte is the default. If the kernel determines the buffer is to small it returns ENOMEM and the minimum required size of the nvlist_t. This was working properly but in the case of 'zpool events' the event stream was advanced dispite the error. Thus the retry with the bigger buffer would succeed but it would skip over the previous event. The fix is to pass this size to zfs_zevent_next() and determine before removing the event from the list if it will fit. This was preferable to checking after the event was returned because this avoids the need to rewind the stream. --- include/sys/fm/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/sys/fm/util.h b/include/sys/fm/util.h index 94947d67c..a3a8c3f86 100644 --- a/include/sys/fm/util.h +++ b/include/sys/fm/util.h @@ -96,7 +96,7 @@ extern void zfs_zevent_post(nvlist_t *, nvlist_t *, zevent_cb_t *); extern void zfs_zevent_drain_all(int *); extern int zfs_zevent_fd_hold(int, minor_t *, zfs_zevent_t **); extern void zfs_zevent_fd_rele(int); -extern int zfs_zevent_next(zfs_zevent_t *, nvlist_t **, uint64_t *); +extern int zfs_zevent_next(zfs_zevent_t *, nvlist_t **, uint64_t *, uint64_t *); extern int zfs_zevent_wait(zfs_zevent_t *); extern void zfs_zevent_init(zfs_zevent_t **); extern void zfs_zevent_destroy(zfs_zevent_t *); -- cgit v1.2.3