Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1878776rwb; Fri, 19 Aug 2022 10:57:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR7IqXRyGaoozR8y7QJmRycUhlR5to0RaXHmP2JSScqh+kXNPLu5uOP/0t6Td+fWDT2ptWtF X-Received: by 2002:aa7:db5a:0:b0:446:62:922a with SMTP id n26-20020aa7db5a000000b004460062922amr7031936edt.373.1660931836788; Fri, 19 Aug 2022 10:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660931836; cv=none; d=google.com; s=arc-20160816; b=fQkd1ckD6xMDzEwgUkjI1ANzjrQs15ACf4kqbqRTPERC37z3PqLgUo5FAKcFNIv4bv vD9vLcQ18bThVv5mvk9/LnSYzaIxfnuyDNujcUW/hJxy5rtyKpol3EIAoesaPWjC2A8w mIH85EZRxExSZWloAT5xd18GB/+X1jPDGW3uXqR0BZtk7jaopCJ9qN/HKF+AMYIhIQrm MQqxSShVyvGlf+x1HwJtkOw7ITDcAp0MYdZuuWCHhDzPWuxq2DKT8afQImHEkVliMAPn 2dT1Z6i/nIbGQZe+oLHOxLr6Yik3EzQhczKJYMGBoWTAuMVC0hV2PPGJBQxj/v+B5kOJ iZng== 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=4wRlkE8HXe2ChFjlQduB5gLnOnEjEUhoK+jIhGvG0u8=; b=G6IDCGqZiTTSKpsEfgZ7iWd4/K0Qb4UD/CADDlbRwd86bICah0w4LXPBOblSgazDg2 hG8yEiyeYy/05flIwyKx9XCCFRuOI14/LBO68NsplM6L+gl9mfzU0ZyNbG6S6iemeOwU /wVq7ezz77Za8FQ6ewjdLu2rbC2YtUQYP74iH0mDoq4N3obeFgGedvPde3ahlOhNJPS5 i1M01597ZYaowW9IoQBdXjK9fC4F9/+hmDH3AfVhN27DQHKXx/I5oHZf1M33SssI+c+O G4m3ad5NfzxTsp2g4AUSzQFWCiEIIW0SJyhWt88ABE/1gyDRHukDVQQLwhhvF1nDxxFt GnjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b3dwE4+a; 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 dm2-20020a170907948200b00730fdb36019si3577449ejc.21.2022.08.19.10.56.51; Fri, 19 Aug 2022 10:57:16 -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=b3dwE4+a; 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 S1354337AbiHSQwn (ORCPT + 99 others); Fri, 19 Aug 2022 12:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354518AbiHSQvI (ORCPT ); Fri, 19 Aug 2022 12:51:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5CA6D8E24; Fri, 19 Aug 2022 09:14:02 -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 05A4FB82824; Fri, 19 Aug 2022 16:13:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ECD5C433C1; Fri, 19 Aug 2022 16:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925593; bh=we86j3RT/2hs2MMR1fPjFUQ1s8lZ+1GT3C9CJeRZlN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b3dwE4+agcE5Y0BKyPxktSAoSfHLmEdzhBUGOZbOf2PVkvyVOdRPloIufrQlTAApC cFT0tng4SP5cmYnRbS3BpEykDJMndlIMZMzpobV+b3RyF9pEkxK6BMKGrGgrdAzWW3 gHBKuMAtDWVmOIg+wSz8jEP2jTgmeX5eVQAHfMKE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Chepurnyi , Maximilian Heyne , SeongJae Park , Juergen Gross Subject: [PATCH 5.10 511/545] xen-blkback: Apply feature_persistent parameter when connect Date: Fri, 19 Aug 2022 17:44:41 +0200 Message-Id: <20220819153852.357084367@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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: Maximilian Heyne commit e94c6101e151b019b8babc518ac2a6ada644a5a1 upstream. In some use cases[1], the backend is created while the frontend doesn't support the persistent grants feature, but later the frontend can be changed to support the feature and reconnect. In the past, 'blkback' enabled the persistent grants feature since it unconditionally checked if frontend supports the persistent grants feature for every connect ('connect_ring()') and decided whether it should use persistent grans or not. However, commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has mistakenly changed the behavior. It made the frontend feature support check to not be repeated once it shown the 'feature_persistent' as 'false', or the frontend doesn't support persistent grants. This commit changes the behavior of the parameter to make effect for every connect, so that the previous workflow can work again as expected. [1] https://lore.kernel.org/xen-devel/CAJwUmVB6H3iTs-C+U=v-pwJB7-_ZRHPxHzKRJZ22xEPW7z8a=g@mail.gmail.com/ Reported-by: Andrii Chepurnyi Fixes: aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") Cc: # 5.10.x Signed-off-by: Maximilian Heyne Signed-off-by: SeongJae Park Reviewed-by: Maximilian Heyne Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220715225108.193398-3-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-driver-xen-blkback | 2 +- drivers/block/xen-blkback/xenbus.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) --- a/Documentation/ABI/testing/sysfs-driver-xen-blkback +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkback @@ -42,5 +42,5 @@ KernelVersion: 5.10 Contact: SeongJae Park Description: Whether to enable the persistent grants feature or not. Note - that this option only takes effect on newly created backends. + that this option only takes effect on newly connected backends. The default is Y (enable). --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -186,8 +186,6 @@ static struct xen_blkif *xen_blkif_alloc __module_get(THIS_MODULE); INIT_WORK(&blkif->free_work, xen_blkif_deferred_free); - blkif->vbd.feature_gnt_persistent = feature_persistent; - return blkif; } @@ -1090,10 +1088,9 @@ static int connect_ring(struct backend_i xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); return -ENOSYS; } - if (blkif->vbd.feature_gnt_persistent) - blkif->vbd.feature_gnt_persistent = - xenbus_read_unsigned(dev->otherend, - "feature-persistent", 0); + + blkif->vbd.feature_gnt_persistent = feature_persistent && + xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); blkif->vbd.overflow_max_grants = 0;