linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] udev: fix problem due to unsorted events
@ 2012-03-06  8:48 Andrey Vagin
  2012-03-06 11:06 ` Kay Sievers
  2012-03-06 12:43 ` Kay Sievers
  0 siblings, 2 replies; 14+ messages in thread
From: Andrey Vagin @ 2012-03-06  8:48 UTC (permalink / raw)
  To: linux-hotplug

From: Andrey Vagin <avagin@openvz.org>

A kernel gives events, but this events can be unsorted.
For example, here is log from system:
udevd[77]: seq 924 queued, 'add' 'bdi'
udevd[77]: seq 926 queued, 'add' 'block'
udevd[77]: seq 927 queued, 'add' 'block'
udevd[77]: seq 928 queued, 'add' 'block
udevd[77]: seq 925 queued, 'add' 'drivers'

In this case "udevadm settle" returns an error:
queue is empty but kernel events still pending [928]<->[925]

Let's look at update_queue(). It contains the follow code:

/* now write to the queue */
if (state = DEVICE_QUEUED) {
        udev_queue_export->queued_count++;
        udev_queue_export->seqnum_min = seqnum;
}

where seqnum_min is latest sequence number in queue file. Probably we
should check that seqnum is not less than seqnum_min and update it only
in this case.

https://bugzilla.redhat.com/show_bug.cgi?idy9834

Signed-off-by: Andrey Vagin <avagin@gmail.com>
---
 src/libudev-queue-private.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/libudev-queue-private.c b/src/libudev-queue-private.c
index 7177195..6a689c4 100644
--- a/src/libudev-queue-private.c
+++ b/src/libudev-queue-private.c
@@ -376,7 +376,8 @@ static int update_queue(struct udev_queue_export *udev_queue_export,
         /* now write to the queue */
         if (state = DEVICE_QUEUED) {
                 udev_queue_export->queued_count++;
-                udev_queue_export->seqnum_min = seqnum;
+                if (udev_queue_export->seqnum_min < seqnum)
+                        udev_queue_export->seqnum_min = seqnum;
         } else {
                 udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0);
                 udev_queue_export->queued_count--;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-03-07 17:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-06  8:48 [PATCH] udev: fix problem due to unsorted events Andrey Vagin
2012-03-06 11:06 ` Kay Sievers
2012-03-06 12:43 ` Kay Sievers
2012-03-06 20:06   ` [PATCH] uevent: send events in correct order according to seqnum Andrew Vagin
2012-03-06 21:03     ` Kay Sievers
2012-03-06 21:14       ` avagin
2012-03-07  5:52         ` Greg Kroah-Hartman
2012-03-07  9:59     ` [PATCH] uevent: send events in correct order according to seqnum (v2) Andrew Vagin
2012-03-07 10:18       ` Kay Sievers
2012-03-07 10:49     ` [PATCH] uevent: send events in correct order according to seqnum (v3) Andrew Vagin
2012-03-07 11:03       ` Kay Sievers
2012-03-07 15:45       ` Greg Kroah-Hartman
2012-03-07 17:34         ` Andrew Wagin
2012-03-07 17:47           ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).