Skip to contentSkip to conversation

Revert [NET_SCHED]: HTB: fix incorrect use of RB_EMPTY_NODE

PATCH In review Ismail Donmez 6 participants 16 messages Sep 30, 2006 – Oct 3, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert [NET_SCHED]: HTB: fix incorrect use of RB_EMPTY_NODE

Hi,

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected. Hence Herbert's fix for sched_htb.c should be reverted.

[1]
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=10fd48f2376db52f08bf0420d2c4f580e39269e1;hp=9817064b68fef7e4580c6df1ea597e106b9ff88b

Regards,
ismail

Signature · 3 lines
They that can give up essential liberty to obtain a little temporary safety 
deserve neither liberty nor safety.
-- Benjamin Franklin
net/sched/sch_htb.c +1 -1
index 6c058e3..1f1360e 100644
@@ -391,7 +391,7 @@ static inline void htb_add_class_to_row(
 /* If this triggers, it is a bug in this code, but it need not be fatal */
 static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root)
 {
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {
 		WARN_ON(1);
 	} else {
 		rb_erase(rb, root);
#1 lore raw
Quoted 4 lines · you

Hi,

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected.

                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

make it : so it returns true when the node is empty as expected

/ismail

Signature · 3 lines
They that can give up essential liberty to obtain a little temporary safety 
deserve neither liberty nor safety.
-- Benjamin Franklin
#2 lore raw
In reply to Ismail Donmez
Quoted 4 lines · Ismail Donmez

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected. Hence Herbert's fix for sched_htb.c should be reverted.

I've fixed sched_htb.c? That's news to me :)

I fully agree with your patch though.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#3 lore raw
Quoted 8 lines · Herbert Xu
Quoted 3 lines · Ismail Donmez

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected. Hence Herbert's fix for sched_htb.c should be reverted.

I've fixed sched_htb.c? That's news to me :)

I fully agree with your patch though.

Oh it was Patrick McHardy <[email protected]>, sorry. Patch again with a Signed-off line too this time.

Hi,

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected. Hence Patrick McHardy's fix for sched_htb.c should be reverted.

[1]
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=10fd48f2376db52f08bf0420d2c4f580e39269e1;hp=9817064b68fef7e4580c6df1ea597e106b9ff88b

Regards,
ismail

net/sched/sch_htb.c +1 -1
index 6c058e3..1f1360e 100644
@@ -391,7 +391,7 @@ static inline void htb_add_class_to_row(
 /* If this triggers, it is a bug in this code, but it need not be fatal */
 static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root)
 {
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {
 		WARN_ON(1);
 	} else {
 		rb_erase(rb, root);
#4 lore raw

PATCH 1/1 Revert [NET_SCHED]: HTB: fix incorrect use of RB_EMPTY_NODE

This time with correct description too, *sigh*

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns true when the node is empty as expected. Hence Patrick McHardy's fix for sched_htb.c should be reverted.

[1]
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=10fd48f2376db52f08bf0420d2c4f580e39269e1;hp=9817064b68fef7e4580c6df1ea597e106b9ff88b

net/sched/sch_htb.c +1 -1
index 6c058e3..1f1360e 100644
@@ -391,7 +391,7 @@ static inline void htb_add_class_to_row(
 /* If this triggers, it is a bug in this code, but it need not be fatal */
 static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root)
 {
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {
 		WARN_ON(1);
 	} else {
 		rb_erase(rb, root);
#5 lore raw
In reply to Ismail Donmez
Quoted 4 lines · Ismail Donmez

Hi,

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected.

...

net/sched/sch_htb.c static inline void htb_add_class_to_row( · line 394

Quoted 2 lines
net/sched/sch_htb.c +1 -1
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {

Maybe you have some kind of agreement with Jens Axboe but I can't understand current way of kernel cooperation:
he changes some global behavior to the opposite and fixes his code in three places but can't fix it in the fourth place where it's used? Isn't it both trivial and automatic kind of patch?

Second question is this title alarming enough?:
"[PATCH] rbtree: fixed reversed RB_EMPTY_NODE and rb_next/prev"

Maybe:
[PATCH] rbtree: reversed RB_EMPTY_NODE and fixed rb_next/prev

but shouldn't there be some special [XYZ!] keyword used for such severe situations?

Jarek P.

#6 lore raw
Quoted 5 lines · Jarek Poplawski
Quoted 4 lines · Ismail Donmez

Hi,

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected.

Quoted 8 lines

...

net/sched/sch_htb.c static inline void htb_add_class_to_row( · line 394

Quoted 2 lines
net/sched/sch_htb.c +1 -1
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {

Maybe you have some kind of agreement with Jens Axboe but I can't understand current way of kernel cooperation:
he changes some global behavior to the opposite and fixes his code in three places but can't fix it in the fourth place

...

But I see it's not so bad and net_sched isn't the last! It looks deadline-iosched.c and one place in as-iosched.c (~ 466 line) where probably also forgotten.

Another question - is there any change planned?
If not why in rbtree.c is:

+ if (rb_parent(node) == node)

instead of:

+ if (RB_EMPTY_NODE(rb))

Jarek P.

#7 lore raw

On Mon, Oct 02, 2006 at 01:15:55PM +0200, Jarek Poplawski wrote:
...

Quoted 3 lines

instead of:

+ if (RB_EMPTY_NODE(rb))

should be:

+ if (RB_EMPTY_NODE(node))

Jarek P.

#8 lore raw
In reply to Jarek Poplawski
Quoted 14 lines · Jarek Poplawski
Quoted 5 lines · Jarek Poplawski
Quoted 4 lines · Ismail Donmez

Hi,

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected.

Quoted 8 lines

...

net/sched/sch_htb.c static inline void htb_add_class_to_row( · line 394

Quoted 2 lines
net/sched/sch_htb.c +1 -1
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {

Maybe you have some kind of agreement with Jens Axboe but I can't understand current way of kernel cooperation:
he changes some global behavior to the opposite and fixes his code in three places but can't fix it in the fourth place

Quoted 5 lines

...

But I see it's not so bad and net_sched isn't the last! It looks deadline-iosched.c and one place in as-iosched.c (~ 466 line) where probably also forgotten.

I don't see any missed changes.

Quoted 8 lines

Another question - is there any change planned?
If not why in rbtree.c is:

+ if (rb_parent(node) == node)

instead of:

+ if (RB_EMPTY_NODE(rb))

RB_EMPTY_NODE was (re)-introduced after that change, and it never propagated. Changing it now would be fine and easier to read.

Signature · 1 line
Jens Axboe
#9 lore raw

On Tue, Oct 03, 2006 at 12:28:32PM +0200, Jens Axboe wrote:
...

Quoted 1 line

I don't see any missed changes.

And you are right!
I've checked the link from the first message of this thread and now I see it's not current enough.
I'm sorry for this false alarm.

Jarek P.

#10 lore raw

PATCH 1/1 Revert [NET_SCHED]: HTB: fix incorrect use of RB_EMPTY_NODE

In reply to Jens Axboe

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns true when the node is empty as expected. Hence Patrick McHardy's fix for sched_htb.c should be reverted.

net/sched/sch_htb.c +1 -1
index 6c058e3..1f1360e 100644
@@ -391,7 +391,7 @@ static inline void htb_add_class_to_row(
 /* If this triggers, it is a bug in this code, but it need not be fatal */
 static void htb_safe_rb_erase(struct rb_node *rb, struct rb_root *root)
 {
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {
 		WARN_ON(1);
 	} else {
 		rb_erase(rb, root);
maintainer Applied
#12 lore raw

From: Patrick McHardy <[email protected]>
Date: Tue, 03 Oct 2006 20:05:33 +0200

Quoted 8 lines
Quoted 5 lines · Ismail Donmez

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns true when the node is empty as expected. Hence Patrick McHardy's fix for sched_htb.c should be reverted.

Applied, thanks everyone.

#13 lore raw
In reply to Jarek Poplawski

02 Eki 2006 Pts 13:24 tarihinde, Jarek Poplawski şunları yazmıştı:

Quoted 8 lines · Ismail Donmez
Quoted 4 lines

Hi,

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected.

...

Quoted 9 lines

net/sched/sch_htb.c static inline void htb_add_class_to_row( · line 394

Quoted 2 lines
net/sched/sch_htb.c +1 -1
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {

Maybe you have some kind of agreement with Jens Axboe but I can't understand current way of kernel cooperation:
he changes some global behavior to the opposite and fixes his code in three places but can't fix it in the fourth place where it's used? Isn't it both trivial and automatic kind of patch?

I don't know if Jens will going to fix other occurrences but the sch_htb.c fix was recent and Jens' commit got my attention hence the patch.

Regards,
ismail

#14 lore raw
Quoted 19 lines · Ismail Donmez

02 Eki 2006 Pts 13:24 tarihinde, Jarek Poplawski şunlar?? yazm??şt??:

Quoted 8 lines · Ismail Donmez
Quoted 4 lines

Hi,

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected.

...

Quoted 9 lines

net/sched/sch_htb.c static inline void htb_add_class_to_row( · line 394

Quoted 2 lines
net/sched/sch_htb.c +1 -1
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {

Maybe you have some kind of agreement with Jens Axboe but I can't understand current way of kernel cooperation:
he changes some global behavior to the opposite and fixes his code in three places but can't fix it in the fourth place where it's used? Isn't it both trivial and automatic kind of patch?

Quoted 2 lines

I don't know if Jens will going to fix other occurrences but the sch_htb.c fix was recent and Jens' commit got my attention hence the patch.

As a matter of fact this kind of cooperation has also many pluses:
developers have to be more vigilant, read about other's work, more people are engaged and last but not least there is this infallible akpm reminding subsystem...

Best regards,

Jarek P.

#15 lore raw
In reply to Ismail Donmez
Quoted 19 lines · Ismail Donmez

02 Eki 2006 Pts 13:24 tarihinde, Jarek Poplawski ??unlar?? yazm????t??:

Quoted 8 lines · Ismail Donmez
Quoted 4 lines

Hi,

With commit 10fd48f2376db52f08bf0420d2c4f580e39269e1 [1] , RB_EMPTY_NODE changed behaviour so it returns false when the node is empty as expected.

...

Quoted 9 lines

net/sched/sch_htb.c static inline void htb_add_class_to_row( · line 394

Quoted 2 lines
net/sched/sch_htb.c +1 -1
-	if (!RB_EMPTY_NODE(rb)) {
+	if (RB_EMPTY_NODE(rb)) {

Maybe you have some kind of agreement with Jens Axboe but I can't understand current way of kernel cooperation:
he changes some global behavior to the opposite and fixes his code in three places but can't fix it in the fourth place where it's used? Isn't it both trivial and automatic kind of patch?

Quoted 3 lines

I don't know if Jens will going to fix other occurrences but the sch_htb.c fix was recent and Jens' commit got my attention hence the patch.

Send me a patch and I'll review / integrate it. Most of the rbtree mixups stem from the fact that the first color change was incomplete.

Signature · 1 line
Jens Axboe