The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] scsi: storvsc: Support manual scans for all Hyper-V targets
@ 2026-07-23 15:14 Laurence Oberman
  2026-08-03 12:45 ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Laurence Oberman @ 2026-07-23 15:14 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li
  Cc: James E.J. Bottomley, Martin K. Petersen, Laurence Oberman,
	linux-hyperv, linux-scsi, linux-kernel

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 <loberman@redhat.com>
---
 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 <scsi/scsi_dbg.h>
 #include <scsi/scsi_transport_fc.h>
 #include <scsi/scsi_transport.h>
+#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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: storvsc: Support manual scans for all Hyper-V targets
  2026-07-23 15:14 [PATCH] scsi: storvsc: Support manual scans for all Hyper-V targets Laurence Oberman
@ 2026-08-03 12:45 ` kernel test robot
  2026-08-04 15:37   ` Laurence Oberman
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-08-03 12:45 UTC (permalink / raw)
  To: Laurence Oberman, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Long Li
  Cc: oe-kbuild-all, James E.J. Bottomley, Martin K. Petersen,
	Laurence Oberman, linux-hyperv, linux-scsi, linux-kernel

Hi Laurence,

kernel test robot noticed the following build errors:

[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next linus/master v7.2-rc6 next-20260731]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Laurence-Oberman/scsi-storvsc-Support-manual-scans-for-all-Hyper-V-targets/20260803-141419
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/20260723151458.872265-1-loberman%40redhat.com
patch subject: [PATCH] scsi: storvsc: Support manual scans for all Hyper-V targets
config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20260803/202608032058.OkCwuEDu-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260803/202608032058.OkCwuEDu-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608032058.OkCwuEDu-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "scsi_scan_host_selected" [drivers/scsi/hv_storvsc.ko] undefined!

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: storvsc: Support manual scans for all Hyper-V targets
  2026-08-03 12:45 ` kernel test robot
@ 2026-08-04 15:37   ` Laurence Oberman
  0 siblings, 0 replies; 3+ messages in thread
From: Laurence Oberman @ 2026-08-04 15:37 UTC (permalink / raw)
  To: kernel test robot, K. Y. Srinivasan, Haiyang Zhang, Wei Liu,
	Dexuan Cui, Long Li
  Cc: oe-kbuild-all, James E.J. Bottomley, Martin K. Petersen,
	linux-hyperv, linux-scsi, linux-kernel

On Mon, 2026-08-03 at 20:45 +0800, kernel test robot wrote:
> Hi Laurence,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on jejb-scsi/for-next]
> [also build test ERROR on mkp-scsi/for-next linus/master v7.2-rc6
> next-20260731]
> [If your patch is applied to the wrong git tree, kindly drop us a
> note.
> And when submitting patch, we suggest to use '--base' as documented
> in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:   
> https://github.com/intel-lab-lkp/linux/commits/Laurence-Oberman/scsi-storvsc-Support-manual-scans-for-all-Hyper-V-targets/20260803-141419
> base:  
> https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-
> next
> patch link:   
> https://lore.kernel.org/r/20260723151458.872265-1-loberman%40redhat.com
> patch subject: [PATCH] scsi: storvsc: Support manual scans for all
> Hyper-V targets
> config: i386-allmodconfig
> (https://download.01.org/0day-ci/archive/20260803/202608032058.OkCwuE
> Du-lkp@intel.com/config)
> compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> reproduce (this is a W=1 build):
> (https://download.01.org/0day-ci/archive/20260803/202608032058.OkCwuE
> Du-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new
> version of
> the same patch/commit), kindly add following tags
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes:
> > https://lore.kernel.org/oe-kbuild-all/202608032058.OkCwuEDu-lkp@intel.com/
> 
> All errors (new ones prefixed by >>, old ones prefixed by <<):
> 
> > > ERROR: modpost: "scsi_scan_host_selected"
> > > [drivers/scsi/hv_storvsc.ko] undefined!
> 
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
> 
> 
> Thanks for the report. This build failure was against v1 and was
> fixed in v2 by replacing the unexported scsi_scan_host_selected()
> helper with the exported scsi_scan_target() interface.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-04 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23 15:14 [PATCH] scsi: storvsc: Support manual scans for all Hyper-V targets Laurence Oberman
2026-08-03 12:45 ` kernel test robot
2026-08-04 15:37   ` Laurence Oberman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox