public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
To: James.Smart-iH1Dq9VlAzfQT0dZR+AlfA@public.gmane.org
Cc: devel-s9riP+hp16TNLxjTenLetw@public.gmane.org,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/1] libfc: fix queue command rport checks
Date: Wed, 16 Jul 2008 15:55:25 -0500	[thread overview]
Message-ID: <487E603D.1040202@cs.wisc.edu> (raw)
In-Reply-To: <487E5ED6.9040302-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>

Mike Christie wrote:
> James.Smart-iH1Dq9VlAzfQT0dZR+AlfA@public.gmane.org wrote:
>>  
>>
>>> -----Original Message-----
>>> From: Mike Christie [mailto:michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org] 
>>>
>>>> So during a clean shutdown are drivers supposed to remove 
>>> the targets by 
>>>> calling scsi_remove_target to remove the devices, then 
>>> remove the rports 
>>>> through the class?
>>> Or for the case where we are stopping a host (rmmod or single 
>>> host stop 
>>> like with fcoe), should drivers call
>> Yes - the steps below is what the drivers do today.  And this does all
>> work without failing the cache sync (unless something's changed recently
>> in the midlayer above us).
> 
> You mean if I do rmmod lpfc it should work today? I do not think it 
> works anymore because in fc_remove_host we do this:
> 
> fc_remove_host()
> 
>          /* Remove any remote ports */
>          list_for_each_entry_safe(rport, next_rport,
>                          &fc_host->rports, peers) {
>                  list_del(&rport->peers);
>                  rport->port_state = FC_PORTSTATE_DELETED;
>                  fc_queue_work(shost, &rport->rport_delete_work);
>          }
> 
> 
> We set the rport->port_state to deleted before removing the target, so 
> when the cache sync is sent later as a result of fc_rport_final_delete 
> calling scsi_remove_target, the fc_remote_port_chkready checks in lpfc 
> or qla2xxx or mpt's queeucommand will fail the command with 
> DID_NO_CONNECT (fc_remote_port_chkready will
>

oops that got cut off. I mean to write fc_remote_port_chkready will do this:

fc_remote_port_chkready(struct fc_rport *rport)
{
         int result;

         switch (rport->port_state) {
         case FC_PORTSTATE_ONLINE:
                 if (rport->roles & FC_PORT_ROLE_FCP_TARGET)
                         result = 0;
                 else if (rport->flags & FC_RPORT_DEVLOSS_PENDING)
                         result = DID_IMM_RETRY << 16;
                 else
                         result = DID_NO_CONNECT << 16;
                 break;
         case FC_PORTSTATE_BLOCKED:
                 result = DID_IMM_RETRY << 16;
                 break;
         default:
                 result = DID_NO_CONNECT << 16;
                 break;


So because port_state == FC_PORTSTATE_DELETED we reutrn DID_NO_CONNECT 
on any IO like the cache sync that gets sent.

      parent reply	other threads:[~2008-07-16 20:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 18:50 [PATCH 1/1] libfc: fix queue command rport checks michaelc-hcNo3dDEHLuVc3sceRu5cw
     [not found] ` <1216234249-10812-1-git-send-email-michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2008-07-16 18:56   ` Mike Christie
2008-07-16 19:08     ` James.Smart
     [not found]       ` <D1D4C3FF75F9354393DB8314DF43DEF2E7F01C-0GoafHKvaWWVoqRKY1PiFtBPR1lH4CV8@public.gmane.org>
2008-07-16 19:36         ` Mike Christie
2008-07-16 19:45           ` [Open-FCoE] " Mike Christie
2008-07-16 19:51             ` Mike Christie
2008-07-16 21:11               ` James.Smart-iH1Dq9VlAzfQT0dZR+AlfA
2008-07-16 21:22                 ` [Open-FCoE] " Mike Christie
2008-07-17 13:43                   ` James.Smart-iH1Dq9VlAzfQT0dZR+AlfA
2008-07-16 20:07             ` James.Smart-iH1Dq9VlAzfQT0dZR+AlfA
2008-07-16 20:49               ` [Open-FCoE] " Mike Christie
     [not found]                 ` <487E5ED6.9040302-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2008-07-16 20:55                   ` Mike Christie [this message]

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=487E603D.1040202@cs.wisc.edu \
    --to=michaelc-hcno3ddehluvc3sceru5cw@public.gmane.org \
    --cc=James.Smart-iH1Dq9VlAzfQT0dZR+AlfA@public.gmane.org \
    --cc=devel-s9riP+hp16TNLxjTenLetw@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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