From patchwork Thu Jun 18 09:43:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 6634731 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC91DC0020 for ; Thu, 18 Jun 2015 09:43:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0ADDF2075A for ; Thu, 18 Jun 2015 09:43:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0B8B20808 for ; Thu, 18 Jun 2015 09:43:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753785AbbFRJnz (ORCPT ); Thu, 18 Jun 2015 05:43:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54752 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754194AbbFRJnr (ORCPT ); Thu, 18 Jun 2015 05:43:47 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DF7DFADDC; Thu, 18 Jun 2015 09:43:43 +0000 (UTC) From: Hannes Reinecke To: Nic Bellinger Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, Christoph Hellwig , Ewan Milne , Hannes Reinecke Subject: [PATCH 5/8] tcm_loop: Rescan SCSI target on transport online Date: Thu, 18 Jun 2015 11:43:39 +0200 Message-Id: <1434620622-65391-6-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1434620622-65391-1-git-send-email-hare@suse.de> References: <1434620622-65391-1-git-send-email-hare@suse.de> 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Setting the transport status to 'online' needs to rescan the target, as some devices might have been added while the transport has been offline. Signed-off-by: Hannes Reinecke --- drivers/target/loopback/tcm_loop.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 6c724dd..7db31f3 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -1082,7 +1082,16 @@ static ssize_t tcm_loop_tpg_store_transport_status( struct tcm_loop_tpg, tl_se_tpg); if (!strncmp(page, "online", 6)) { + int status = tl_tpg->tl_transport_status; + tl_tpg->tl_transport_status = TCM_TRANSPORT_ONLINE; + if (status != tl_tpg->tl_transport_status && + tl_tpg->tl_hba->tl_proto_id == SCSI_PROTOCOL_SAS) { + struct sas_rphy *rphy = tl_tpg->sas_rphy; + + scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, + SCAN_WILD_CARD, 0); + } return count; } if (!strncmp(page, "offline", 7)) {