From nobody Mon Sep 29 21:08:05 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13B71C25B0D for ; Tue, 16 Aug 2022 01:07:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349037AbiHPBGD (ORCPT ); Mon, 15 Aug 2022 21:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343840AbiHPBAj (ORCPT ); Mon, 15 Aug 2022 21:00:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAF38DC5CE; Mon, 15 Aug 2022 13:50: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 7068761239; Mon, 15 Aug 2022 20:50:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DC96C433C1; Mon, 15 Aug 2022 20:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596606; bh=9A2XWCyoyd5osQJFkDNBNk37/0qaeKVUswL7IL5Xfdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YyNh0mH3jrrI/qgxi2veBxN0Yl3i5g62XQ0iVSM2L3rhZEQmeisAvqzcdswxSWG5s cMXw03Mjf49xkGUX3kOBbtPkMqUUSN6nFBl25+s0AmO3BMrzPCvLQJa0UL9oc1cr3z gdbITgOW5IAF3S1L1F5pjHY2rEeCQsDuI9Hv29E4= 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.19 1134/1157] xen-blkback: Apply feature_persistent parameter when connect Date: Mon, 15 Aug 2022 20:08:10 +0200 Message-Id: <20220815180525.786014982@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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=3Dv-pwJB7-_ZRHPxHz= KRJZ22xEPW7z8a=3Dg@mail.gmail.com/ Reported-by: Andrii Chepurnyi Fixes: aac8a70db24b ("xen-blkback: add a parameter for disabling of persist= ent 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: Maximilian Heyne Description: Whether to enable the persistent grants feature or not. N= ote - that this option only takes effect on newly created backen= ds. + that this option only takes effect on newly connected back= ends. 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); =20 - blkif->vbd.feature_gnt_persistent =3D feature_persistent; - return blkif; } =20 @@ -1086,10 +1084,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 =3D - xenbus_read_unsigned(dev->otherend, - "feature-persistent", 0); + + blkif->vbd.feature_gnt_persistent =3D feature_persistent && + xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); =20 blkif->vbd.overflow_max_grants =3D 0;