[systemd-devel] [PATCH] udevd: fix synchronization with settle when handling inotify events

Daniel Drake drake at endlessm.com
Mon Apr 13 07:49:38 PDT 2015


On Sat, Apr 11, 2015 at 5:13 AM, David Herrmann <dh.herrmann at gmail.com> wrote:
> Nice catch!
>
> There's indeed a small race between handling inotify and queuing up
> the change-event. We need to re-loop there. One day we should switch
> to sd-event to avoid such bugs... I mean the symptom is inherent to
> queuing up events while handling them. Meh!

Thanks for reviewing this. Reading your comment, I wonder if there is
a small bug in the solution here.

Sometimes we may handle inotify events, but without generating change
events. After my change, we will loop again, but there may be no
events pending, in which case we will block on the 3 second timeout
before completing the next loop iteration and replying to settle's
ping message.

Do you agree? Should I improve this to only do the extra loop
iteration in the case where we generated change events, or somehow
make the next loop iteration have timeout 0 (non-blocking)?

Thanks
Daniel


More information about the systemd-devel mailing list