linux-next: manual merge of the device-mapper tree with the block tree

Stephen Rothwell posted 1 patch 2 months, 2 weeks ago
linux-next: manual merge of the device-mapper tree with the block tree
Posted by Stephen Rothwell 2 months, 2 weeks ago
Hi all,

Today's linux-next merge of the device-mapper tree got a conflict in:

  drivers/md/dm-stripe.c

between commit:

  5fb9d4341b78 ("dm-stripe: limit chunk_sectors to the stripe size")

from the block tree and commit:

  846e9e999dd3 ("dm-stripe: fix a possible integer overflow")

from the device-mapper tree.

I fixed it up (I think - see below) and can carry the fix as necessary.
This is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/md/dm-stripe.c
index 58902091bf79,984f53a42bf0..000000000000
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@@ -456,11 -456,13 +456,14 @@@ static void stripe_io_hints(struct dm_t
  			    struct queue_limits *limits)
  {
  	struct stripe_c *sc = ti->private;
- 	unsigned int chunk_size = sc->chunk_size << SECTOR_SHIFT;
+ 	unsigned int io_min, io_opt;
  
- 	limits->chunk_sectors = sc->chunk_size;
- 	limits->io_min = chunk_size;
- 	limits->io_opt = chunk_size * sc->stripes;
+ 	if (!check_shl_overflow(sc->chunk_size, SECTOR_SHIFT, &io_min) &&
+ 	    !check_mul_overflow(io_min, sc->stripes, &io_opt)) {
++		limits->chunk_sectors = sc->chunk_size;
+ 		limits->io_min = io_min;
+ 		limits->io_opt = io_opt;
+ 	}
  }
  
  static struct target_type stripe_target = {
Re: linux-next: manual merge of the device-mapper tree with the block tree
Posted by John Garry 2 months, 2 weeks ago
On 18/07/2025 06:10, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the device-mapper tree got a conflict in:
> 
>    drivers/md/dm-stripe.c
> 
> between commit:
> 
>    5fb9d4341b78 ("dm-stripe: limit chunk_sectors to the stripe size")
> 
> from the block tree and commit:
> 
>    846e9e999dd3 ("dm-stripe: fix a possible integer overflow")
> 
> from the device-mapper tree.
> 
> I fixed it up (I think - see below) and can carry the fix as necessary.
> This is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 

I think that this is the proper merge resolution:

static void stripe_io_hints(struct dm_target *ti,
     struct queue_limits *limits)
{
	struct stripe_c *sc = ti->private;
	unsigned int io_min, io_opt;

	if (!check_shl_overflow(sc->chunk_size, SECTOR_SHIFT, &io_min) && 
!check_mul_overflow(io_min, sc->stripes, &io_opt)) {
		limits->io_min = io_min;
		limits->io_opt = io_opt;
	}
	limits->chunk_sectors = sc->chunk_size;
}


For purpose of atomic writes, we should always set chunk_sectors.

BTW, I tried to apply the conflicting patches from the block tree on 
-next from 17 July, and I was getting strange behaviour:

# vgcreate vg00 /dev/sda /dev/sdb /dev/sdc /dev/sdd
  WARNING: Unknown logical_block_size for device /dev/sda.
  WARNING: Unknown logical_block_size for device /dev/sdb.
  WARNING: Unknown logical_block_size for device /dev/sdc.
  WARNING: Unknown logical_block_size for device /dev/sdd.
  Physical volume "/dev/sda" successfully created.
  Physical volume "/dev/sdb" successfully created.
  Physical volume "/dev/sdc" successfully created.
  Physical volume "/dev/sdd" successfully created.
  Volume group "vg00" successfully created
#

I had no such problem on Jens' block for-6.17 tree.

Thanks,
John
Re: linux-next: manual merge of the device-mapper tree with the block tree
Posted by Stephen Rothwell 2 months, 2 weeks ago
Hi John,

On Fri, 18 Jul 2025 09:26:57 +0100 John Garry <john.g.garry@oracle.com> wrote:
>
> I think that this is the proper merge resolution:
> 
> static void stripe_io_hints(struct dm_target *ti,
>      struct queue_limits *limits)
> {
> 	struct stripe_c *sc = ti->private;
> 	unsigned int io_min, io_opt;
> 
> 	if (!check_shl_overflow(sc->chunk_size, SECTOR_SHIFT, &io_min) && !check_mul_overflow(io_min, sc->stripes, &io_opt)) {
> 		limits->io_min = io_min;
> 		limits->io_opt = io_opt;
> 	}
> 	limits->chunk_sectors = sc->chunk_size;
> }
> 
> 
> For purpose of atomic writes, we should always set chunk_sectors.

OK, I have changed my resolution to that starting from Monday.

> BTW, I tried to apply the conflicting patches from the block tree on -next from 17 July, and I was getting strange behaviour:
> 
> # vgcreate vg00 /dev/sda /dev/sdb /dev/sdc /dev/sdd
>   WARNING: Unknown logical_block_size for device /dev/sda.
>   WARNING: Unknown logical_block_size for device /dev/sdb.
>   WARNING: Unknown logical_block_size for device /dev/sdc.
>   WARNING: Unknown logical_block_size for device /dev/sdd.
>   Physical volume "/dev/sda" successfully created.
>   Physical volume "/dev/sdb" successfully created.
>   Physical volume "/dev/sdc" successfully created.
>   Physical volume "/dev/sdd" successfully created.
>   Volume group "vg00" successfully created
> #
> 
> I had no such problem on Jens' block for-6.17 tree.

I have no idea what caused that, sorry.

-- 
Cheers,
Stephen Rothwell