Andrey Vagin
2012-03-06 08:48:01 UTC
From: Andrey Vagin <***@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?id=799834
Signed-off-by: Andrey Vagin <***@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--;
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?id=799834
Signed-off-by: Andrey Vagin <***@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
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html