Re: [PATCH v2 2/5] ata: ahci: a hotplug capable port is an external port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everbody,

On 2024-02-06 22:13:43+0000, Niklas Cassel wrote:
> A hotplug capable port is an external port, so mark it as such.
> 
> We even say this ourselves in libata-scsi.c:
> /* set scsi removable (RMB) bit per ata bit, or if the
>  * AHCI port says it's external (Hotplug-capable, eSATA).
>  */
> 
> This also matches the terminology used in AHCI 1.3.1
> (the keyword to search for is "externally accessible").
> 
> Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
> Signed-off-by: Niklas Cassel <cassel@xxxxxxxxxx>
> ---
>  drivers/ata/ahci.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index aa58ce615e79..4d3ec6d15ad1 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1648,9 +1648,10 @@ static void ahci_mark_external_port(struct ata_port *ap)
>  	void __iomem *port_mmio = ahci_port_base(ap);
>  	u32 tmp;
>  
> -	/* mark esata ports */
> +	/* mark external ports (hotplug-capable, eSATA) */
>  	tmp = readl(port_mmio + PORT_CMD);
> -	if ((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS))
> +	if (((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS)) ||
> +	    (tmp & PORT_CMD_HPCP))
>  		ap->pflags |= ATA_PFLAG_EXTERNAL;
>  }

This seems to introduce a userspace regression.

GNOME/udisks are now automounting internal disks, which they didn't before.
See [0], [1], [2]

ATA_PFLAG_EXTERNAL is translated into GENHD_FL_REMOVABLE.
(Through ata_scsiop_inq_std(), scsi_add_lun(), sd_probe())

But GENHD_FL_REMOVABLE is not meant for hotpluggable devices but for
media-changable devices (See its description in include/linux/blkdev.h).

To indicate hotplug, dev_set_removable() is to be used.

(Both end up in "removable" sysfs attributes, but these have different
semantics...)

#regzbot introduced: 45b96d65ec68f625ad26ee16d2f556e29f715005

[0] https://bbs.archlinux.org/viewtopic.php?id=295958
[1] https://github.com/storaged-project/udisks/issues/1282
[2] https://github.com/util-linux/util-linux/issues/3088




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux