Skip to contentSkip to conversation

fix remaining list_for_each_safe_rcu in -mm

PATCH In review Paul E. McKenney 2 participants 3 messages Nov 1, 2005 – Nov 5, 2005 IPMI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix remaining list_for_each_safe_rcu in -mm

Hello!

I missed a use of list_for_each_rcu_safe() in -mm tree. Here is a patch to fix it.

Signed-off-by <[email protected]>

---

 ipmi_msghandler.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +2 -3
diff -urpNa -X dontdiff linux-2.6.14-rc5-mm1/drivers/char/ipmi/ipmi_msghandler.c linux-2.6.14-rc5-mm1-safe_rcu/drivers/char/ipmi/ipmi_msghandler.c
@@ -788,7 +788,7 @@ int ipmi_destroy_user(ipmi_user_t user)
 	int              i;
 	unsigned long    flags;
 	struct cmd_rcvr  *rcvr;
-	struct list_head *entry1, *entry2;
+	struct list_head *entry1;
 	struct cmd_rcvr  *rcvrs = NULL;
 
 	user->valid = 1;
@@ -813,8 +813,7 @@ int ipmi_destroy_user(ipmi_user_t user)
 	 * synchronize_rcu()) then free everything in that list.
 	 */
 	spin_lock_irqsave(&intf->cmd_rcvrs_lock, flags);
-	list_for_each_safe_rcu(entry1, entry2, &intf->cmd_rcvrs) {
-		rcvr = list_entry(entry1, struct cmd_rcvr, link);
+	list_for_each_entry_rcu(entry1, &intf->cmd_rcvrs, link) {
 		if (rcvr->user == user) {
 			list_del_rcu(&rcvr->link);
 			rcvr->next = rcvrs;
#1 lore raw

PATCH 1/1 fix remaining list_for_each_safe_rcu in -mm (take 2)

Hello!

I missed a use of list_for_each_rcu_safe() in -mm tree. Here is an updated patch to fix it. This time tested on a machine that actually uses IPMI... (Thanks to Serge Hallyn for spotting this.)

Signed-off-by <[email protected]>

---

drivers/char/ipmi/ipmi_msghandler.c +1 -3
diff -urpNa -X dontdiff linux-2.6.14-rc5-mm1/drivers/char/ipmi/ipmi_msghandler.c linux-2.6.14-rc5-mm1-safe_rcu/drivers/char/ipmi/ipmi_msghandler.c
@@ -788,7 +788,6 @@ int ipmi_destroy_user(ipmi_user_t user)
 	int              i;
 	unsigned long    flags;
 	struct cmd_rcvr  *rcvr;
-	struct list_head *entry1, *entry2;
 	struct cmd_rcvr  *rcvrs = NULL;
 
 	user->valid = 1;
@@ -813,8 +812,7 @@ int ipmi_destroy_user(ipmi_user_t user)
 	 * synchronize_rcu()) then free everything in that list.
 	 */
 	spin_lock_irqsave(&intf->cmd_rcvrs_lock, flags);
-	list_for_each_safe_rcu(entry1, entry2, &intf->cmd_rcvrs) {
-		rcvr = list_entry(entry1, struct cmd_rcvr, link);
+	list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) {
 		if (rcvr->user == user) {
 			list_del_rcu(&rcvr->link);
 			rcvr->next = rcvrs;
#2 lore raw
In reply to Paul E. McKenney

Sorry for the long delay, I've been travelling and giving presentations :(.

IIRC, the RCU operations are "safe" by nature, so this is fine.

-Corey

Quoted 36 lines · Paul E. McKenney

Hello!

I missed a use of list_for_each_rcu_safe() in -mm tree. Here is a patch to fix it.

Signed-off-by <[email protected]>

---

ipmi_msghandler.c | 5 ++---

1 files changed, 2 insertions(+), 3 deletions(-)

diff -urpNa -X dontdiff linux-2.6.14-rc5-mm1/drivers/char/ipmi/ipmi_msghandler.c linux-2.6.14-rc5-mm1-safe_rcu/drivers/char/ipmi/ipmi_msghandler.c

drivers/char/ipmi/ipmi_msghandler.c +2 -3
@@ -788,7 +788,7 @@ int ipmi_destroy_user(ipmi_user_t user)
 	int              i;
 	unsigned long    flags;
 	struct cmd_rcvr  *rcvr;
-	struct list_head *entry1, *entry2;
+	struct list_head *entry1;
 	struct cmd_rcvr  *rcvrs = NULL;
 
 	user->valid = 1;
@@ -813,8 +813,7 @@ int ipmi_destroy_user(ipmi_user_t user)
 	 * synchronize_rcu()) then free everything in that list.
 	 */
 	spin_lock_irqsave(&intf->cmd_rcvrs_lock, flags);
-	list_for_each_safe_rcu(entry1, entry2, &intf->cmd_rcvrs) {
-		rcvr = list_entry(entry1, struct cmd_rcvr, link);
+	list_for_each_entry_rcu(entry1, &intf->cmd_rcvrs, link) {
 		if (rcvr->user == user) {
 			list_del_rcu(&rcvr->link);
 			rcvr->next = rcvrs;