Skip to content

Commit b7c18b1

Browse files
johnpgarryMikulas Patocka
authored andcommitted
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: 3194e36 ("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>
1 parent 7734fb4 commit b7c18b1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/md/dm-table.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,12 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
430430
return 0;
431431
}
432432

433+
/*
434+
* BLK_FEAT_ATOMIC_WRITES is not inherited from the bottom device in
435+
* blk_stack_limits(), so do it manually.
436+
*/
437+
limits->features |= (q->limits.features & BLK_FEAT_ATOMIC_WRITES);
438+
433439
mutex_lock(&q->limits_lock);
434440
if (blk_stack_limits(limits, &q->limits,
435441
get_start_sect(bdev) + start) < 0)

0 commit comments

Comments
 (0)