Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030638AbeAONhD (ORCPT + 1 other); Mon, 15 Jan 2018 08:37:03 -0500 Received: from mail-eopbgr10040.outbound.protection.outlook.com ([40.107.1.40]:7584 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751850AbeAONg5 (ORCPT ); Mon, 15 Jan 2018 08:36:57 -0500 Authentication-Results: spf=pass (sender IP is 193.47.165.134) smtp.mailfrom=mellanox.com; lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=pass action=none header.from=mellanox.com; Subject: Re: [Suspected-Phishing]Re: [PATCH V3 1/2] nvme: split resetting state into reset_prepate and resetting From: Max Gurtovoy To: Sagi Grimberg , Jianchao Wang , , , CC: , References: <1515647268-1717-1-git-send-email-jianchao.w.wang@oracle.com> <1515647268-1717-2-git-send-email-jianchao.w.wang@oracle.com> Message-ID: <1c001532-234f-bc56-7fb4-bcd08142842e@mellanox.com> Date: Mon, 15 Jan 2018 15:36:48 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1255"; format=flowed Content-Language: he Content-Transfer-Encoding: 8bit X-Originating-IP: [10.223.3.143] X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:193.47.165.134;IPV:NLI;CTRY:IL;EFV:NLI;SFV:NSPM;SFS:(10009020)(39380400002)(376002)(39860400002)(396003)(346002)(2980300002)(438002)(189003)(199004)(24454002)(64126003)(305945005)(81156014)(7736002)(81166006)(31686004)(76176011)(31696002)(8676002)(86362001)(4326008)(356003)(2950100002)(6246003)(59450400001)(65956001)(47776003)(1720100001)(8936002)(83506002)(36756003)(478600001)(65826007)(5660300001)(65806001)(966005)(16526018)(77096006)(106002)(6116002)(3846002)(16576012)(316002)(106466001)(67846002)(6306002)(229853002)(110136005)(2201001)(53546011)(2870700001)(2906002)(54906003)(93886005)(50466002)(58126008)(3940600001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0501MB2264;H:mtlcas13.mtl.com;FPR:;SPF:Pass;PTR:mail13.mellanox.com;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;AM5EUR03FT044;1:vTXtSNGfZ5SVDXp9Q/JNpOplalr2z7Uwy+UiIixRhlAPJGrs6HAQ9kdoB+EX5+hTkabu8jVamiiHa5qujPIBrwGVvdDEYUOi+vhTtOLMNdeGjXiDg1VOSaPLyqsJafPO X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ca129664-f741-40a9-2620-08d55c1d08d0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(4608076)(2017052603307)(7153060)(7193020);SRVR:DB6PR0501MB2264; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2264;3:SNphTHswwqvIxAcWc8O0w2V0tt+q5lef/hVH/cpkiZM6AIjP9kYWeuv7DKrD7PiX7H0nvHE3N/ACytNvwyqJbF9KmfLP/9qHYwSLYk/HUgsEqDq+wYPfiSPedj5DJ7qyDtARIVJl8eLx1wk5J94QZhsZXdFuX7zEIdp02aZ43Bk7Fjc5HsKZEGO5KZOFxapBtx61w/IBHYZBF52Sir9hlSxMHZnu2wC/h3dXc3K3nBsoAIxzEoij9bs/Ra5q45bK80iIbWhWns5/LL3ccSswPLD01T9NCM5rgABj/o2hr+zUVRpvXV3aabgf3qzX8IijI6Hqx2ynYZmOrB6RJzhSir4C8QY/geC/qU1d09g/OuM=;25:UWQxkED8otv0y19ohjPTEAJwTUcz2q/W2uViPQvpZhj8aozFJvOhp7RXSo0CsAYfs+/H/yXJgmIU0KZrTgYPxrFGPYDUPjDYQwoXgCL0LSsy5qKnF95mcmMHmvCk7GytIX1lSqAoHvVCiA8Cj9g8j6WRjJ3FY/INhm2/Kxv4L3hlj5k6EaqFNRM1AsfQF81kZqyFoby93EMlUJpUq4ozEnAjDgVW7xUug0dXtyFZNLbiAq19cySwKcRiT4bOCj2cPOHO6NkZZ4uNauwclGJD+8gYSQxBqehY2fUIbaVKWlQ14Fu3Y5I+vo9qa3FYujvgsEL3JD2+gJr8CH74A1Aewg== X-MS-TrafficTypeDiagnostic: DB6PR0501MB2264: X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2264;31:ar/4fIvIdh9Y1qzRVLYmFnnzTehEZhWyZsuk1WNDtjXasm83XyekboaA1IcdjdeBF/Q4j+KMjuz82RxPFaJtRyo/Xi+nNyFIoPEcicFdxBeqsCh4WrmpGjy+LHb7N0PdZx/wmSBjW/eZxB1/vPISi6R37wBgL09JpjnBI5QLCG71srGwtMucO57dqgfE09B6qHf/dsnxfauu7FjNslJqufN9QvHmUpHVJKXGoG2n8Qc=;20:CSBhkz/f8ZItC40wQUOiXUikcnpbsYurAa4YG5AeaOYv0GCWcoaDALzj9UZCfhGshTJfTxWfitG5SLUe5gJQVj/qmEbJKc2gd5RLu6koeYM5NovSlpNwj4fSivfgPfPpiIYLkPoCHXdvVDPQ3Q1rv/oQ/LhKD2PWUFB9Xs2cPOlrYrN7uF1xifqlY33hEEzKq1//wtPzmm4C1kIE4me/Gv8K77s1EjEyTKIyJKSFV4ca0uo5gHgup00KnGuXDO+25VMKk3qvknfEHlJHBT27z/d18KZ7dOthXjMEZkn60bS2nJO9O3RJfcz+uA9mbloyQnAw6IYNJckaqb223T7ZN0LoXqcRuJ+FqQJGWsbpFmTSdpI7cfWXMll8z8ofHIPfrBDDYeOWey8YF2QiTRAQdZW9wB+jAe1zngvWt+8+/t2vM+nVyUGEWz5JF/xp/KXVEJ9YyKS1PHXJkc0ksRy3/6kvT/EN37PQTGxXq90Xco5Y9p90BdJJz6UMXGN70cbz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(258649278758335)(146099531331640); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501161)(93006095)(93004095)(10201501046)(3002001)(6055026)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DB6PR0501MB2264;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DB6PR0501MB2264; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2264;4:60XrT1+htNzomJUEN7aCYStLWNY/cIdlJf1zGbXFJ+FwKqS5gEEhm++QJJX+pfBTX0oop5y8CCaWSfWqFo8WbN6IkyF2H0YpHYqMt+Lioc+9QCjduG8H1P7zEFMNoRfPYU4wkTrnf2tyAkk5B1cU5Xt6Knv2WNDuX5g9ovXKU8qRwBc+2IDxLsaFWMovve4ViP0BZq0LpU7nSP5xz59NzRNYi5RMMD9aCmc7Ww2VXwwILUyS3S1WnxHyhtWUj7a6cfUDrcWHmEysfi1JjoZ9ecDxGIYkbys+6/jPLcOv9+1q1rEqB0q2zIaWtKR9a/bgmPFox2/xhUOv+8yPijrt+iNRZmBSsKjEoj40pZ+FCbI= X-Forefront-PRVS: 0553CBB77A X-Microsoft-Exchange-Diagnostics: =?windows-1255?Q?1;DB6PR0501MB2264;23:oh04rrJXdlJO/nl2c56gmF2iQfCrHa3TFbc?= =?windows-1255?Q?dXqg6nBQZ7HgdjkV5sA5UQtUBVoezYeWq71a72rWeHpfjZPuky5nxTWG?= =?windows-1255?Q?EE56GtUKsQ/g9+oSi+9z/lf68YScEyGv0j3EelDPYnEacJ1oTThUWygW?= =?windows-1255?Q?pJWJWl2Df2cfi9dOhSbOkh9JOPJFXNNxk3hbu19UOr2pQJ0F1sxrbZ0w?= =?windows-1255?Q?l4VhsgOLcWjQV+vbgstAn0YNi30mYmHCf+1BBSPRGSd/00culpXkI6O7?= =?windows-1255?Q?O/e7uX3o3KzxywqPy92+G3GQo/Z7JH1c1MMShbmqTJQV5GSSPI0xQvXI?= =?windows-1255?Q?LqpzdgI5nPfAQVWZf/s/AIjVlDhr5juoGnBvZUq1NrqlO41F7BWYth+Z?= =?windows-1255?Q?uo6T7MNNoISEAO6I/GzjfHKNb1CbIFqi9Fr39Py3Gu0sKjya9qyda0+3?= =?windows-1255?Q?KYHao0T24WN3Dv3JJ8B4DD5Fas43dRAZ59KUPBWTvSZO5y7n3kwL2va/?= =?windows-1255?Q?T4j05VoQAZTmBJRze9jEQfu68q/QieesIlOCUoXzG55O2/JhIdotvtnV?= =?windows-1255?Q?q5d59rPyWsR1tsSsXkDThax3CHwc/gjDJR0y8era1y+uYCTbPo3WbIGZ?= =?windows-1255?Q?XNWi6imJ8OTnGUl61MPz9pu9xWxFKsP6apcW5GOzmxopbajknWspq+vS?= =?windows-1255?Q?Zkub00GhDSM6woU8asgBp/A3Pr1vWLMkkOrj/MfR9EDNjMhJTDZ20Of3?= =?windows-1255?Q?xqy+K3tXnS17zU7oDc/otYMVbOEH02h6OGxYZvMtByVtPwVjnKp+l2ox?= =?windows-1255?Q?bjpIGRriOSccLwJh19UV14U85BHDmA/ZYvVSQPL3ywPqP13G5xQSNkBW?= =?windows-1255?Q?rmSU9eZl3uRh4esWnXIMjjNhCVP1jN7rAaHfqM3eo6xKvTGVrUZSYgun?= =?windows-1255?Q?pGvlaiqccDp33l+F07zJVxzKS8uclw91WF8V4lSbyjN0aQ7fos3Jv3B+?= =?windows-1255?Q?SjaxcetL3y7a5hhLcWtbLRFnmN9Uk2A2W5CcBBtNdScMalQn3oFzkDqx?= =?windows-1255?Q?Wb0WFyA+jFD5BmCcKmJFmBRKEZOFD0i2ZBLH+v9UmLPEUV3e/4sUGcgB?= =?windows-1255?Q?lD+CMw3xCKLrGVDL+44dmV0WPdsSKQvtqT7C1ItEr+eObwSPX499yz/0?= =?windows-1255?Q?LYTSWd72SDWJ0T4mVtpUjjYzK7zsBhYuAR/FKfLIuyEv+1/XyZb5tZGx?= =?windows-1255?Q?CU1ziROJf+xxiB9bOLQLuZkTQXtbo+J86+1KiU8M8CC4bs9MCMc/gkrC?= =?windows-1255?Q?D+k94jKrgvIZzWCVqLfrHUnDrWwp9elFXyE33uq4Dhm9zF+w0SWpwj59?= =?windows-1255?Q?+8/I9OBGIQq8Lt2zoYWo9Bju5ADNTOpr2o7dstc9EeLEamVeL/Xjm8Bs?= =?windows-1255?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1;DB6PR0501MB2264;6:lE7y+9Kb//flFgu3Sprlyh8cUKK0pz9N1HpR4ALP73hDYg0PPPIssXgZQYKAMokFPRah1M3uXsGde+iI9LHRb8fjEFN5pi28SAB9V8GKDJuWJ5J1JMRMAVe/7pV6QiAr9K9g/sIz/9phenBdlvuQe5JWPy9UMFz5uNFAbuaxfWGf4YEWbTlFKvgtjWZwnpIOrxsH7E/ZWJNLDryFIiGsvkYbqWQT3skKN9A1LfE+OjdKOHB2vq1MM0lhMm0B8l4E0W9wZU5DQHB+RuY0JJI4cUEhiHv/lh+Fki1ehNVwylSE0A4up1aAS/OepycYmMFJ9VoxxaCvAOZZXLKtkThVManyGUn3FZg6+HJCONshKtM=;5:Cx6M9X9T4vrE+c3KgzGVeZgXGrlkEP0a4FHv21a5NcnRs4nEMXz6vQ/GcSHaRUiRTmqLbWf1TfOmxs6+y31sWnNsappztCuld343SvMKcba1M8wPllMzuRlsHTJfiFmyFSlsfEA3a9uPZVESTh5eZ7zpv0Uqle7awWXc6EfYZjU=;24:PO6tHI8dc67pMizj/XI3aytAC36ot9mF2W2JaS5VgxsxqllJ0jLOzNmTA39PN/09rZu2gggPo9ywkFN+hgv4ij4ocRK1OLbIzvy9rMH7Reo=;7:4WvOMbDPU8mMGVcdevWBEjDOlCvKNLwLVSyn+aZ+XyjQ4tc9ef8ZclgiQaSJhtrj998srHPCtxV7ePckMjLeRSPAv2uCKPQSPb8drQyPmvbc3wnOcHjnHjqMnE9hJxIss+WRNyIYAgyT+ZWsU1NUnRnnM5PHwZ8C8bpLpRT5sg4DfmlhrcR4dZeJSSfMRMvbNheJ3Ne8x3ohYd9E9DFK5x1gF33o3Bp0g7d7RX+et4lIJtw28FVTjo5kWGzgR2fq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2018 13:36:51.0865 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca129664-f741-40a9-2620-08d55c1d08d0 X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a652971c-7d2e-4d9b-a6a4-d149256f461b;Ip=[193.47.165.134];Helo=[mtlcas13.mtl.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2264 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 1/15/2018 3:28 PM, Max Gurtovoy wrote: > > > On 1/14/2018 11:48 AM, Sagi Grimberg wrote: >> >>> Currently, the ctrl->state will be changed to NVME_CTRL_RESETTING >>> before queue the reset work. This is not so strict. There could be >>> a big gap before the reset_work callback is invoked. In addition, >>> there is some disable work in the reset_work callback, strictly >>> speaking, not part of reset work, and could lead to some confusion. >>> >>> This patch splits the NVME_CTRL_RESETTING into NVME_CTRL_RESET_PREPARE >>> and NVME_CTRL_RESETTING. Before queue the reset work, changes state >>> to NVME_CTRL_RESET_PREPARE, after disable work completes, changes >>> state to NVME_CTRL_RESETTING. >> >> What guarantees that nvme_timeout will do the right thing? If it >> is relying on the fact that nvme-pci sets the state to RESETTING >> only _after_ quiescing the requests queues it needs to be documented >> as its a real delicate dependency. >> >> >> >>> >>> Suggested-by: Christoph Hellwig >>> Signed-off-by: Jianchao Wang >>> --- >>> ? drivers/nvme/host/core.c?? | 17 +++++++++++++++-- >>> ? drivers/nvme/host/fc.c???? |? 2 ++ >>> ? drivers/nvme/host/nvme.h?? |? 1 + >>> ? drivers/nvme/host/pci.c??? | 28 ++++++++++++++++++++++------ >>> ? drivers/nvme/host/rdma.c?? |? 8 ++++++++ >>> ? drivers/nvme/target/loop.c |? 5 +++++ >>> ? 6 files changed, 53 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c >>> index 1e46e60..106a437 100644 >>> --- a/drivers/nvme/host/core.c >>> +++ b/drivers/nvme/host/core.c >>> @@ -87,7 +87,7 @@ static __le32 nvme_get_log_dw10(u8 lid, size_t size) >>> ? int nvme_reset_ctrl(struct nvme_ctrl *ctrl) >>> ? { >>> -??? if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) >>> +??? if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESET_PREPARE)) >>> ????????? return -EBUSY; >>> ????? if (!queue_work(nvme_wq, &ctrl->reset_work)) >>> ????????? return -EBUSY; >>> @@ -243,7 +243,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, >>> ????????????? break; >>> ????????? } >>> ????????? break; >>> -??? case NVME_CTRL_RESETTING: >>> +??? case NVME_CTRL_RESET_PREPARE: >>> ????????? switch (old_state) { >>> ????????? case NVME_CTRL_NEW: >>> ????????? case NVME_CTRL_LIVE: >>> @@ -253,10 +253,21 @@ bool nvme_change_ctrl_state(struct nvme_ctrl >>> *ctrl, >>> ????????????? break; >>> ????????? } >>> ????????? break; >>> + >>> +??? case NVME_CTRL_RESETTING: >>> +??????? switch (old_state) { >>> +??????? case NVME_CTRL_RESET_PREPARE: >>> +??????????? changed = true; >>> +??????????? /* FALLTHRU */ >>> +??????? default: >>> +??????????? break; >>> +??????? } >>> +??????? break; >>> ????? case NVME_CTRL_RECONNECTING: >>> ????????? switch (old_state) { >>> ????????? case NVME_CTRL_LIVE: >>> ????????? case NVME_CTRL_RESETTING: >>> +??????? case NVME_CTRL_RESET_PREPARE: I forget to add that we shouldn't move from RESET_PREPARE to RECONNECTING (with my suggestion to rdma.c). Also need to consider adding another check in nvmf_check_init_req (/drivers/nvme/host/fabrics.h) for the new state. >>> ????????????? changed = true; >>> ????????????? /* FALLTHRU */ >>> ????????? default: >>> @@ -267,6 +278,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, >>> ????????? switch (old_state) { >>> ????????? case NVME_CTRL_LIVE: >>> ????????? case NVME_CTRL_RESETTING: >>> +??????? case NVME_CTRL_RESET_PREPARE: >>> ????????? case NVME_CTRL_RECONNECTING: >>> ????????????? changed = true; >>> ????????????? /* FALLTHRU */ >>> @@ -2603,6 +2615,7 @@ static ssize_t nvme_sysfs_show_state(struct >>> device *dev, >>> ????????? [NVME_CTRL_NEW]??????? = "new", >>> ????????? [NVME_CTRL_LIVE]??? = "live", >>> ????????? [NVME_CTRL_RESETTING]??? = "resetting", >>> +??????? [NVME_CTRL_RESET_PREPARE]??? = "reset-prepare", >>> ????????? [NVME_CTRL_RECONNECTING]= "reconnecting", >>> ????????? [NVME_CTRL_DELETING]??? = "deleting", >>> ????????? [NVME_CTRL_DEAD]??? = "dead", >>> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c >>> index 794e66e..516c1ea 100644 >>> --- a/drivers/nvme/host/fc.c >>> +++ b/drivers/nvme/host/fc.c >>> @@ -547,6 +547,7 @@ nvme_fc_resume_controller(struct nvme_fc_ctrl *ctrl) >>> ????????? break; >>> ????? case NVME_CTRL_RESETTING: >>> +??? case NVME_CTRL_RESET_PREPARE: >>> ????????? /* >>> ?????????? * Controller is already in the process of terminating the >>> ?????????? * association. No need to do anything further. The reconnect >>> @@ -790,6 +791,7 @@ nvme_fc_ctrl_connectivity_loss(struct >>> nvme_fc_ctrl *ctrl) >>> ????????? break; >>> ????? case NVME_CTRL_RESETTING: >>> +??? case NVME_CTRL_RESET_PREPARE: >>> ????????? /* >>> ?????????? * Controller is already in the process of terminating the >>> ?????????? * association.? No need to do anything further. The reconnect >> >> James, can you take a look at this? >> >>> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c >>> index f5800c3..e477c35 100644 >>> --- a/drivers/nvme/host/pci.c >>> +++ b/drivers/nvme/host/pci.c >>> @@ -1141,8 +1141,13 @@ static bool nvme_should_reset(struct nvme_dev >>> *dev, u32 csts) >>> ????? bool nssro = dev->subsystem && (csts & NVME_CSTS_NSSRO); >>> ????? /* If there is a reset ongoing, we shouldn't reset again. */ >>> -??? if (dev->ctrl.state == NVME_CTRL_RESETTING) >>> +??? switch (dev->ctrl.state) { >>> +??? case NVME_CTRL_RESETTING: >>> +??? case NVME_CTRL_RESET_PREPARE: >>> ????????? return false; >>> +??? default: >>> +??????? break; >>> +??? } >> >> Isn't the indentation off? also in other places... >> >>> @@ -2292,7 +2303,7 @@ static void nvme_reset_work(struct work_struct >>> *work) >>> ????? bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL); >>> ????? int result = -ENODEV; >>> -??? if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) >>> +??? if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESET_PREPARE)) >>> ????????? goto out; >>> ????? /* >>> @@ -2302,6 +2313,11 @@ static void nvme_reset_work(struct work_struct >>> *work) >>> ????? if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) >>> ????????? nvme_dev_disable(dev, false); >>> +??? if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) { >>> +??????? WARN_ON_ONCE(dev->ctrl.state != NVME_CTRL_DELETING); >>> +??????? goto out; >>> +??? } >>> + >> >> This needs documentation on _why_ here. >> >>> -??? nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING); >>> +??? nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESET_PREPARE); >>> ????? dev_info(dev->ctrl.device, "pci function %s\n", >>> dev_name(&pdev->dev)); >> >> Can you rebase on top of my commit: >> 4caff8fc19f1 nvme-pci: don't open-code nvme_reset_ctrl >> >>> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c >>> index 37af565..8ae073e 100644 >>> --- a/drivers/nvme/host/rdma.c >>> +++ b/drivers/nvme/host/rdma.c >>> @@ -1753,6 +1753,14 @@ static void nvme_rdma_reset_ctrl_work(struct >>> work_struct *work) >>> ????? nvme_stop_ctrl(&ctrl->ctrl); >>> ????? nvme_rdma_shutdown_ctrl(ctrl, false); >>> +??? changed = nvme_change_ctrl_state(&ctrl->ctrl, >>> +??????????? NVME_CTRL_RESET_PREPARE); >>> +??? if (!changed) { >>> +??????? /* state change failure is ok if we're in DELETING state */ >>> +??????? WARN_ON_ONCE(ctrl->ctrl.state != NVME_CTRL_DELETING); >>> +??????? return; >>> +??? } >>> + >> >> setting RESET_PREPARE here?? >> >> Also, the error recovery code is mutually excluded from reset_work >> by trying to set the same state which is protected by the ctrl state >> machine, so a similar change is needed there. > > Sagi, > Do you mean to add this (if so, I agree): > > > diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c > index d06641b..44ef52a 100644 > --- a/drivers/nvme/host/rdma.c > +++ b/drivers/nvme/host/rdma.c > @@ -957,6 +957,12 @@ static void nvme_rdma_error_recovery_work(struct > work_struct *work) > ??? struct nvme_rdma_ctrl *ctrl = container_of(work, > ??????????? struct nvme_rdma_ctrl, err_work); > > +?? if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETING)) { > +?????? /* state change failure should never happen */ > +?????? WARN_ON_ONCE(1); > +?????? return; > +?? } > + > ??? nvme_stop_keep_alive(&ctrl->ctrl); > > ??? if (ctrl->ctrl.queue_count > 1) { > @@ -989,7 +995,7 @@ static void nvme_rdma_error_recovery_work(struct > work_struct *work) > > ?static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl) > ?{ > -?? if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING)) > +?? if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESET_PREPARE)) > ??????? return; > > ??? queue_work(nvme_wq, &ctrl->err_work); > @@ -1760,6 +1766,12 @@ static void nvme_rdma_reset_ctrl_work(struct > work_struct *work) > ??? int ret; > ??? bool changed; > > +?? if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETING)) { > +?????? /* state change failure should never happen */ > +?????? WARN_ON_ONCE(1); > +?????? return; > +?? } > + > ??? nvme_stop_ctrl(&ctrl->ctrl); > ??? nvme_rdma_shutdown_ctrl(ctrl, false); > > > > > > >> >> So in order not to break rdma ctrl reset (again) please look at: >> bcdacf7fc3d8 nvme-rdma: fix concurrent reset and reconnect >> >> _______________________________________________ >> Linux-nvme mailing list >> Linux-nvme@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-nvme > > _______________________________________________ > Linux-nvme mailing list > Linux-nvme@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-nvme