Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: Christoph Hellwig <hch@lst.de>
Cc: jejb@steeleye.com, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1/2] fix EH thread teardown
Date: Wed, 7 Sep 2005 16:01:26 +0200	[thread overview]
Message-ID: <200509071601.38164@bilbo.math.uni-mannheim.de> (raw)
In-Reply-To: <20050907135105.GA16340@lst.de>

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

Christoph Hellwig wrote:
>As Rolf Eike Beer noted we might not actually get to the
>kthread_should_stop() because we are waiting in the semaphore forever.
>I didn't get a rmmod hang because of this, but my instrumentation showed
>the thread defitiyly didn't exit.
>
>So make sure to wake the EH thread before the kthread_stop, and to plug
>the reaming race check kthead_should_stop() a second time just before
>calling down_interruptible().
>
>
>Index: scsi-misc-2.6/drivers/scsi/hosts.c
>===================================================================
>--- scsi-misc-2.6.orig/drivers/scsi/hosts.c	2005-09-07 14:21:44.000000000
> +0200 +++ scsi-misc-2.6/drivers/scsi/hosts.c	2005-09-07 14:22:33.000000000
> +0200 @@ -226,8 +226,10 @@
> 	struct Scsi_Host *shost = dev_to_shost(dev);
> 	struct device *parent = dev->parent;
>
>-	if (shost->ehandler)
>+	if (shost->ehandler) {
>+		up(shost->eh_wait);
> 		kthread_stop(shost->ehandler);
>+	}
> 	if (shost->work_q)
> 		destroy_workqueue(shost->work_q);

Wouldn't this hang the same way if rescheduling happens between the up() and 
the kthread_stop()?

Eike

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-09-07 14:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-07 13:51 [PATCH 1/2] fix EH thread teardown Christoph Hellwig
2005-09-07 14:01 ` Rolf Eike Beer [this message]
2005-09-08 15:26 ` Rolf Eike Beer
  -- strict thread matches above, loose matches on Subject: below --
2005-09-13 16:50 Alan Stern
2005-09-13 17:01 ` Rolf Eike Beer
2005-09-13 19:03   ` Alan Stern
2005-09-13 19:05     ` Christoph Hellwig
2005-09-13 20:57       ` Alan Stern
2005-09-14 16:24       ` Alan Stern

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=200509071601.38164@bilbo.math.uni-mannheim.de \
    --to=eike-kernel@sf-tec.de \
    --cc=hch@lst.de \
    --cc=jejb@steeleye.com \
    --cc=linux-scsi@vger.kernel.org \
    /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