Re: bad slaves count in eql driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have noticed that the following patch which solve a problem in eql
driver has not been applied in the main tree. It has been sent for the
first time September 9 2004.

The problem it solve is that num_slaves member of slave_queue_t
structure is not correctly decremented each time a slave is removed,
rapidly leading to a situation where you cannot add a slave to the eql
interface while you should.

The file drivers/net/eql.c has not changed for a long so this patch
which originaly was for 2.6.8.1 still apply on 2.6.12.3.

Please consider it for inclusion.

Thank you.

-- 
Loïc

"heaven is not a place, it's a feeling"

proper num_slaves decrement

Signed-off-by: Loic Le Loarer <loic.le-loarer+lk@xxxxxxxxxxxxxxxxx>
---

diff -Nur kernel-source-2.6.8.orig/drivers/net/eql.c kernel-source-2.6.8/drivers/net/eql.c
--- a/drivers/net/eql.c	2004-08-14 07:37:40.000000000 +0200
+++ b/drivers/net/eql.c	2004-09-04 00:23:43.000000000 +0200
@@ -132,7 +132,7 @@
 #define eql_is_slave(dev)	((dev->flags & IFF_SLAVE) == IFF_SLAVE)
 #define eql_is_master(dev)	((dev->flags & IFF_MASTER) == IFF_MASTER)
 
-static void eql_kill_one_slave(slave_t *slave);
+static void eql_kill_one_slave(slave_queue_t *queue, slave_t *slave);
 
 static void eql_timer(unsigned long param)
 {
@@ -149,7 +149,7 @@
 			if (slave->bytes_queued < 0)
 				slave->bytes_queued = 0;
 		} else {
-			eql_kill_one_slave(slave);
+			eql_kill_one_slave(&eql->queue, slave);
 		}
 
 	}
@@ -214,9 +214,10 @@
 	return 0;
 }
 
-static void eql_kill_one_slave(slave_t *slave)
+static void eql_kill_one_slave(slave_queue_t *queue, slave_t *slave)
 {
 	list_del(&slave->list);
+	queue->num_slaves--;
 	slave->dev->flags &= ~IFF_SLAVE;
 	dev_put(slave->dev);
 	kfree(slave);
@@ -232,8 +233,7 @@
 	list_for_each_safe(this, tmp, head) {
 		slave_t *s = list_entry(this, slave_t, list);
 
-		eql_kill_one_slave(s);
-		queue->num_slaves--;
+		eql_kill_one_slave(queue, s);
 	}
 
 	spin_unlock_bh(&queue->lock);
@@ -318,7 +318,7 @@
 			}
 		} else {
 			/* We found a dead slave, kill it. */
-			eql_kill_one_slave(slave);
+			eql_kill_one_slave(queue, slave);
 		}
 	}
 	return best_slave;
@@ -393,7 +393,7 @@
 
 		duplicate_slave = __eql_find_slave_dev(queue, slave->dev);
 		if (duplicate_slave != 0)
-			eql_kill_one_slave(duplicate_slave);
+			eql_kill_one_slave(queue, duplicate_slave);
 
 		list_add(&slave->list, &queue->all_slaves);
 		queue->num_slaves++;
@@ -471,7 +471,7 @@
 							      slave_dev);
 
 			if (slave) {
-				eql_kill_one_slave(slave);
+				eql_kill_one_slave(&eql->queue, slave);
 				ret = 0;
 			}
 		}
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux