mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Mike Miller (OS Dev)" <mikem@beardog.cca.cpqcorp.net>
Cc: jens.axboe@oracle.com, james.bottomley@hansenpartnership.com,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/1] cciss: use timeout to ensure scan thread exits
Date: Tue, 16 Jun 2009 14:10:07 -0700	[thread overview]
Message-ID: <20090616141007.9b3852e7.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090616204325.GA29502@beardog.cca.cpqcorp.net>

On Tue, 16 Jun 2009 15:43:25 -0500
"Mike Miller (OS Dev)" <mikem@beardog.cca.cpqcorp.net> wrote:

> Patch 1 of 1
> 
> This patch implements wait_for_completion_interruptible_timeout in the
> scan_thread function to ensure it will exit cleanly during rmmod. Calling
> complete in cciss_remove_one caused a race condition. Using the wait with a
> timeout seems to work around that but it does fire the thread. The overhead
> should be minimal.
> 
> Changelog:
> Replace wait_for_completion_interruptible with
> wait_for_completion_interruptible_timeout in scan_thread().
> Use 5 second timeout value to avoid race.
> 
> Signed-off-by: Mike Miller
> 
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index 4d4d5e0..76e7c10 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -3043,7 +3043,7 @@ static int scan_thread(void *data)
>  	h->rescan_wait = &wait;
>  
>  	for (;;) {
> -		rc = wait_for_completion_interruptible(&wait);
> +		rc = wait_for_completion_interruptible_timeout(&wait, 5);
>  		if (kthread_should_stop())
>  			break;
>  		if (!rc)

c'mon Mike, that's a hack.

  reply	other threads:[~2009-06-16 21:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16 20:43 Mike Miller (OS Dev)
2009-06-16 21:10 ` Andrew Morton [this message]
2009-06-16 21:56   ` Mike Miller (OS Dev)

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=20090616141007.9b3852e7.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mikem@beardog.cca.cpqcorp.net \
    /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

all inboxes | Powered by JetHome®