Commit ed6b2ab2 authored by SeongJae Park's avatar SeongJae Park Committed by Zheng Zengkai
Browse files

xen-blkfront: Apply 'feature_persistent' parameter when connect

stable inclusion
from stable-v5.10.137
commit 135d9e0710992db7ffa43bd248600f5a2bc7db3c
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=135d9e0710992db7ffa43bd248600f5a2bc7db3c

--------------------------------

commit 402c43ea 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 aac8a70d ("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.

Similar behavioral change has made on 'blkfront' by commit 74a85247
("xen-blkfront: add a parameter for disabling of persistent grants").
This commit changes the behavior of the parameter to make effect for
every connect, so that the previous behavior of 'blkfront' can be
restored.

[1] https://lore.kernel.org/xen-devel/CAJwUmVB6H3iTs-C+U=v-pwJB7-_ZRHPxHzKRJZ22xEPW7z8a=g@mail.gmail.com/



Fixes: 74a85247 ("xen-blkfront: add a parameter for disabling of persistent grants")
Cc: <stable@vger.kernel.org> # 5.10.x
Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
Reviewed-by: default avatarMaximilian Heyne <mheyne@amazon.de>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20220715225108.193398-4-sj@kernel.org


Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
parent 1ad0e3e6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -15,5 +15,5 @@ KernelVersion: 5.10
Contact:        SeongJae Park <sjpark@amazon.de>
Description:
                Whether to enable the persistent grants feature or not.  Note
                that this option only takes effect on newly created frontends.
                that this option only takes effect on newly connected frontends.
                The default is Y (enable).
+1 −3
Original line number Diff line number Diff line
@@ -2088,8 +2088,6 @@ static int blkfront_probe(struct xenbus_device *dev,
	info->vdevice = vdevice;
	info->connected = BLKIF_STATE_DISCONNECTED;

	info->feature_persistent = feature_persistent;

	/* Front end dir is a number, which is used as the id. */
	info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
	dev_set_drvdata(&dev->dev, info);
@@ -2393,7 +2391,7 @@ static void blkfront_gather_backend_features(struct blkfront_info *info)
	if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0))
		blkfront_setup_discard(info);

	if (info->feature_persistent)
	if (feature_persistent)
		info->feature_persistent =
			!!xenbus_read_unsigned(info->xbdev->otherend,
					       "feature-persistent", 0);