[{"id":3682450,"web_url":"http://patchwork.ozlabs.org/comment/3682450/","msgid":"<cdd57593-e43f-455e-bd30-f3f89c10b135@kernel.org>","list_archive_url":null,"date":"2026-04-26T23:36:19","subject":"Re: [PATCH v3 5/7] ata: libata-scsi: probe additional LUNs for\n multi-LUN ATAPI devices","submitter":{"id":86188,"url":"http://patchwork.ozlabs.org/api/people/86188/","name":"Damien Le Moal","email":"dlemoal@kernel.org"},"content":"On 4/27/26 4:09 AM, Phil Pemberton wrote:\n> After LUN 0 is added for an ATAPI device, check its BLIST_FORCELUN\n> flag.  If set, call scsi_scan_target() with SCAN_WILD_CARD to trigger\n> the SCSI layer's built-in sequential LUN scan for that target only.\n> This probes LUNs 1..shost->max_lun, driven by the atapi_max_lun module\n> parameter from patch 1/6.  Devices without BLIST_FORCELUN (the vast\n\nPlease remove the mention of patch 1/6. Once the patches are applied, that will\nnot mean anything.\n\n> majority of ATAPI devices) are left with only LUN 0 -- no sequential\n> scan is triggered, so single-LUN devices like the iHAS124 DVD writer\n> are completely unaffected.\n> \n> Non-responding LUNs (PQ=0/PDT=0x1f) are silently skipped by\n> scsi_probe_and_add_lun() when BLIST_NO_LUN_1F is set on the device\n> via scsi_devinfo (see patch 4/6).\n\nSame thing here.\n\n> \n> Signed-off-by: Phil Pemberton <philpem@philpem.me.uk>\n> ---\n>  drivers/ata/libata-scsi.c | 37 ++++++++++++++++++++++++++++---------\n>  1 file changed, 28 insertions(+), 9 deletions(-)\n> \n> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c\n> index 48c7d323d6f9..fc719e3d7d60 100644\n> --- a/drivers/ata/libata-scsi.c\n> +++ b/drivers/ata/libata-scsi.c\n> @@ -26,6 +26,7 @@\n>  #include <scsi/scsi_device.h>\n>  #include <scsi/scsi_tcq.h>\n>  #include <scsi/scsi_transport.h>\n> +#include <scsi/scsi_devinfo.h>\n>  #include <linux/libata.h>\n>  #include <linux/hdreg.h>\n>  #include <linux/uaccess.h>\n> @@ -4700,7 +4701,6 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)\n>   repeat:\n>  \tata_for_each_link(link, ap, EDGE) {\n>  \t\tata_for_each_dev(dev, link, ENABLED) {\n> -\t\t\tstruct scsi_device *sdev;\n>  \t\t\tint channel = 0, id = 0;\n>  \n>  \t\t\tif (dev->sdev[0])\n> @@ -4711,15 +4711,34 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)\n>  \t\t\telse\n>  \t\t\t\tchannel = link->pmp;\n>  \n> -\t\t\tsdev = __scsi_add_device(ap->scsi_host, channel, id, 0,\n> -\t\t\t\t\t\t NULL);\n> -\t\t\tif (!IS_ERR(sdev)) {\n> -\t\t\t\tdev->sdev[0] = sdev;\n> -\t\t\t\tata_scsi_assign_ofnode(dev, ap);\n> -\t\t\t\tscsi_device_put(sdev);\n> -\t\t\t} else {\n> -\t\t\t\tdev->sdev[0] = NULL;\n> +\t\t\t{\n> +\t\t\t\tstruct scsi_device *sdev;\n\nThis is not pretty... Please leave the declaration of sdev where it was and\nremove this curly bracket. That will save one level of identation and make the\ncode cleaner.\n\n> +\n> +\t\t\t\tsdev = __scsi_add_device(ap->scsi_host,\n> +\t\t\t\t\t\t\t channel, id, 0, NULL);\n> +\t\t\t\tif (!IS_ERR(sdev)) {\n> +\t\t\t\t\t/*\n> +\t\t\t\t\t * For multi-LUN ATAPI (BLIST_FORCELUN),\n> +\t\t\t\t\t * trigger the sequential LUN scan.\n> +\t\t\t\t\t * pdt_1f_for_no_lun (set during LUN 0\n> +\t\t\t\t\t * configure) ensures non-responding LUNs\n> +\t\t\t\t\t * are silently skipped.  dev->sdev[] is\n> +\t\t\t\t\t * populated by ata_scsi_dev_config()\n> +\t\t\t\t\t * during the scan callbacks.\n> +\t\t\t\t\t */\n> +\t\t\t\t\tif (dev->class == ATA_DEV_ATAPI &&\n> +\t\t\t\t\t    sdev->sdev_bflags & BLIST_FORCELUN)\n> +\t\t\t\t\t\tscsi_scan_target(\n> +\t\t\t\t\t\t\t&ap->scsi_host->shost_gendev,\n> +\t\t\t\t\t\t\tchannel, id,\n> +\t\t\t\t\t\t\tSCAN_WILD_CARD,\n> +\t\t\t\t\t\t\tSCSI_SCAN_RESCAN);\n> +\t\t\t\t\tscsi_device_put(sdev);\n> +\t\t\t\t}\n>  \t\t\t}\n> +\n> +\t\t\tif (dev->sdev[0])\n> +\t\t\t\tata_scsi_assign_ofnode(dev, ap);\n>  \t\t}\n>  \t}\n>","headers":{"Return-Path":"\n <linux-ide+bounces-5546-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ide@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=BcmohLur;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ide+bounces-5546-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"BcmohLur\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g3jl41lbBz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 09:36:32 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 4FC0C300C91A\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 26 Apr 2026 23:36:29 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D3624280318;\n\tSun, 26 Apr 2026 23:36:27 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id AFBD1197A7D;\n\tSun, 26 Apr 2026 23:36:27 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 87B4FC2BCAF;\n\tSun, 26 Apr 2026 23:36:26 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777246587; cv=none;\n b=mS89UpiQbhXltEUpsXA97gJXKKNkEyikWnJlAm2/tuPkiGWJYPp4aN9UfBui+C3NnnVEASQH0fTwvsqM2/oTXa773OfYgojYPB7EiylMZJV1DtKS98BOaNzBn9oFS/Dxt5EDNPi63iR27KjJv72Gq9Q2TEsv91sj5DNoVcb9QDA=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777246587; c=relaxed/simple;\n\tbh=GKnFhzMFp4+uM9HsmIbQkPLpZ9LXxC2RVfT0Dexphc4=;\n\th=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:\n\t In-Reply-To:Content-Type;\n b=HTmRV/N775j0SJfmVULJxyFlzVD5SupwjBuKu8VYwphkhPBm4v6gE2CVdAgfKe6W5rZTkOzDqFdV/K9ojTQaDuK/iCtAWvp7Ufz6z/LI6gf9iKENnw2qCoKH1rL26BlGQQ2GmRqU205DBxarsWu59AIJ/KQPwT40/zThvyYI6MQ=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=BcmohLur; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777246587;\n\tbh=GKnFhzMFp4+uM9HsmIbQkPLpZ9LXxC2RVfT0Dexphc4=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=BcmohLurbJTZkIjseOJr7jyabXKLvDyFg/y+VgSyFkHoTMZSaPi4cTz2BDQsKQcCt\n\t MNdHyaAQjjo5UCXAThElU8B+v1EYKzfXB0vRMF9bnA5DW6fqYeIEUhTXKzowmY4tTa\n\t U17Gr3G8O4xT4i/5N34TBtFZOBKPeM9Ik8HYjHSfLVgha6WohlQ0IG+ouUS8TMUv8S\n\t dk/mufPHWfCOG8odj83tP6Uq4Eo6e1K1mryPcA370cVwqgFlX/x6i1uyu3rz6smmkY\n\t Fzu0iVSb08ZhweUU83TM7CO3SVnJNrDZMF6CuU+PN5UlV7sWnYmkYPacR/Phh64SAu\n\t 0yW5hYEa1Djlg==","Message-ID":"<cdd57593-e43f-455e-bd30-f3f89c10b135@kernel.org>","Date":"Mon, 27 Apr 2026 08:36:19 +0900","Precedence":"bulk","X-Mailing-List":"linux-ide@vger.kernel.org","List-Id":"<linux-ide.vger.kernel.org>","List-Subscribe":"<mailto:linux-ide+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ide+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 5/7] ata: libata-scsi: probe additional LUNs for\n multi-LUN ATAPI devices","To":"Phil Pemberton <philpem@philpem.me.uk>, linux-ide@vger.kernel.org,\n linux-scsi@vger.kernel.org","Cc":"linux-kernel@vger.kernel.org, Niklas Cassel <cassel@kernel.org>,\n \"James E . J . Bottomley\" <James.Bottomley@HansenPartnership.com>,\n \"Martin K . Petersen\" <martin.petersen@oracle.com>,\n Hannes Reinecke <hare@suse.de>","References":"<20260426190920.2051289-1-philpem@philpem.me.uk>\n <20260426190920.2051289-6-philpem@philpem.me.uk>","Content-Language":"en-US","From":"Damien Le Moal <dlemoal@kernel.org>","Organization":"Western Digital Research","In-Reply-To":"<20260426190920.2051289-6-philpem@philpem.me.uk>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit"}}]