Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4516890rwb; Tue, 6 Sep 2022 08:34:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR4tc4wzbMUQ9Y2lB7a+P2La1NFhhyTtW9yVDmyPRX+StZOzs12zCB6UDwjG59tGHCIbFa+3 X-Received: by 2002:a17:902:e843:b0:175:2f2:4d7e with SMTP id t3-20020a170902e84300b0017502f24d7emr39227470plg.83.1662478462504; Tue, 06 Sep 2022 08:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662478462; cv=none; d=google.com; s=arc-20160816; b=FI2JtOnxkpRvAzFQ+eyhLPvgvJFoIukIYCobEAvke9+TatNbQ/EB5vYl2QsEgc+RJC nXJVJz10IWx7ARHy4xqfNudyg6FfgVgIK5ggaxQDRwFqxImFzt5/S8IYPNNx7kFyo0CL MUaFIwwrTLyhSNX5LlnwgHHx99aUmxSpIrOmNG0z7QD7rwLPu+HVICYdvmzyXmCfXD2V yY3qCBfV1yDH/yE7fj7FMDGt0ghjATlo/dQ9Of2KTxh/rLBKG3bLY/5PA0kn2bNC1Q4n Td1+3iGZ8/oMnbakhHwfuBHEDANovm9E1DoY7gwO9W4KfHHBg70eV1YNTRvxJy5ZO1TX RLFw== 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=2sqgVM7xuS/bqjA8QeN1GhN51wT4eZtfgz1EpY0P+6U=; b=GKw4l8EHoKi7zG+ciB6G6dP7BDn0s0HxiUCyZZkBBXpvfLaA/NUnsf7JXnbJSek55C +yp9NTIRuefaAUSTJr+4wmA6ZXDSGkuzOvMRMQYzV3VQAtQ+wcX788+SUOiK/PA8/x+W xz3DuCX5ZTaWS3KxhX+r8kTDAPBwSq+7MtAgk/WkGbpLvUiyaUa4mh5C4/P0CxOw/F76 kxaXB8HWoK/Q1bI7OVVyNed7E5OLTM6h57MC6yWaeZbBbNOe5LyAVFDumvyqMq8fG2d5 pwh5mQRZsiNzF5/R1Ax6c5+VsfOpBLFfkHc9dmzq8f2CmlVGa4j6+AzixNAikHgzcIUo rEgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JpKKCfG9; 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 67-20020a630046000000b0043410e2d9basi9643382pga.258.2022.09.06.08.34.11; Tue, 06 Sep 2022 08:34:22 -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=JpKKCfG9; 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 S240812AbiIFNhQ (ORCPT + 99 others); Tue, 6 Sep 2022 09:37:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240736AbiIFNf6 (ORCPT ); Tue, 6 Sep 2022 09:35:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA327B1F9; Tue, 6 Sep 2022 06:34:14 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A40AB6154C; Tue, 6 Sep 2022 13:34:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAF47C43141; Tue, 6 Sep 2022 13:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471253; bh=Unvm6YalzWDic2YXkfOETJ8fzpdBmgnYX4i/izRFHJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JpKKCfG9JUmGtnl51Hp/ICa4UwQ34j+Z8XIs1LpZdSk6fKzXNW4l9N3JT7KbOtoTX 2RSICcl3HAIow9TuOrqnjJG0lpWwXZw5iCSEES30IJveLxDHsqkrd2yWZ6+wIVL0Jw yo5IVOW4m1mmYfcKAfwZmow1JTrTtsJKb2uiuc0U= 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 47/80] xen-blkback: Advertise feature-persistent as user requested Date: Tue, 6 Sep 2022 15:30:44 +0200 Message-Id: <20220906132818.966641001@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 06ba5d2e943e97bb66e75c152e87f1d2c7027a67 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 aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") made a field of blkback, 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 blkback saves the parameter value in a separate place and advertises the support based on only the saved value. Fixes: aac8a70db24b ("xen-blkback: 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-2-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/block/xen-blkback/common.h | 3 +++ drivers/block/xen-blkback/xenbus.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -226,6 +226,9 @@ struct xen_vbd { sector_t size; unsigned int flush_support:1; unsigned int discard_secure:1; + /* Connect-time cached feature_persistent parameter value */ + unsigned int feature_gnt_persistent_parm:1; + /* Persistent grants feature negotiation result */ unsigned int feature_gnt_persistent:1; unsigned int overflow_max_grants:1; }; --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -911,7 +911,7 @@ again: xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", - be->blkif->vbd.feature_gnt_persistent); + be->blkif->vbd.feature_gnt_persistent_parm); if (err) { xenbus_dev_fatal(dev, err, "writing %s/feature-persistent", dev->nodename); @@ -1089,7 +1089,9 @@ static int connect_ring(struct backend_i return -ENOSYS; } - blkif->vbd.feature_gnt_persistent = feature_persistent && + blkif->vbd.feature_gnt_persistent_parm = feature_persistent; + blkif->vbd.feature_gnt_persistent = + blkif->vbd.feature_gnt_persistent_parm && xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); blkif->vbd.overflow_max_grants = 0;