Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2887207rwb; Mon, 15 Aug 2022 13:20:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR6sly7JeW9F4NeJ5WxUwPqsVP96h7ooY1dOsTvrj2oexi7pmp6GDGcfy4IpzRMJWsKIT/bz X-Received: by 2002:a05:6402:248a:b0:440:9709:df09 with SMTP id q10-20020a056402248a00b004409709df09mr15788141eda.42.1660594809280; Mon, 15 Aug 2022 13:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594809; cv=none; d=google.com; s=arc-20160816; b=dxXwwxgjNAqer2dIffY2BrM1s6QZzKUHft9HPtvHdxYK0E3WyNLNpQ2EfvFLIt+KuU wbAXsqOmExg6swnCQl18upDqJCKtKy6yPTKg9o0RX5SrXx+wzwvcmmTy/SxVffOQEmVW 1l7mpS81KuNaI+MAdnX5aOn972cpUo6dmr9ikRxkDzfdWQRkWvQcvsuGDjV1AdDlUAIR pdsynsaCdO0BtuzF2hQihP/1LVO9jeJooI/Pzil43ksYDRH9PRpnFmzKGUi0GHoyeY/g D3sfhXvG2zFihbal0ozNWORPGDU9jnGb2l9DkeBEmYMxQMyChrNoyzngXlkWudQdOXbH sk8g== 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=iO0FzaqgHisTvHX2bk2SaoG7RxCW6SmEdqW0OZeYC/E=; b=ybIUHwxwrkOM7/5OPoAcapE3iP2YhoXuspAxkrq1IuZjSb3Lk+hadcsBG+4/SegVk4 CZKfTFwxU70FuAasdmU0plu8Y5V1NvmPR0nHoXZmbrmKxJCDGR3AHwLNdax0C7iU0NPT zJ1QzpF+V+8AfW7pJJ5ll5sNhlC10Dt9+5EtnA4EGLyN9unexmeHQXJl0IwxHXhmsjt8 D9vSxNr5abFC7Z0iiaswzENVPiTQQ2HDAdnrj5eU5aTSRZC+BR91IMwmic50YEQTd75C n3OhK0KRxuH9JPCoZcOBbgOySrL+KOUvpn4R84UZfjAUG2yYQScY7xNyGbFd9vAgosOV tv6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xbqIpywI; 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 e14-20020a056402190e00b0043e8dd308a6si10496835edz.8.2022.08.15.13.19.41; Mon, 15 Aug 2022 13:20:09 -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=xbqIpywI; 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 S1345808AbiHOT7B (ORCPT + 99 others); Mon, 15 Aug 2022 15:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346018AbiHOT4z (ORCPT ); Mon, 15 Aug 2022 15:56:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1455A78209; Mon, 15 Aug 2022 11:52:48 -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 60D82B8105D; Mon, 15 Aug 2022 18:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B2F0C433D6; Mon, 15 Aug 2022 18:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589566; bh=unY1VYk0+hldZ4DhLs3vctXkk1Ytvke2vPTh8XgIwj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xbqIpywIczTc66V9ID0gkd/cxkwXelvbEcovPO18gKOu9QpmWI5EnlcqbaMPAUVNA rkfJ+5zxj1XzRZ9Y5jewOSG6TSErIZobyeYTuoCocw6Ih17TEN+9sKY5wk8O4e4Kox 1zSRqtKeY+og1/GtJWPf53fLJy4gqpUkZ5xpUjlg= 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.15 757/779] xen-blkback: Apply feature_persistent parameter when connect Date: Mon, 15 Aug 2022 20:06:41 +0200 Message-Id: <20220815180409.816622620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 @@ -185,8 +185,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; } @@ -1089,10 +1087,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;