Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp752380pxt; Thu, 5 Aug 2021 10:45:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/s62eMaWpJe5J3vszIv/aSZ015SYwCo+XusnPPgo1FpU0HgR9QEZJSOWqCkWfkCc4pnAq X-Received: by 2002:a50:eb88:: with SMTP id y8mr8032105edr.70.1628185505755; Thu, 05 Aug 2021 10:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628185505; cv=none; d=google.com; s=arc-20160816; b=fgN69jqvI8CfRCLsmENV0oooK06t9Oe9kXCVkTACbJ2HWk79S2IvMXdKVFUnZa9RFV 5h6UTEGXkzKKJiLKiJe+fXvAbEeJOKrNzMvCWD1rMU7WoZmbfxPZtJgwsoyqrRcQdMJb 1J6Wg9xH6Y6sW3RwTbwYsDwS2NVKNsItDP1AeooqoO+JcYDziuMcdS3y0NhN7Ajriz1o D9KeI1wYOM0T7muNJZ6AxbF92MsE58iAl/rvyCcQsxT9l/CgoodoiXPnGKsWgUNDT79C j33q1ZZH4YR5IJiYm4xtpCehUsG4btFTA3Ilf4OntmBX9nMm89NKdJfXjI7+tJ1obtK/ 2VMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5BKYUm+CJ0D6hXEUtWGQKFopmTxFb/xMlpRZ9GsGaQw=; b=ZYGllEImmdtJqNH/7ebvziOH79fgK//QomD7N/ALZKGkXpU2Gd0eCdENY1XdPcRAw+ eV7MCi15TPQOs/MfR6K2C2aF8FBQtyZza+7rrPJ9FySkpJErJEyv8wKbqfiFgD7vs4W9 NKQMmapuoBP+ZgNIeifEbdqdP8b38auodwqD7sAJPMSUTpLgg9AblxqhyhBWmTa0IF/n h6SS+o0Attrdflv6gq2P5b++f1SKylZfnTfq8usIzkbCeoVeov4HCbWpYVwcuyA6ownm MsJ5R19iYkqRlY7iR6RjforYz+ak9Cl7I1CC7Cy0NtOkZIwTtOxyZTFn2U5xE1dowEYC 3oGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=umGMcWlw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd6si6485275edb.119.2021.08.05.10.44.42; Thu, 05 Aug 2021 10:45:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=umGMcWlw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241376AbhHEMad (ORCPT + 99 others); Thu, 5 Aug 2021 08:30:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:43920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241386AbhHEMad (ORCPT ); Thu, 5 Aug 2021 08:30:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC46961050; Thu, 5 Aug 2021 12:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628166619; bh=oHpRbH759WgNKrrgklJx6/f8NSNkMtCqiEdRLlBlBxM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=umGMcWlwMH2Ah/swXE9UPY5eK/oTl3ZpCnmugc8YqSQ2gG06lCHwB2Lg5GHlgW/gF lyzzLZWd4bKH10xLE3Brnykrle2hlZcbfrg+pRfBiCJqIsnd+Q0NooNcCXXgx/aX2l DpBjOw/zzsinmFb+OcleIjSY0FlbMIdlb++J5oJ0DPaQQHkDrG10z/ML/fyFgyFJJJ KAhsa/l3a/QPF888jT3jzvl1a5CyjjKG9QzQF9kbT/EdrJpEEbumAUOWsWef3+Dh8m tFKDsrfF+8mRf8h2g5ujQSjjPfTVw0AE4b2nHP3JdyG4S71MbznTzI/56YvBIiMguE m6OZZGo0huDIw== Date: Thu, 5 Aug 2021 15:30:15 +0300 From: Leon Romanovsky To: Jason Gunthorpe Cc: YueHaibing , liangwenpeng@huawei.com, liweihang@huawei.com, dledford@redhat.com, chenglang@huawei.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] RDMA/hns: Fix return in hns_roce_rereg_user_mr() Message-ID: References: <20210804125939.20516-1-yuehaibing@huawei.com> <974d3309-3617-6413-5a8d-c92b1b2f8dfe@huawei.com> <20210805122311.GJ543798@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210805122311.GJ543798@ziepe.ca> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 05, 2021 at 09:23:11AM -0300, Jason Gunthorpe wrote: > On Thu, Aug 05, 2021 at 01:58:53PM +0300, Leon Romanovsky wrote: > > > > IMO, if ibv_rereg_mr failed, the mr is in undefined state, user > > > needs to call ibv_dereg_mr in order to release it, so there no > > > need to recover the original state. > > > > The thing is that it undefined state in the kernel. What will be if > > user will change access_flags and try to use that "broken" MR > > anyway? Will you catch it? > > rereg is not atomic, if the rereg fails in the middle the mr should be > left in some safe state. It is not the case in the hns flow, they leave such MR in limbo state. > > Jason