Skip to content

Commit e94c610

Browse files
heynemaxjgross1
authored andcommitted
xen-blkback: Apply 'feature_persistent' parameter when connect
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 aac8a70 ("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 <andrii.chepurnyi82@gmail.com> Fixes: aac8a70 ("xen-blkback: add a parameter for disabling of persistent grants") Cc: <stable@vger.kernel.org> # 5.10.x Signed-off-by: Maximilian Heyne <mheyne@amazon.de> Signed-off-by: SeongJae Park <sj@kernel.org> Reviewed-by: Maximilian Heyne <mheyne@amazon.de> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/20220715225108.193398-3-sj@kernel.org Signed-off-by: Juergen Gross <jgross@suse.com>
1 parent fc9be61 commit e94c610

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

Documentation/ABI/testing/sysfs-driver-xen-blkback

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ KernelVersion: 5.10
4242
Contact: Maximilian Heyne <mheyne@amazon.de>
4343
Description:
4444
Whether to enable the persistent grants feature or not. Note
45-
that this option only takes effect on newly created backends.
45+
that this option only takes effect on newly connected backends.
4646
The default is Y (enable).

drivers/block/xen-blkback/xenbus.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
186186
__module_get(THIS_MODULE);
187187
INIT_WORK(&blkif->free_work, xen_blkif_deferred_free);
188188

189-
blkif->vbd.feature_gnt_persistent = feature_persistent;
190-
191189
return blkif;
192190
}
193191

@@ -1086,10 +1084,9 @@ static int connect_ring(struct backend_info *be)
10861084
xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol);
10871085
return -ENOSYS;
10881086
}
1089-
if (blkif->vbd.feature_gnt_persistent)
1090-
blkif->vbd.feature_gnt_persistent =
1091-
xenbus_read_unsigned(dev->otherend,
1092-
"feature-persistent", 0);
1087+
1088+
blkif->vbd.feature_gnt_persistent = feature_persistent &&
1089+
xenbus_read_unsigned(dev->otherend, "feature-persistent", 0);
10931090

10941091
blkif->vbd.overflow_max_grants = 0;
10951092

0 commit comments

Comments
 (0)