All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Mike Christie <michaelc@cs.wisc.edu>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	Joe Lawrence <jdl1291@gmail.com>, Tejun Heo <tj@kernel.org>,
	Chanho Min <chanho.min@lge.com>,
	David Milburn <dmilburn@redhat.com>,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH v11 6/9] Make scsi_remove_host() wait until error handling finished
Date: Mon, 24 Jun 2013 08:49:09 +0200	[thread overview]
Message-ID: <51C7EBE5.4090503@acm.org> (raw)
In-Reply-To: <51C79DA8.4030006@cs.wisc.edu>

On 06/24/13 03:15, Mike Christie wrote:
> On 6/12/13 7:55 AM, Bart Van Assche wrote:
>> A SCSI LLD may start cleaning up host resources as soon as
>> scsi_remove_host() returns. These host resources may be needed by
>> the LLD in an implementation of one of the eh_* functions. So if
>> one of the eh_* functions is in progress when scsi_remove_host()
>> is invoked, wait until the eh_* function has finished. Also, do
>> not invoke any of the eh_* functions after scsi_remove_host() has
>> started. Remove Scsi_Host.tmf_in_progress because it is now
>> superfluous.
> 
> I think the patch looks ok for drivers that do not implement their own
> eh_strategy_handler, but what about SAS? If you added a scsi_begin_eh in 
> scsi_error_handler before the eh_strategy_handler is called and then add 
> a scsi_end_eh after it is called, I think it would cover them too.

I will start testing the modification below for the patch at the start of
this thread:

--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1950,10 +1950,14 @@ int scsi_error_handler(void *data)
                        continue;
                }
 
-               if (shost->transportt->eh_strategy_handler)
-                       shost->transportt->eh_strategy_handler(shost);
-               else
+               if (shost->transportt->eh_strategy_handler) {
+                       if (scsi_begin_eh(shost) == 0) {
+                               shost->transportt->eh_strategy_handler(shost);
+                               scsi_end_eh(shost);
+                       }
+               } else {
                        scsi_unjam_host(shost);
+               }
 
                /*
                 * Note - if the above fails completely, the action is to take


>> @@ -1894,6 +1962,9 @@ int scsi_error_handler(void *data)
>>       }
>>       __set_current_state(TASK_RUNNING);
>>
>> +    WARN_ONCE(shost->eh_active, "scsi_eh_%d: eh_active = %d\n",
>> +          shost->host_no, shost->eh_active);
>> +
>>       SCSI_LOG_ERROR_RECOVERY(1,
>>           printk("Error handler scsi_eh_%d exiting\n", shost->host_no));
>>       shost->ehandler = NULL;
> 
> What is the warn for? Is there a chance this can happen with some non 
> upstream driver or are you just adding it just in case?

This is code that helped me to test this patch. I can leave it out if
you prefer so.

Bart.


  reply	other threads:[~2013-06-24  6:49 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12 12:48 [PATCH v11 0/9] More device removal fixes Bart Van Assche
2013-06-12 12:49 ` [PATCH v11 1/9] Fix race between starved list and device removal Bart Van Assche
2013-06-24 15:38   ` James Bottomley
2013-06-24 16:16     ` Bart Van Assche
2013-06-24 16:23       ` James Bottomley
2013-06-24 17:24     ` Mike Christie
2013-06-24 17:49       ` James Bottomley
2013-06-12 12:51 ` [PATCH v11 2/9] Remove get_device() / put_device() pair from scsi_request_fn() Bart Van Assche
2013-06-24  1:29   ` Mike Christie
2013-06-24  2:36   ` James Bottomley
2013-06-24  7:13     ` Bart Van Assche
2013-06-24 13:34       ` James Bottomley
2013-06-24 15:43         ` Bart Van Assche
2013-06-12 12:52 ` [PATCH v11 3/9] Avoid calling __scsi_remove_device() twice Bart Van Assche
2013-06-23 21:35   ` Mike Christie
2013-06-24  6:29     ` Bart Van Assche
2013-06-24 17:38   ` James Bottomley
2013-06-25  8:37     ` Bart Van Assche
2013-06-25 13:44       ` James Bottomley
2013-06-25 15:23         ` Bart Van Assche
2013-06-12 12:53 ` [PATCH v11 4/9] Disallow changing the device state via sysfs into "deleted" Bart Van Assche
2013-06-24  1:05   ` Mike Christie
2013-06-24  6:35     ` Bart Van Assche
2013-06-24 17:59   ` James Bottomley
2013-06-25  8:41     ` Bart Van Assche
2013-06-25 13:42       ` James Bottomley
2013-06-12 12:54 ` [PATCH v11 5/9] Avoid saving/restoring interrupt state inside scsi_remove_host() Bart Van Assche
2013-06-24  1:06   ` Mike Christie
2013-06-12 12:55 ` [PATCH v11 6/9] Make scsi_remove_host() wait until error handling finished Bart Van Assche
2013-06-24  1:15   ` Mike Christie
2013-06-24  6:49     ` Bart Van Assche [this message]
2013-06-24 19:19   ` James Bottomley
2013-06-24 20:04     ` Mike Christie
2013-06-24 22:27       ` James Bottomley
2013-06-25  2:26         ` Mike Christie
2013-06-25  2:56           ` Michael Christie
2013-06-25  9:01         ` Bart Van Assche
2013-06-25 13:45           ` James Bottomley
2013-06-25 15:31             ` Bart Van Assche
2013-06-25 16:13               ` Michael Christie
2013-06-25 17:40                 ` James Bottomley
2013-06-25 17:47                   ` Bart Van Assche
2014-01-30 19:46                 ` Bart Van Assche
2014-01-31  5:58                   ` James Bottomley
2014-01-31  7:52                     ` Bart Van Assche
2013-06-25 11:13         ` Bart Van Assche
2013-06-12 12:56 ` PATCH v11 7/9] Avoid that scsi_device_set_state() triggers a race Bart Van Assche
2013-06-12 12:57 ` [PATCH v11 8/9] Save and restore host_scribble during error handling Bart Van Assche
2013-06-24  1:21   ` Mike Christie
2013-06-24  2:08     ` James Bottomley
2013-06-12 12:58 ` [PATCH v11 9/9] Avoid reenabling I/O after the transport became offline Bart Van Assche
  -- strict thread matches above, loose matches on Subject: below --
2013-06-24 10:17 RE:[PATCH v11 6/9] Make scsi_remove_host() wait until error handling finished Jack Wang
2013-06-24 10:53 ` [PATCH " Bart Van Assche

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=51C7EBE5.4090503@acm.org \
    --to=bvanassche@acm.org \
    --cc=chanho.min@lge.com \
    --cc=dmilburn@redhat.com \
    --cc=hare@suse.de \
    --cc=jdl1291@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=tj@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.