public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix remaining list_for_each_safe_rcu in -mm
@ 2005-11-01 15:29 Paul E. McKenney
  2005-11-01 16:17 ` [PATCH] fix remaining list_for_each_safe_rcu in -mm (take 2) Paul E. McKenney
  2005-11-05  4:01 ` [PATCH] fix remaining list_for_each_safe_rcu in -mm Corey Minyard
  0 siblings, 2 replies; 3+ messages in thread
From: Paul E. McKenney @ 2005-11-01 15:29 UTC (permalink / raw)
  To: linux-kernel

Hello!

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

Signed-off-by: <paulmck@us.ibm.com>

---

 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
--- linux-2.6.14-rc5-mm1/drivers/char/ipmi/ipmi_msghandler.c	2005-11-01 06:44:09.000000000 -0800
+++ linux-2.6.14-rc5-mm1-safe_rcu/drivers/char/ipmi/ipmi_msghandler.c	2005-11-01 07:00:50.000000000 -0800
@@ -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;

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

* [PATCH] fix remaining list_for_each_safe_rcu in -mm (take 2)
  2005-11-01 15:29 [PATCH] fix remaining list_for_each_safe_rcu in -mm Paul E. McKenney
@ 2005-11-01 16:17 ` Paul E. McKenney
  2005-11-05  4:01 ` [PATCH] fix remaining list_for_each_safe_rcu in -mm Corey Minyard
  1 sibling, 0 replies; 3+ messages in thread
From: Paul E. McKenney @ 2005-11-01 16:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, serue, minyard

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: <paulmck@us.ibm.com>

---

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
--- linux-2.6.14-rc5-mm1/drivers/char/ipmi/ipmi_msghandler.c	2005-11-01 06:44:09.000000000 -0800
+++ linux-2.6.14-rc5-mm1-safe_rcu/drivers/char/ipmi/ipmi_msghandler.c	2005-11-01 08:03:45.000000000 -0800
@@ -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;

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

* Re: [PATCH] fix remaining list_for_each_safe_rcu in -mm
  2005-11-01 15:29 [PATCH] fix remaining list_for_each_safe_rcu in -mm Paul E. McKenney
  2005-11-01 16:17 ` [PATCH] fix remaining list_for_each_safe_rcu in -mm (take 2) Paul E. McKenney
@ 2005-11-05  4:01 ` Corey Minyard
  1 sibling, 0 replies; 3+ messages in thread
From: Corey Minyard @ 2005-11-05  4:01 UTC (permalink / raw)
  To: paulmck; +Cc: linux-kernel

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

Paul E. McKenney wrote:

>Hello!
>
>I missed a use of list_for_each_rcu_safe() in -mm tree.  Here is a patch
>to fix it.
>
>Signed-off-by: <paulmck@us.ibm.com>
>
>---
>
> 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
>--- linux-2.6.14-rc5-mm1/drivers/char/ipmi/ipmi_msghandler.c	2005-11-01 06:44:09.000000000 -0800
>+++ linux-2.6.14-rc5-mm1-safe_rcu/drivers/char/ipmi/ipmi_msghandler.c	2005-11-01 07:00:50.000000000 -0800
>@@ -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;
>  
>


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

end of thread, other threads:[~2005-11-05  4:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-01 15:29 [PATCH] fix remaining list_for_each_safe_rcu in -mm Paul E. McKenney
2005-11-01 16:17 ` [PATCH] fix remaining list_for_each_safe_rcu in -mm (take 2) Paul E. McKenney
2005-11-05  4:01 ` [PATCH] fix remaining list_for_each_safe_rcu in -mm Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox