Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4466442rwb; Tue, 6 Sep 2022 07:58:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR7v0G4SX7pvvWos3UuX7gxCUOqaTcwqkLBOUoPNdsQCb1hDaMG0iudTqISnfnkpdpHLSjNv X-Received: by 2002:a17:907:8687:b0:730:7c7b:b9ce with SMTP id qa7-20020a170907868700b007307c7bb9cemr38934303ejc.656.1662476294856; Tue, 06 Sep 2022 07:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476294; cv=none; d=google.com; s=arc-20160816; b=lLhDK0P+CV7B+ziSGgEphFmXywR4cPef0mwswhAYYawEV8BOb91vDsAz/OsG+9GRLj ecs8hKLtYmal30+LtpGr73hzoVNKq8/neee6VW06R4s0tFfF/1Fu5UKo6d0IwibTNzUW 8AC6SJkXeAfe3WAw3DJEzCk/4J3olNX5fR2uB0Ud3bVmhqjrR5hMZbus0dVATbkLbDfv fTvuJoAVrVSnNJqoEm43YyZ+hobChqz1S3CuvJ9R8Va2fu6pvC/LBLJxN/3rAwSFUZ8T 1HLu2llQMtg00/KAc+q3BPPE3h9Nkhdjta6CbCouyVfi3/Q7iEeHfnFXHsGjqQkQYBgm 8QIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=miNe7A2g5uHpBr8lxuxUdyGdp5zKF0vswgo1cT4VpmM=; b=pcDP0Tg7gzZM7/9HRF4XOC4V7ulJQtn5YaVZd9brWc/v8rSahgNf6wscMh9h03xEec 7YR9Es41goVj6SayLO3jSzNRbMZYsq00IioG6OvpdsGy3y2G5WrKRPKDulHIw+QfZr1M twlAxZ8bzS/sFYvRdkg/vHS27Xvv8ls9g/fsqLmjf0v7snbmhnoEb/ZcVHwZ3EX8MQqA CXxvHUNkOA3BPYBEmRRgTdY5m2JeIcVU48UM0wQoA7cgTzptedTKPGsgnitR01ak5hVB LkMsOUZpkHoOLaQha2zPeUKuF2wnWzsym3NnVLugtiPoZoOzNHiFAoCBxulgSmD14XhX 4AVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="clj8/EnV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a056402254c00b0044874cf4c88si11086541edb.430.2022.09.06.07.57.49; Tue, 06 Sep 2022 07:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="clj8/EnV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240690AbiIFNh0 (ORCPT + 99 others); Tue, 6 Sep 2022 09:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240528AbiIFNgZ (ORCPT ); Tue, 6 Sep 2022 09:36:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27D47B7BC; Tue, 6 Sep 2022 06:34:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81053B81636; Tue, 6 Sep 2022 13:34:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C55E3C433C1; Tue, 6 Sep 2022 13:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471256; bh=a0Oh2+r2ZpUsTaywTZ45wAtVLyD7WgYrX2a1zBm5naI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=clj8/EnVWtzJaCnhNyLQJbGqfZWjtxJcs1sdiTb2SBiEkrq5C0AZcpHYAsKNAMhgs 64xf0EkxpYBeTyg4EuOo/fLzi3/29tC0XsIldIUEYGOJQHKXu+6lW2XSpauqYaobnO JC9sfjGZ/rUo6gFYmhnQ/nfroggQMsbSKwZ5o7AE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , SeongJae Park , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [PATCH 5.10 48/80] xen-blkfront: Advertise feature-persistent as user requested Date: Tue, 6 Sep 2022 15:30:45 +0200 Message-Id: <20220906132819.016040100@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132816.936069583@linuxfoundation.org> References: <20220906132816.936069583@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: SeongJae Park commit 9f5e0fe5d05f7e8de7f39b2b10089834eb0ff787 upstream. The advertisement of the persistent grants feature (writing 'feature-persistent' to xenbus) should mean not the decision for using the feature but only the availability of the feature. However, commit 74a852479c68 ("xen-blkfront: add a parameter for disabling of persistent grants") made a field of blkfront, which was a place for saving only the negotiation result, to be used for yet another purpose: caching of the 'feature_persistent' parameter value. As a result, the advertisement, which should follow only the parameter value, becomes inconsistent. This commit fixes the misuse of the semantic by making blkfront saves the parameter value in a separate place and advertises the support based on only the saved value. Fixes: 74a852479c68 ("xen-blkfront: add a parameter for disabling of persistent grants") Cc: # 5.10.x Suggested-by: Juergen Gross Signed-off-by: SeongJae Park Tested-by: Marek Marczykowski-Górecki Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220831165824.94815-3-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/block/xen-blkfront.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -211,6 +211,9 @@ struct blkfront_info unsigned int feature_fua:1; unsigned int feature_discard:1; unsigned int feature_secdiscard:1; + /* Connect-time cached feature_persistent parameter */ + unsigned int feature_persistent_parm:1; + /* Persistent grants feature negotiation result */ unsigned int feature_persistent:1; unsigned int bounce:1; unsigned int discard_granularity; @@ -1941,7 +1944,7 @@ again: goto abort_transaction; } err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", - info->feature_persistent); + info->feature_persistent_parm); if (err) dev_warn(&dev->dev, "writing persistent grants feature to xenbus"); @@ -2391,7 +2394,8 @@ static void blkfront_gather_backend_feat if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) blkfront_setup_discard(info); - if (feature_persistent) + info->feature_persistent_parm = feature_persistent; + if (info->feature_persistent_parm) info->feature_persistent = !!xenbus_read_unsigned(info->xbdev->otherend, "feature-persistent", 0);