Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5628165imu; Wed, 30 Jan 2019 00:28:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN4tW2ckrV/g/RXWuQcS6C5fk8BhnYJNx2rt4IlLzoyXGH4zi6W+c/3AbzldFBw1i78GS0YS X-Received: by 2002:a62:fb07:: with SMTP id x7mr29417307pfm.71.1548836930272; Wed, 30 Jan 2019 00:28:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548836930; cv=none; d=google.com; s=arc-20160816; b=YHrFLiRyihq5m7pIkNflyzxwgUgPlFAViuErtBIYR2uon8LV8q4+YfW71euyv9E2GJ AYwgCo5vK3yJrvoT/MtLAeb6bYN+PZW+5rjY9bG/vMi9obwEx0puaVULxS/DXD8bWaZK j+1b/PD+37cVRzGkYol5GDSYhTUVoINL60e0VQfIVHlqehDWqC2uN7OnYhahTGdDJZ1G 6O0KQEqYI0NqhMtfGlBk9DZyeUviC2DQl7yw1aLo1PlcyIvNFnbyg2y19feHnq4sVRv8 AI1YpPAq2plxSAw3q9F6vYQ8vZNNOEShVEhn81CaZz0v7KWY9BY0lW7bqhScHYyGHTZ4 GFSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=xsoctXw4phRxc/g5jkts7+zlY4tjlIPumMUaDHtoWr8=; b=TWUp23fZ+6tlj2VuEtAmB5rDYpG1HXcLczOSPqygOExgBQHCPKUOdEYn0igW7OxPmX bsvy7MoEVJ0kzaMEO5H43G2IHYpuXCGS/R63sunrv50w+PB8cHrCDBivQ/nNJ4Wj+/FQ pOR/suSSSvJeVRrWdAM8X7MZ4MZUQlZ5tVLW46Tvcx6uCl5utuTdb/k7P/ZFCdDKvpLU rGFUCaq4ZW0wLqlHryHHXRX319VVsBQCrosFZWirC9ocAacbql+eLG+TvVLAmtVe04qc FoihLL+mT7tCpHbLb5i9jdJdQTnaKJLWD6XMJr0FGeNbOz0X/ilERrqhsWW3C8vBFT3p NYUA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si978727plk.61.2019.01.30.00.28.34; Wed, 30 Jan 2019 00:28:50 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730177AbfA3IZy (ORCPT + 99 others); Wed, 30 Jan 2019 03:25:54 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2700 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728191AbfA3IZy (ORCPT ); Wed, 30 Jan 2019 03:25:54 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id CAC2DE3ADE173F8FFBA1; Wed, 30 Jan 2019 16:25:51 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.408.0; Wed, 30 Jan 2019 16:25:44 +0800 From: Jason Yan To: , CC: , , , , , , , , , , , , , Jason Yan Subject: [PATCH v2 0/7] libsas: fix issue of swapping or replacing disks Date: Wed, 30 Jan 2019 16:24:05 +0800 Message-ID: <20190130082412.9357-1-yanaijie@huawei.com> X-Mailer: git-send-email 2.14.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The work flow of revalidation now is scanning expander phy by the sequence of the phy and check if the phy have changed. This will leads to some issues of swapping disks or replacing a disk with a new one. This patchset addresses the issues above by these main changes: 1. Let the revalidation first scan all phys, mark all changed phys, then revalidate in two steps. First check if we need to unregister some devices. if we need to unregister some devices, tell the upper revalidation that we need to revalidate again. Second, if no devices need to be unregistered, discover new devices. 2. For sata disk, checking the ata devices class and id to ensure the same device after flutter. v1->v2: 1. Do not raise a new bcast but use a loop in sas_revalidate_domain() to retry revalidation if we need to revalidate again. So that we can do the bcast event processing synchronised to the original event 2. Drop some patches splitted from this patchset: https://lkml.org/lkml/2018/9/25/153 3. Drop the SATA PHY connection rate matching patch since John had a better solution for the device discovery phase. https://lkml.org/lkml/2019/1/4/340 4. Re-init negotiated_linkrate when PHY is down. 5. Fix an issue when event in queue reached the limit. Jason Yan (7): scsi: libsas: reset the negotiated_linkrate when phy is down scsi: libsas: only clear phy->in_shutdown after shutdown event done scsi: libsas: optimize the debug print of the revalidate process scsi: libsas: split the replacement of sas disks in two steps scsi: libsas: check if the same device when flutter scsi: libsas: reset the phy address if discover failed scsi: libsas: fix issue of swapping two sas disks drivers/ata/libata-core.c | 3 +- drivers/scsi/libsas/sas_ata.c | 18 +++ drivers/scsi/libsas/sas_discover.c | 25 ++-- drivers/scsi/libsas/sas_expander.c | 239 +++++++++++++++++++++++++++---------- drivers/scsi/libsas/sas_phy.c | 3 +- include/linux/libata.h | 2 + include/scsi/libsas.h | 6 +- 7 files changed, 224 insertions(+), 72 deletions(-) -- 2.14.4