Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3116015rwb; Mon, 15 Aug 2022 18:30:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR4DiLMPEL3YmmRI3TXN1XoENFgoE1tY59pTYm6EXP7zKoQaS6GdUftmxxllhJevgfgIdYWF X-Received: by 2002:a05:6402:3595:b0:43d:710a:3f3f with SMTP id y21-20020a056402359500b0043d710a3f3fmr16936135edc.375.1660613424913; Mon, 15 Aug 2022 18:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613424; cv=none; d=google.com; s=arc-20160816; b=HRFVifC86M/0HdNP96Xof/Fen2GKFry9YBjmBtkcjw2pkevlWRqnUsuHN9Y0wQxhvB NRD1K7wOPFBBxM8dk2VtzBnSebfcwFX+G5ASg/t0yBMmtii9f2CccBTCHavC+sTLKwK1 qnYM2YpthP0xmF9umK9o8tp+fkZ7oBM6GLpTNyQACOe28dqIImblvVjCdYvht/HtJ/Rv xuQspM2MI8yu+1ytkG286ZncbaxFXrQWHIcuS10yGfFgeUvWnJJGHBjjyvuI1mBB0P0j pYOgSXErvR75YcAe6kCVrf7pMaXlTSMnJWbK++4OVWqU1LFActa4kTdPetr7YIoLOuHY y0Bw== 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=rfaqFdV6DMNLmu4DLBckAcoZ7QGB7NkTuA5Envoba40=; b=j/qrL0QXmTfxBgJYfuTgNf63PqKeDi/3gO4SZ47cFiQpEsOzxhJ3+u8eIlcbdDB5mN rqY3Y9uEbq151U+F+37EYIt9i8w43rwb/rK9DVfV96s4S7Xy1EF/249MJp0dQUwiC8rf xKPJlUpEQnsmhLwZoAhnzwOB2hjR1fxNPWBn+SEXb4wPTe6OfByDNXdhTWwYoORIxF1n W9199B2se/bcAAzSTLAyo0zxLrgIDRXKfcFgPizqICAPp2Zmwx7nIAG1gmglWn1OG4YD VxzRqaAehnyrx/K9A0s+6TkJGyX+FOEIpYd+V1+OKScedVrdsPu2AgsYqOmU5qUB0NEK W3uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YyNh0mH3; 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 q10-20020a056402518a00b0043bd77de21esi10107246edd.51.2022.08.15.18.29.59; Mon, 15 Aug 2022 18:30:24 -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=YyNh0mH3; 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 S1348994AbiHPBGB (ORCPT + 99 others); Mon, 15 Aug 2022 21:06:01 -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-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: Maximilian Heyne 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; } @@ -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 = - 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;