diff options
author | John Garry <john.g.garry@oracle.com> | 2025-05-04 11:26:45 +0200 |
---|---|---|
committer | Mikulas Patocka <mpatocka@redhat.com> | 2025-05-04 12:02:39 +0200 |
commit | b7c18b17a173087ce97e809cefd55e581121f19e (patch) | |
tree | a4ebc65bec2eee4e13f8ad880774ef48aefba8c1 | |
parent | 7734fb4ad98c3fdaf0fde82978ef8638195a5285 (diff) |
dm-table: Set BLK_FEAT_ATOMIC_WRITES for target queue limits
Feature flag BLK_FEAT_ATOMIC_WRITES is not being properly set for the
target queue limits, and this means that atomic writes are not being
enabled for any dm personalities.
When calling dm_set_device_limits() -> blk_stack_limits() ->
... -> blk_stack_atomic_writes_limits(), the bottom device limits
(which corresponds to intermediate target queue limits) does not have
BLK_FEAT_ATOMIC_WRITES set, and so atomic writes can never be enabled.
Typically such a flag would be inherited from the stacked device in
dm_set_device_limits() -> blk_stack_limits() via BLK_FEAT_INHERIT_MASK,
but BLK_FEAT_ATOMIC_WRITES is not inherited as it's preferred to manually
enable on a per-personality basis.
Set BLK_FEAT_ATOMIC_WRITES manually for the intermediate target queue
limits from the stacked device to get atomic writes working.
Fixes: 3194e36488e2 ("dm-table: atomic writes support")
Cc: stable@vger.kernel.org # v6.14
Signed-off-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
-rw-r--r-- | drivers/md/dm-table.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index a937e1e12482..9da5193e4ca9 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -430,6 +430,12 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, return 0; } + /* + * BLK_FEAT_ATOMIC_WRITES is not inherited from the bottom device in + * blk_stack_limits(), so do it manually. + */ + limits->features |= (q->limits.features & BLK_FEAT_ATOMIC_WRITES); + mutex_lock(&q->limits_lock); if (blk_stack_limits(limits, &q->limits, get_start_sect(bdev) + start) < 0) |