public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Brian Bunker <brian@purestorage.com>, linux-scsi@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev,
	Brian Bunker <brian@purestorage.com>,
	Krishna Kant <krishna.kant@purestorage.com>
Subject: Re: [PATCH] scsi: core: add re-probe logic into SCSI rescan
Date: Fri, 14 Nov 2025 17:48:10 +0800	[thread overview]
Message-ID: <202511141703.pqiMI34x-lkp@intel.com> (raw)
In-Reply-To: <20251113201819.76650-1-brian@purestorage.com>

Hi Brian,

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 v6.18-rc5 next-20251114]
[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/Brian-Bunker/scsi-core-add-re-probe-logic-into-SCSI-rescan/20251114-042028
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/20251113201819.76650-1-brian%40purestorage.com
patch subject: [PATCH] scsi: core: add re-probe logic into SCSI rescan
config: nios2-randconfig-r071-20251114 (https://download.01.org/0day-ci/archive/20251114/202511141703.pqiMI34x-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251114/202511141703.pqiMI34x-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/202511141703.pqiMI34x-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/scsi/scsi.c: In function 'scsi_update_inquiry_data':
>> drivers/scsi/scsi.c:600:35: error: 'BLIST_ISROM' undeclared (first use in this function)
     600 |         if (!(sdev->sdev_bflags & BLIST_ISROM)) {
         |                                   ^~~~~~~~~~~
   drivers/scsi/scsi.c:600:35: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/scsi/scsi.c:618:41: error: 'BLIST_NOT_LOCKABLE' undeclared (first use in this function)
     618 |                 if (sdev->sdev_bflags & BLIST_NOT_LOCKABLE)
         |                                         ^~~~~~~~~~~~~~~~~~
>> drivers/scsi/scsi.c:634:57: error: 'BLIST_NOTQ' undeclared (first use in this function)
     634 |                                   !(sdev->sdev_bflags & BLIST_NOTQ)) ? 1 : 0;
         |                                                         ^~~~~~~~~~


vim +/BLIST_ISROM +600 drivers/scsi/scsi.c

   546	
   547	/**
   548	 * scsi_update_inquiry_data - Update standard INQUIRY data for a SCSI device
   549	 * @sdev: The device to update
   550	 * @inq_result: Buffer containing new INQUIRY data
   551	 * @inq_len: Length of inquiry data
   552	 *
   553	 * Updates the standard INQUIRY data (vendor, model, rev, peripheral qualifier,
   554	 * device type, removable media flag) and capability flags derived from INQUIRY
   555	 * data for an existing SCSI device. This is used when reprobing a device to get
   556	 * fresh INQUIRY information. The old inquiry buffer is freed and replaced with
   557	 * the new data under the protection of inquiry_mutex.
   558	 *
   559	 * Blacklist flags (BLIST_ISROM, BLIST_NOT_LOCKABLE, BLIST_NOTQ) are respected
   560	 * when updating device properties.
   561	 *
   562	 * Returns:
   563	 *   0 on success
   564	 *   1 if device type or peripheral qualifier changed (caller should call device_reprobe())
   565	 *  -ENOMEM on allocation failure
   566	 */
   567	int scsi_update_inquiry_data(struct scsi_device *sdev,
   568				      unsigned char *inq_result, size_t inq_len)
   569	{
   570		unsigned char *new_inquiry;
   571		unsigned char old_type;
   572		unsigned char old_periph_qual;
   573	
   574		/* Allocate new inquiry buffer */
   575		new_inquiry = kmemdup(inq_result, max_t(size_t, inq_len, 36),
   576				      GFP_KERNEL);
   577		if (!new_inquiry)
   578			return -ENOMEM;
   579	
   580		/* Update inquiry data under mutex protection */
   581		mutex_lock(&sdev->inquiry_mutex);
   582	
   583		/* Save old values to detect changes that require reprobe */
   584		old_type = sdev->type;
   585		old_periph_qual = sdev->inq_periph_qual;
   586	
   587		kfree(sdev->inquiry);
   588		sdev->inquiry = new_inquiry;
   589		sdev->vendor = (char *)(sdev->inquiry + 8);
   590		sdev->model = (char *)(sdev->inquiry + 16);
   591		sdev->rev = (char *)(sdev->inquiry + 32);
   592		sdev->inq_periph_qual = (inq_result[0] >> 5) & 7;
   593	
   594		/*
   595		 * Update device type and removable media flag from INQUIRY bytes 0-1.
   596		 * This is the single source of truth for setting these fields from
   597		 * INQUIRY data, used by both initial probe (scsi_add_lun) and reprobe
   598		 * (scsi_rescan_device, scsi_probe_and_add_lun).
   599		 */
 > 600		if (!(sdev->sdev_bflags & BLIST_ISROM)) {
   601			sdev->type = inq_result[0] & 0x1f;
   602			sdev->removable = (inq_result[1] & 0x80) >> 7;
   603	
   604			/*
   605			 * some devices may respond with wrong type for
   606			 * well-known logical units. Force well-known type
   607			 * to enumerate them correctly.
   608			 */
   609			if (scsi_is_wlun(sdev->lun) && sdev->type != TYPE_WLUN) {
   610				sdev_printk(KERN_WARNING, sdev,
   611					    "%s: correcting incorrect peripheral device type 0x%x for W-LUN 0x%16xhN\n",
   612					    __func__, sdev->type, (unsigned int)sdev->lun);
   613				sdev->type = TYPE_WLUN;
   614			}
   615	
   616			/* lockable defaults to removable, unless blacklist overrides */
   617			sdev->lockable = sdev->removable;
 > 618			if (sdev->sdev_bflags & BLIST_NOT_LOCKABLE)
   619				sdev->lockable = 0;
   620		}
   621	
   622		/* Update capability flags from INQUIRY byte 7 */
   623		sdev->soft_reset = ((inq_result[7] & 1) && ((inq_result[3] & 7) == 2)) ? 1 : 0;
   624	
   625		/* Update protocol support flags */
   626		sdev->ppr = (sdev->scsi_level >= SCSI_3 ||
   627			     (inq_len > 56 && inq_result[56] & 0x04)) ? 1 : 0;
   628		sdev->wdtr = (inq_result[7] & 0x60) ? 1 : 0;
   629		sdev->sdtr = (inq_result[7] & 0x10) ? 1 : 0;
   630	
   631		/* Update tagged queuing support */
   632		sdev->tagged_supported = ((sdev->scsi_level >= SCSI_2) &&
   633					  (inq_result[7] & 2) &&
 > 634					  !(sdev->sdev_bflags & BLIST_NOTQ)) ? 1 : 0;
   635		sdev->simple_tags = sdev->tagged_supported;
   636	
   637		mutex_unlock(&sdev->inquiry_mutex);
   638	
   639		/*
   640		 * If device type or peripheral qualifier changed, return a special
   641		 * code to indicate that caller should trigger device_reprobe() to
   642		 * re-match with appropriate upper-layer driver.
   643		 *
   644		 * - Type changes require different drivers (sd vs sr vs st, etc.)
   645		 * - PQ changes affect scsi_bus_match() which only matches PQ == 0
   646		 *
   647		 * Note: We check this AFTER updating all fields and releasing the
   648		 * mutex, so all INQUIRY-derived data is current regardless of whether
   649		 * reprobe is needed.
   650		 */
   651		if (old_type != sdev->type || old_periph_qual != sdev->inq_periph_qual) {
   652			if (old_type != sdev->type)
   653				sdev_printk(KERN_NOTICE, sdev,
   654					    "device type changed from %d to %d\n",
   655					    old_type, sdev->type);
   656			if (old_periph_qual != sdev->inq_periph_qual)
   657				sdev_printk(KERN_NOTICE, sdev,
   658					    "peripheral qualifier changed from %d to %d\n",
   659					    old_periph_qual, sdev->inq_periph_qual);
   660			return 1; /* Type or PQ changed - caller should reprobe */
   661		}
   662	
   663		return 0;
   664	}
   665	EXPORT_SYMBOL(scsi_update_inquiry_data);
   666	

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

  reply	other threads:[~2025-11-14  9:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13 20:18 [PATCH] scsi: core: add re-probe logic into SCSI rescan Brian Bunker
2025-11-14  9:48 ` kernel test robot [this message]
2025-11-27 14:53 ` Hannes Reinecke

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=202511141703.pqiMI34x-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=brian@purestorage.com \
    --cc=krishna.kant@purestorage.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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