From patchwork Tue Apr 12 13:01:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murphy Zhou X-Patchwork-Id: 8810231 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C73919F54F for ; Tue, 12 Apr 2016 13:01:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE7B020121 for ; Tue, 12 Apr 2016 13:01:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B457E200FE for ; Tue, 12 Apr 2016 13:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756956AbcDLNB4 (ORCPT ); Tue, 12 Apr 2016 09:01:56 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33929 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756407AbcDLNBz (ORCPT ); Tue, 12 Apr 2016 09:01:55 -0400 Received: by mail-wm0-f66.google.com with SMTP id n3so5179493wmn.1; Tue, 12 Apr 2016 06:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=WiJRvTxPOSMi9YrMyGwEx0aB8qq5bB7hzI5ClKru/xE=; b=BKHNzpKxOpNTH2YdLpXmRm1R4wQpN6xQNXvQiqN49XxKSTRIp8jGSo4hPqOA8qbDG0 sF0VifX2Qiz+NyBgTzTP2vTlTtV0SAOh9tuOCRyVs2o0e7ZRvZBeYhVOZdckEZloNXBE /FC80o/yhHJEBjo0dgIvm1LEl3zhW1VobwkYhhwh9NG3eFWyvEP0Y0eycw2TFJA9HEvJ f4RSGtFtb0i4dvaPj7Tia7MnVDT11z//onoVU0wIn7X9yYvbftjLY4k95e5ZOdXPlt5W zHcdckhuhevAG0v62rKpXL99bgnhfipEwVraEp0B6zCibzE+0+iOQGQBHxa9ZOPgLwka cUiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=WiJRvTxPOSMi9YrMyGwEx0aB8qq5bB7hzI5ClKru/xE=; b=i/B/i41eYyzxucb1VNrPOATEYkLxVUuRirMULwH1TOeXIPu9ntGOAQutVRnHPkRTqV WFYV6tW0a9KAHYETEgbiGICVcDuydkQal1zo0XT918LjakaNxWUfaXM5FYlxiP+OHajJ d76ddYMObQZnVevJfC7Of4yvLHwsJQ+BRhsm5qkrVdotGvV9Cvj2uFYwqF4BMKz7484J i+ILTT0Je+hIdQM2jQ/rOA7ugUdnux9rdLAruVZ0mtzUPCylCwajTMpognIUVzcW681a 7VUH8HYViMhT0hE+zETf9abh2CV1nMi/yLIcyaBovI/osv4kvDqArRL7G2B86+gPHgPO LwFA== X-Gm-Message-State: AD7BkJKGWSK3mTwjeQ9AQSL5l17Hbu7yTERa6gLZFKczGnpt3CPzCxBFl4ZmQjFVUyjzYfV0Vqu6TYyp3hVqsw== MIME-Version: 1.0 X-Received: by 10.28.73.70 with SMTP id w67mr25261383wma.28.1460466113107; Tue, 12 Apr 2016 06:01:53 -0700 (PDT) Received: by 10.194.166.72 with HTTP; Tue, 12 Apr 2016 06:01:53 -0700 (PDT) In-Reply-To: <95ae7ee32dca23bb7f3ab432046fb7016b341049.1459848136.git.jthumshirn@suse.de> References: <95ae7ee32dca23bb7f3ab432046fb7016b341049.1459848136.git.jthumshirn@suse.de> Date: Tue, 12 Apr 2016 21:01:53 +0800 Message-ID: Subject: Re: [PATCH v4 1/2] scsi: Add intermediate STARGET_REMOVE state to scsi_target_state From: Xiong Zhou To: Johannes Thumshirn Cc: "Martin K. Petersen" , "James E.J. Bottomley" , "Ewan D. Milne" , Hannes Reinecke , Christoph Hellwig , linux-scsi@vger.kernel.org, "linux-kernel@vger.kernel.org" , stable@vger.kernel.org Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP How about this? drivers/scsi/scsi_scan: mark STARGET_REMOVE state before destroy Signed-off-by: Xiong Zhou --- 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); } @@ -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;