stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: Xiong Zhou <jencce.kernel@gmail.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Ewan D. Milne" <emilne@redhat.com>,
	Hannes Reinecke <hare@suse.de>,
	Christoph Hellwig <hch@infradead.org>,
	linux-scsi@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH v4 1/2] scsi: Add intermediate STARGET_REMOVE state to scsi_target_state
Date: Wed, 13 Apr 2016 10:19:48 +0200	[thread overview]
Message-ID: <1550969.mvAXU2aY35@c203> (raw)
In-Reply-To: <CADJHv_uHL0=ebUio3j5ysnaU9gDus+HQi4=pQznTy0B=6+NWAg@mail.gmail.com>

Hi Xiong
Sorry for the late reply

On Dienstag, 12. April 2016 21:01:53 CEST Xiong Zhou wrote:
> How about this?
> 
> drivers/scsi/scsi_scan: mark STARGET_REMOVE state before destroy
> 
> Signed-off-by: Xiong Zhou <jencce.kernel@gmail.com>
> ---
>  drivers/scsi/scsi_scan.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index 27df7e7..21092e5 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -395,6 +395,8 @@ static void scsi_target_reap_ref_release(struct kref *kref)
>   transport_remove_device(&starget->dev);
>   device_del(&starget->dev);
>   }
> +
> + starget->state = STARGET_REMOVE;
>   scsi_target_destroy(starget);
>  }

The only scsi_target_reap_ref_release() caller is scsi_target_reap_ref_put(), 
which in turn is only called by scsi_target_reap(). scsi_target_reap()'s only 
callers are scsi_remove_target()/__scsi_remove_target(), which set the 
STARGET_REMOVE state and 

__scsi_add_device()
scsi_get_host_dev()
__scsi_scan_target()

Which I'm currently investiganting (in parallel to reproducing the bug).

> 
> @@ -465,6 +467,7 @@ static struct scsi_target
> *scsi_alloc_target(struct device *parent,
>   dev_printk(KERN_ERR, dev, "target allocation failed, error %d\n", error);
>   /* don't want scsi_target_reap to do the final
>   * put because it will be under the host lock */
> + starget->state = STARGET_REMOVE;
>   scsi_target_destroy(starget);
>   return NULL;
>   }

Here starget->state is STARGET_CREATED and the assertion is already aware of 
this state transitoin. IOTW this /shouldn't/ be needed.


-- 
Johannes Thumshirn                                                                                Storage
jthumshirn@suse.de                                                             +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: Felix Imend�rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N�rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850


  reply	other threads:[~2016-04-13  8:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1459848136.git.jthumshirn@suse.de>
2016-04-05  9:50 ` [PATCH v4 1/2] scsi: Add intermediate STARGET_REMOVE state to scsi_target_state Johannes Thumshirn
2016-04-12  5:30   ` Xiong Zhou
2016-04-12 13:01   ` Xiong Zhou
2016-04-13  8:19     ` Johannes Thumshirn [this message]
2016-04-15  3:24       ` Xiong Zhou
2016-04-05  9:50 ` [PATCH v4 2/2] Revert "scsi: fix soft lockup in scsi_remove_target() on module removal" Johannes Thumshirn

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=1550969.mvAXU2aY35@c203 \
    --to=jthumshirn@suse.de \
    --cc=emilne@redhat.com \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=jencce.kernel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).