public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Yingchao Zhou <puppylove_0814@yahoo.com.cn>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Redundant up operation in stop_machine.c ?(2.6.12)
Date: Fri, 26 Aug 2005 12:08:22 +1000	[thread overview]
Message-ID: <1125022102.9945.58.camel@localhost.localdomain> (raw)
In-Reply-To: <20050825135937.85228.qmail@web15003.mail.cnb.yahoo.com>

On Thu, 2005-08-25 at 21:59 +0800, Yingchao Zhou wrote:
> In stop_machine function, there are codes:
> 	if (ret < 0) {
> 		stopmachine_set_state(STOPMACHINE_EXIT);
> 		up(&stopmachine_mutex);
> 		return ret;
> 	}
> And in __stop_machine_run ,there are:
> 	if (!IS_ERR(p)) {
> 		kthread_bind(p, cpu);
> 		wake_up_process(p);
> 		wait_for_completion(&smdata.done);
> 	}
> 	up(&stopmachine_mutex);
> 
> Is the first up op is really redundant?

Yes, it seems you have found a bug.  I tested it (inserting a spurious
failure), and indeed, it gets up'ed twice.

Good catch!
Rusty.

Name: Redundant up operation in stop_machine.c
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (authored)

Yingchao Zhou <puppylove_0814@yahoo.com.cn> noticed that we up() in
stop_machine on failure, and also in the caller (unconditionally).

Index: linux-2.6.13-rc7-git1-Misc/kernel/stop_machine.c
===================================================================
--- linux-2.6.13-rc7-git1-Misc.orig/kernel/stop_machine.c	2005-08-26 11:18:00.000000000 +1000
+++ linux-2.6.13-rc7-git1-Misc/kernel/stop_machine.c	2005-08-26 12:05:01.000000000 +1000
@@ -115,7 +115,6 @@
 	/* If some failed, kill them all. */
 	if (ret < 0) {
 		stopmachine_set_state(STOPMACHINE_EXIT);
-		up(&stopmachine_mutex);
 		return ret;
 	}
 

-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman


           reply	other threads:[~2005-08-26  2:08 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20050825135937.85228.qmail@web15003.mail.cnb.yahoo.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1125022102.9945.58.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=puppylove_0814@yahoo.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox