Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp265087imj; Fri, 15 Feb 2019 23:25:12 -0800 (PST) X-Google-Smtp-Source: AHgI3IYQs5eXWOOi8B3TvU7XKEC9kYkHrvrGSb+v8so7Vau1Sl6XB6Zdha+uS4bJZrs+MEXoI/1j X-Received: by 2002:a17:902:2a69:: with SMTP id i96mr14208042plb.58.1550301912638; Fri, 15 Feb 2019 23:25:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550301912; cv=none; d=google.com; s=arc-20160816; b=Mv3t0lWzaBB46Tp5XPJ4tb9uLxTp17DNL1NM5eJaSR1ZdngcUgzUpQgttomRhcsjGt Tq/VMcMhXk9Oq4Mg+awhrqm5dNkm2OX/o2cs/5o7TN7qAqksYeJo8LIUPsd1FlLWbdVr v42FM+CsQ039q8V0O47mpVf+2Z/4Ykyl+YEdIhJxoRefrQXLca5mI1yzhiDSpQfRNz17 BnFosU9cQKZNWxvHjBDGJWWxz9k5PwHGLD2J2GAHd+oqngAmvyeb9OiHCY4VU6cbftje l2oxgjZLnyi+gB1Ha8HVWDpt4aXKxRHxXurP3c9jJLefJ6KOnLw8Zb6/+mgfyYGMmuyH GiYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=A9WtFQMilKbKMRbQBy9WP+3hK09k4Gbdl3FV6hhfD8o=; b=BEUtDwBo9os0zd6Iyp1Pu5VdRBjxVhOsQMhaOLk/5ll/5PWoD51A/vNF46/430/6m/ ZKzxKVDboOIK8yH0sxpSb94Uapvh9qkFL62C4y5Q+I7advqJ1akIoxnVvcLSbW3AK+pZ Dr5Wxqcz5J2HFUfk/mzHE6Ny2vXE7fOuHB0Uh+OU5lW2Sao+kVw9Ni/zdAsnGZ8ju8tR qHeOpFA9ImeYA66wxF7REjHg6aLqCtEGpXFDu3zNUFcnKHkYfTzneoBZhSWcWLoZ+b4l 5oaKkiMFwXzylcsd6cwalA8DaaOw6VyR/EdqC2DRkkq1qrItG283QqzbrIllc5AnkY+5 YiRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si6998338pgr.20.2019.02.15.23.24.56; Fri, 15 Feb 2019 23:25:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390892AbfBOUoW (ORCPT + 99 others); Fri, 15 Feb 2019 15:44:22 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:43738 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727198AbfBOUoV (ORCPT ); Fri, 15 Feb 2019 15:44:21 -0500 Received: from mail-it1-f197.google.com ([209.85.166.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1gukLL-0006Vu-B9 for linux-kernel@vger.kernel.org; Fri, 15 Feb 2019 20:44:19 +0000 Received: by mail-it1-f197.google.com with SMTP id v12so8677641itv.9 for ; Fri, 15 Feb 2019 12:44:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=A9WtFQMilKbKMRbQBy9WP+3hK09k4Gbdl3FV6hhfD8o=; b=aoYkwtI4+y/hRafU6QM9t4Vf+2fZu91I2I0EgRjNYvpkQ9ZRrIz7lm0RfYJPBb1Q/g GO/uSfdxWm3JufrWh9N8gx1OfmdwgendRsp6CPPR4ryYBCsCxVcQOmnqqUJhdGk3a1hL jgCnYleb86+cpGvUbrlCRDaBwAXVxwFpJ6hjV60GEOr3P2ISpvIJmOlKRYT3RSAeDVjP AuLaKQiGfDzi9gMTy3PrG2qxvxByHKdySBy5+a6ZFPCPjFTr1A2YlMdIsHFgRB0fGVdq UfsU1QWPRIfzj+KEDHT6tYTrTqgPq6yEPAACo6RFvQau2u7HUVVsDXC0f3GkqswLTAXN HKXQ== X-Gm-Message-State: AHQUAuZ1uyGgVNRq3/F2WA7zjSApKJYI/uToH1ooxnYoBZCW8iPlotXm /QSvxoYgJ5mAPbCuzFVfBaKnxsWhE1mIMASYRefVEqpovnrWVa1DQoSf2DBmiCjQG955QTK6/1W 3b+8xg6LbKcx77oXurdG1wHqiH9y6Qf1QWj56mG3ZwQ== X-Received: by 2002:a6b:6d18:: with SMTP id a24mr7551952iod.292.1550263458245; Fri, 15 Feb 2019 12:44:18 -0800 (PST) X-Received: by 2002:a6b:6d18:: with SMTP id a24mr7551935iod.292.1550263457892; Fri, 15 Feb 2019 12:44:17 -0800 (PST) Received: from xps13.canonical.com (c-107-2-141-103.hsd1.co.comcast.net. [107.2.141.103]) by smtp.gmail.com with ESMTPSA id k18sm2637193ioa.39.2019.02.15.12.44.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Feb 2019 12:44:16 -0800 (PST) Date: Fri, 15 Feb 2019 13:44:15 -0700 From: dann frazier To: John Garry Cc: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linuxarm@huawei.com, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, yanaijie@huawei.com Subject: Re: [PATCH] scsi: libsas: Fix rphy phy_identifier for PHYs with end devices attached Message-ID: <20190215204415.GA1006@xps13.dannf> References: <1550162277-17615-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1550162277-17615-1-git-send-email-john.garry@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 15, 2019 at 12:37:57AM +0800, John Garry wrote: > The sysfs phy_identifier attribute for a sas_end_device comes > from the rphy phy_identifier value. > > Currently this is not being set for rphys with an end device attached, > so we see incorrect symlinks from systemd disk/by-path: > > root@localhost:~# ls -l /dev/disk/by-path/ > total 0 > lrwxrwxrwx 1 root root 9 Feb 13 12:26 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy0-lun-0 -> ../../sdb > lrwxrwxrwx 1 root root 10 Feb 13 12:26 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy0-lun-0-part1 -> ../../sdb1 > lrwxrwxrwx 1 root root 10 Feb 13 12:26 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy0-lun-0-part2 -> ../../sdb2 > lrwxrwxrwx 1 root root 10 Feb 13 12:26 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy0-lun-0-part3 -> ../../sdc3 > > Indeed, each sas_end_device phy_identifier value is 0: > > root@localhost:/# more sys/class/sas_device/end_device-0\:0\:2/phy_identifier > 0 > root@localhost:/# more sys/class/sas_device/end_device-0\:0\:10/phy_identifier > 0 > > This patch fixes the discovery code to set the phy_identifier. > With this, we now get proper symlinks: > > root@localhost:~# ls -l /dev/disk/by-path/ > total 0 > lrwxrwxrwx 1 root root 9 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy10-lun-0 -> ../../sdg > lrwxrwxrwx 1 root root 9 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy11-lun-0 -> ../../sdh > lrwxrwxrwx 1 root root 9 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy2-lun-0 -> ../../sda > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy2-lun-0-part1 -> ../../sda1 > lrwxrwxrwx 1 root root 9 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy3-lun-0 -> ../../sdb > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy3-lun-0-part1 -> ../../sdb1 > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy3-lun-0-part2 -> ../../sdb2 > lrwxrwxrwx 1 root root 9 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy4-lun-0 -> ../../sdc > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy4-lun-0-part1 -> ../../sdc1 > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy4-lun-0-part2 -> ../../sdc2 > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy4-lun-0-part3 -> ../../sdc3 > lrwxrwxrwx 1 root root 9 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy5-lun-0 -> ../../sdd > lrwxrwxrwx 1 root root 9 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy7-lun-0 -> ../../sde > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy7-lun-0-part1 -> ../../sde1 > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy7-lun-0-part2 -> ../../sde2 > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy7-lun-0-part3 -> ../../sde3 > lrwxrwxrwx 1 root root 9 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy8-lun-0 -> ../../sdf > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy8-lun-0-part1 -> ../../sdf1 > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy8-lun-0-part2 -> ../../sdf2 > lrwxrwxrwx 1 root root 10 Feb 13 11:53 platform-HISI0162:01-sas-exp0x500e004aaaaaaa1f-phy8-lun-0-part3 -> ../../sdf3 > > Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver") > Reported-by: dann frazier Thanks John. Solves the problem for me as well. Tested-by: dann frazier -dann > Signed-off-by: John Garry > > diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c > index 17eb4185f29d..f21c93bbb35c 100644 > --- a/drivers/scsi/libsas/sas_expander.c > +++ b/drivers/scsi/libsas/sas_expander.c > @@ -828,6 +828,7 @@ static struct domain_device *sas_ex_discover_end_dev( > rphy = sas_end_device_alloc(phy->port); > if (!rphy) > goto out_free; > + rphy->identify.phy_identifier = phy_id; > > child->rphy = rphy; > get_device(&rphy->dev); > @@ -854,6 +855,7 @@ static struct domain_device *sas_ex_discover_end_dev( > > child->rphy = rphy; > get_device(&rphy->dev); > + rphy->identify.phy_identifier = phy_id; > sas_fill_in_rphy(child, rphy); > > list_add_tail(&child->disco_list_node, &parent->port->disco_list);