From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7172947CA7D for ; Thu, 23 Jul 2026 15:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784819714; cv=none; b=GguYIieoqW4meVFhyqm03vosluPlCZ3znMGCrF25WnDh/nu62GKiAqkqOg5Lvg3rBJQk4201TC+BcOAFMNX/NLDuVIK/BrL+P9+qLtVS26op6ShOleoyFJG7QaLWS9t87LfRZX4dX28mGQxcjZYG887jY+rY3C2A+Vd3p6t/zuk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784819714; c=relaxed/simple; bh=7mkgfJMIvnWDuxf9XOpiSukx4PvaH2PUWQhve/o8iKM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JKOxCY/F0wy6j8AMnXFGRRYpVRyQykin2qhFZAsEPGJ+cD6RkNJReOIrp2GGcSFcjsXyruOK+lKbVOR+GlMNG1AdeZn6JsfKhWFfrZdxHkilRAwEUEmpZ9kfuyT2pIHum7WCEkoSWriJJkSMxkveehlFVyi5q7t1vMid19P+rIU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=h98V7VVz; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="h98V7VVz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784819712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=KVppPbl3dmlDGLPvTVATpK1M0Teh8q3hfsk+acDK8cg=; b=h98V7VVz7sx+YQ4NsukH3UNQcCMaEW4xyUsEYGyfJjQqhYXLtnnrhmlnXiAX2b5DCGZb4R lRa0V5fee/VNrmu5Z43jG/u1ncydCnUaqsuLj6qcAW6XcdjBL4R2VJ8g+sBXwWGFYvyq0M RqLeNQIUsIDUsLAWbenWqwWGzRUTRZE= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-D1DEHV3KMHqHnEVtDvWddQ-1; Thu, 23 Jul 2026 11:15:10 -0400 X-MC-Unique: D1DEHV3KMHqHnEVtDvWddQ-1 X-Mimecast-MFC-AGG-ID: D1DEHV3KMHqHnEVtDvWddQ_1784819708 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D5951805F22; Thu, 23 Jul 2026 15:15:08 +0000 (UTC) Received: from loberman-thinkpadp16gen3.rmtusma.csb (unknown [10.22.65.166]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 31F671800264; Thu, 23 Jul 2026 15:15:06 +0000 (UTC) From: Laurence Oberman To: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li Cc: "James E.J. Bottomley" , "Martin K. Petersen" , Laurence Oberman , linux-hyperv@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: storvsc: Support manual scans for all Hyper-V targets Date: Thu, 23 Jul 2026 11:14:58 -0400 Message-ID: <20260723151458.872265-1-loberman@redhat.com> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 The Fibre Channel transport topology created by storvsc exposes only one dummy remote port per SCSI host. Its scsi_target_id is always zero. As a result, the FC transport user-scan path performs its remote-port lookup using target ID 0 and cannot initiate a scan for Target 1 or higher. No SCSI command is therefore sent to Hyper-V when userspace explicitly requests a scan of one of these targets. storvsc itself supports up to STORVSC_FC_MAX_TARGETS and already passes scmnd->device->id to Hyper-V as vm_srb->target_id. Devices on Target 1 and higher work when initially discovered and can be rediscovered by a full host scan, such as the scan triggered after an FC port bounce. Provide a storvsc-specific user_scan callback that directly invokes scsi_scan_host_selected(). This bypasses the single-rport lookup in fc_user_scan() and allows userspace to explicitly scan any target supported by storvsc. This avoids requiring storvsc to create and manage one synthetic fc_rport for every Hyper-V target. Signed-off-by: Laurence Oberman --- drivers/scsi/storvsc_drv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 571ea549152b..80830aa12532 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -33,6 +33,7 @@ #include #include #include +#include "scsi_priv.h" /* * All wire protocol details (storage protocol between the guest and the host) @@ -520,6 +521,17 @@ static void storvsc_host_scan(struct work_struct *work) scsi_scan_host(host); } +#if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) +static int storvsc_user_scan(struct Scsi_Host *host, + unsigned int channel, + unsigned int id, + u64 lun) +{ + return scsi_scan_host_selected(host, channel, id, lun, + SCSI_SCAN_MANUAL); +} +#endif + static void storvsc_remove_lun(struct work_struct *work) { struct storvsc_scan_work *wrk; @@ -2232,6 +2244,8 @@ static int __init storvsc_drv_init(void) fc_transport_template = fc_attach_transport(&fc_transport_functions); if (!fc_transport_template) return -ENODEV; + + fc_transport_template->user_scan = storvsc_user_scan; #endif ret = vmbus_driver_register(&storvsc_drv); -- 2.55.0