<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Nov 2, 2024 at 5:38 AM Sietse van Zanen <<a href="mailto:sietse@wizdom.nu">sietse@wizdom.nu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-4009200173228424518">
<div lang="NL" style="overflow-wrap: break-word;">
<div class="m_-4009200173228424518WordSection1">
<p class="MsoNormal">I seem to be hitting some very weird corner case causing an assertion failure. The offender is ZFS Event Daemon:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The following code shows the offence:<u></u><u></u></p>
<p class="MsoNormal"> struct udev_device *dev;<u></u><u></u></p>
<p class="MsoNormal"> if ((dev = udev_monitor_receive_device(mon)) == NULL) {<u></u><u></u></p>
<p class="MsoNormal"> zed_log_msg(LOG_WARNING, "zed_udev_monitor: receive "<u></u><u></u></p>
<p class="MsoNormal"> "device error %d", errno);<u></u><u></u></p>
<p class="MsoNormal"> continue;<u></u><u></u></p>
<p class="MsoNormal"> }<u></u><u></u></p>
<p class="MsoNormal"> …..<u></u><u></u></p>
<p class="MsoNormal"> sectors = udev_device_get_property_value(dev,<u></u><u></u></p>
<p class="MsoNormal"> "ID_PART_ENTRY_SIZE");<u></u><u></u></p>
<p class="MsoNormal"> if (sectors == NULL)<u></u><u></u></p>
<p class="MsoNormal"> sectors = udev_device_get_sysattr_value(dev, "size");<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Im at a loss here as to what’s causing the assertion failure. Both udev_device_get_property_value and udev_device_get_sysattr_value only assert a valid udev_device pointer. How can the pointer get lost between these two function calls?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">-Sietse<u></u><u></u></p>
<p class="MsoNormal"><u></u><br></p></div></div></div></blockquote><div><br></div><div> you need to poll before any valid udev_device is returned to you.</div></div></div>