Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4485956rwb; Tue, 6 Sep 2022 08:10:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR5+h2/KMM/0a7YfRq2PYEYqqeIYaU3vXzl/RsgJZeJb6RtpIf3FEtxuG45wLQFQfRPZzw6P X-Received: by 2002:a05:6402:cbc:b0:448:95be:397 with SMTP id cn28-20020a0564020cbc00b0044895be0397mr32882226edb.417.1662477024785; Tue, 06 Sep 2022 08:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662477024; cv=none; d=google.com; s=arc-20160816; b=PEkeg1cpVtodpQUuppp3SZzEKRGiV1varEKkg0mggDFSDt8OidX/FuVt8dHnB2O1I3 PWcPbMdMc/evrqPCPQZNudvP5uavHrl2jwG9W7IBPf0Pc+sMtGz+gHyr71Ym+Io9HJ4L qutAL+OPJReNJkZlR8oTBDijctRW1gvEJoFrmKJ6f9asx/7p0lQbx1+o6lKH4iSDfkZh 7gq0XouZULI8JswrEsu94lh6Fj8nv8VMzRmnLFtgYIwW3m58/l/K91Mep1F4Gjmrxyaz 0KTfvxdGDIKRtteRc2AeRhQrj+4anXhsZcdpcsMZoHKqCHdsiHoxc5PuBDusNkhgxODv 9/KQ== 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=ZhCB1p3tj6aJrSTwIQpAzGR7U/aHpW4zstj5dV9kXb8=; b=C1dQkpyyK0LTkJ2FMpCKjeCUOtLJR81MGV47Je8Ovit+zGhjzmv/rHy6yw6Or9B8dl geP7Ret25pOC1P0mKcr2EUK27QjEyEup5whER72AcnbVwudGxJ6pZ8EPy5KwfziW7YOF xDWLxZCUeXHzt2FngboVSYxWP+dDImudwOOJbJz93BjNUq6Zit/3dykY8rz7YMEnw5I7 gf+MGaxiXdlk3p+oGauPnDWi2zwDYnX/mrgtONBflfB4cvS2/ssIOUcX7YbAZb2CBemc 2Uk98K4ITayRp806nro3UL7eDIGGJmKg7ycKUEFJHsORDO+2OPe7dKwtM2uUry5JCtl5 rZag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w2UCcRxq; 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 i16-20020a1709064fd000b0076daf135b26si4111207ejw.791.2022.09.06.08.10.00; Tue, 06 Sep 2022 08:10: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=w2UCcRxq; 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 S241460AbiIFORZ (ORCPT + 99 others); Tue, 6 Sep 2022 10:17:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241858AbiIFOOW (ORCPT ); Tue, 6 Sep 2022 10:14:22 -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 D8766895E2; Tue, 6 Sep 2022 06:48:56 -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 A2B2FB818D8; Tue, 6 Sep 2022 13:47:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02F39C4314A; Tue, 6 Sep 2022 13:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662472059; bh=hVj1NlibaOfVYyRPgm9/J8iF7dNXcVi9FjsmaXIIgeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w2UCcRxqEF0ff1I8ROARAlBX9XszLtgW9wRSFmNr7HgXHi9g9AHb29RvvHqAhnyv0 XYeNJWlveHA/KoT8Vdbb5G2sbtGx8oZaxdMziokzg618R6fNDZa9wHm2C+BXJU89x3 nlX3imOeVcuXAEfKGpyliw4eNGvMX6hGXWH444og= 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.19 103/155] xen-blkfront: Advertise feature-persistent as user requested Date: Tue, 6 Sep 2022 15:30:51 +0200 Message-Id: <20220906132833.806184394@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@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 9f5e0fe5d05f7e8de7f39b2b10089834eb0ff787 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 74a852479c68 ("xen-blkfront: add a parameter for disabling of persistent grants") made a field of blkfront, 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 blkfront saves the parameter value in a separate place and advertises the support based on only the saved value. Fixes: 74a852479c68 ("xen-blkfront: 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-3-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/block/xen-blkfront.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -213,6 +213,9 @@ struct blkfront_info unsigned int feature_fua:1; unsigned int feature_discard:1; unsigned int feature_secdiscard:1; + /* Connect-time cached feature_persistent parameter */ + unsigned int feature_persistent_parm:1; + /* Persistent grants feature negotiation result */ unsigned int feature_persistent:1; unsigned int bounce:1; unsigned int discard_granularity; @@ -1848,7 +1851,7 @@ again: goto abort_transaction; } err = xenbus_printf(xbt, dev->nodename, "feature-persistent", "%u", - info->feature_persistent); + info->feature_persistent_parm); if (err) dev_warn(&dev->dev, "writing persistent grants feature to xenbus"); @@ -2281,7 +2284,8 @@ static void blkfront_gather_backend_feat if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) blkfront_setup_discard(info); - if (feature_persistent) + info->feature_persistent_parm = feature_persistent; + if (info->feature_persistent_parm) info->feature_persistent = !!xenbus_read_unsigned(info->xbdev->otherend, "feature-persistent", 0);