linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "dm raid: remove unnecessary discard limits for raid10"
@ 2020-12-09 21:58 Song Liu
  2020-12-09 22:36 ` Mike Snitzer
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Song Liu @ 2020-12-09 21:58 UTC (permalink / raw)
  To: linux-raid, linux-kernel, dm-devel
  Cc: Song Liu, Matthew Ruffell, Xiao Ni, Mike Snitzer

This reverts commit f0e90b6c663a7e3b4736cb318c6c7c589f152c28.

Matthew Ruffell reported data corruption in raid10 due to the changes
in discard handling [1]. Revert these changes before we find a proper fix.

[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1907262/
Cc: Matthew Ruffell <matthew.ruffell@canonical.com>
Cc: Xiao Ni <xni@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
---
 drivers/md/dm-raid.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 9c1f7c4de65b3..dc8568ab96f24 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -3728,6 +3728,17 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
 
 	blk_limits_io_min(limits, chunk_size_bytes);
 	blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs));
+
+	/*
+	 * RAID10 personality requires bio splitting,
+	 * RAID0/1/4/5/6 don't and process large discard bios properly.
+	 */
+	if (rs_is_raid10(rs)) {
+		limits->discard_granularity = max(chunk_size_bytes,
+						  limits->discard_granularity);
+		limits->max_discard_sectors = min_not_zero(rs->md.chunk_sectors,
+							   limits->max_discard_sectors);
+	}
 }
 
 static void raid_postsuspend(struct dm_target *ti)
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Revert "dm raid: remove unnecessary discard limits for raid10"
  2020-12-09 21:58 [PATCH] Revert "dm raid: remove unnecessary discard limits for raid10" Song Liu
@ 2020-12-09 22:36 ` Mike Snitzer
  2020-12-09 23:14   ` Song Liu
  2020-12-09 22:38 ` Mike Snitzer
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Mike Snitzer @ 2020-12-09 22:36 UTC (permalink / raw)
  To: Song Liu, axboe
  Cc: linux-raid, linux-kernel, dm-devel, Matthew Ruffell, Xiao Ni

On Wed, Dec 09 2020 at  4:58pm -0500,
Song Liu <songliubraving@fb.com> wrote:

> This reverts commit f0e90b6c663a7e3b4736cb318c6c7c589f152c28.
> 
> Matthew Ruffell reported data corruption in raid10 due to the changes
> in discard handling [1]. Revert these changes before we find a proper fix.
> 
> [1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1907262/
> Cc: Matthew Ruffell <matthew.ruffell@canonical.com>
> Cc: Xiao Ni <xni@redhat.com>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Signed-off-by: Song Liu <songliubraving@fb.com>

If you're reverting all the MD code that enabled this DM change, then
obviously the DM change must be reverted too.  But please do _not_
separate the DM revert from the MD reverts.

Please include this in a v2 pull request to Jens.

Mike

> ---
>  drivers/md/dm-raid.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
> index 9c1f7c4de65b3..dc8568ab96f24 100644
> --- a/drivers/md/dm-raid.c
> +++ b/drivers/md/dm-raid.c
> @@ -3728,6 +3728,17 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
>  
>  	blk_limits_io_min(limits, chunk_size_bytes);
>  	blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs));
> +
> +	/*
> +	 * RAID10 personality requires bio splitting,
> +	 * RAID0/1/4/5/6 don't and process large discard bios properly.
> +	 */
> +	if (rs_is_raid10(rs)) {
> +		limits->discard_granularity = max(chunk_size_bytes,
> +						  limits->discard_granularity);
> +		limits->max_discard_sectors = min_not_zero(rs->md.chunk_sectors,
> +							   limits->max_discard_sectors);
> +	}
>  }
>  
>  static void raid_postsuspend(struct dm_target *ti)
> -- 
> 2.24.1
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Revert "dm raid: remove unnecessary discard limits for raid10"
  2020-12-09 21:58 [PATCH] Revert "dm raid: remove unnecessary discard limits for raid10" Song Liu
  2020-12-09 22:36 ` Mike Snitzer
@ 2020-12-09 22:38 ` Mike Snitzer
  2020-12-10  4:09 ` [PATCH] " kernel test robot
  2020-12-10  5:33 ` kernel test robot
  3 siblings, 0 replies; 6+ messages in thread
From: Mike Snitzer @ 2020-12-09 22:38 UTC (permalink / raw)
  To: Song Liu, axboe
  Cc: linux-raid, linux-kernel, dm-devel, Matthew Ruffell, Xiao Ni

On Wed, Dec 09 2020 at  4:58pm -0500,
Song Liu <songliubraving@fb.com> wrote:

> This reverts commit f0e90b6c663a7e3b4736cb318c6c7c589f152c28.
> 
> Matthew Ruffell reported data corruption in raid10 due to the changes
> in discard handling [1]. Revert these changes before we find a proper fix.
> 
> [1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1907262/
> Cc: Matthew Ruffell <matthew.ruffell@canonical.com>
> Cc: Xiao Ni <xni@redhat.com>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  drivers/md/dm-raid.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
> index 9c1f7c4de65b3..dc8568ab96f24 100644
> --- a/drivers/md/dm-raid.c
> +++ b/drivers/md/dm-raid.c
> @@ -3728,6 +3728,17 @@ static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
>  
>  	blk_limits_io_min(limits, chunk_size_bytes);
>  	blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs));
> +
> +	/*
> +	 * RAID10 personality requires bio splitting,
> +	 * RAID0/1/4/5/6 don't and process large discard bios properly.
> +	 */
> +	if (rs_is_raid10(rs)) {
> +		limits->discard_granularity = max(chunk_size_bytes,
> +						  limits->discard_granularity);
> +		limits->max_discard_sectors = min_not_zero(rs->md.chunk_sectors,
> +							   limits->max_discard_sectors);
> +	}
>  }
>  
>  static void raid_postsuspend(struct dm_target *ti)
> -- 
> 2.24.1
> 

Short of you sending a v2 pull request to Jens...

Jens please pick this up once you pull Song's MD pull that reverts all
the MD raid10 discard changes.

Thanks!

Acked-by: Mike Snitzer <snitzer@redhat.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Revert "dm raid: remove unnecessary discard limits for raid10"
  2020-12-09 22:36 ` Mike Snitzer
@ 2020-12-09 23:14   ` Song Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Song Liu @ 2020-12-09 23:14 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: Jens Axboe, linux-raid, lkml, dm-devel, Matthew Ruffell, Xiao Ni



> On Dec 9, 2020, at 2:36 PM, Mike Snitzer <snitzer@redhat.com> wrote:
> 
> On Wed, Dec 09 2020 at  4:58pm -0500,
> Song Liu <songliubraving@fb.com> wrote:
> 
>> This reverts commit f0e90b6c663a7e3b4736cb318c6c7c589f152c28.
>> 
>> Matthew Ruffell reported data corruption in raid10 due to the changes
>> in discard handling [1]. Revert these changes before we find a proper fix.
>> 
>> [1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1907262/ 
>> Cc: Matthew Ruffell <matthew.ruffell@canonical.com>
>> Cc: Xiao Ni <xni@redhat.com>
>> Cc: Mike Snitzer <snitzer@redhat.com>
>> Signed-off-by: Song Liu <songliubraving@fb.com>
> 
> If you're reverting all the MD code that enabled this DM change, then
> obviously the DM change must be reverted too.  But please do _not_
> separate the DM revert from the MD reverts.

Good point! I should have thought about it through. 

Thanks,
Song

[...]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "dm raid: remove unnecessary discard limits for raid10"
  2020-12-09 21:58 [PATCH] Revert "dm raid: remove unnecessary discard limits for raid10" Song Liu
  2020-12-09 22:36 ` Mike Snitzer
  2020-12-09 22:38 ` Mike Snitzer
@ 2020-12-10  4:09 ` kernel test robot
  2020-12-10  5:33 ` kernel test robot
  3 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2020-12-10  4:09 UTC (permalink / raw)
  To: Song Liu, linux-raid, linux-kernel, dm-devel
  Cc: kbuild-all, Song Liu, Matthew Ruffell, Xiao Ni, Mike Snitzer

[-- Attachment #1: Type: text/plain, Size: 2602 bytes --]

Hi Song,

I love your patch! Perhaps something to improve:

[auto build test WARNING on dm/for-next]
[also build test WARNING on linux/master linus/master v5.10-rc7 next-20201209]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Song-Liu/Revert-dm-raid-remove-unnecessary-discard-limits-for-raid10/20201210-060948
base:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
config: x86_64-randconfig-s022-20201210 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-179-ga00755aa-dirty
        # https://github.com/0day-ci/linux/commit/c041d7bf65519d8a09a4193a0963fdcadcfd639b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Song-Liu/Revert-dm-raid-remove-unnecessary-discard-limits-for-raid10/20201210-060948
        git checkout c041d7bf65519d8a09a4193a0963fdcadcfd639b
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


"sparse warnings: (new ones prefixed by >>)"
>> drivers/md/dm-raid.c:3739:47: sparse: sparse: incompatible types in comparison expression (different signedness):
>> drivers/md/dm-raid.c:3739:47: sparse:    int *
>> drivers/md/dm-raid.c:3739:47: sparse:    unsigned int *

vim +3739 drivers/md/dm-raid.c

  3723	
  3724	static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
  3725	{
  3726		struct raid_set *rs = ti->private;
  3727		unsigned int chunk_size_bytes = to_bytes(rs->md.chunk_sectors);
  3728	
  3729		blk_limits_io_min(limits, chunk_size_bytes);
  3730		blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs));
  3731	
  3732		/*
  3733		 * RAID10 personality requires bio splitting,
  3734		 * RAID0/1/4/5/6 don't and process large discard bios properly.
  3735		 */
  3736		if (rs_is_raid10(rs)) {
  3737			limits->discard_granularity = max(chunk_size_bytes,
  3738							  limits->discard_granularity);
> 3739			limits->max_discard_sectors = min_not_zero(rs->md.chunk_sectors,
  3740								   limits->max_discard_sectors);
  3741		}
  3742	}
  3743	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38495 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "dm raid: remove unnecessary discard limits for raid10"
  2020-12-09 21:58 [PATCH] Revert "dm raid: remove unnecessary discard limits for raid10" Song Liu
                   ` (2 preceding siblings ...)
  2020-12-10  4:09 ` [PATCH] " kernel test robot
@ 2020-12-10  5:33 ` kernel test robot
  3 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2020-12-10  5:33 UTC (permalink / raw)
  To: Song Liu, linux-raid, linux-kernel, dm-devel
  Cc: kbuild-all, clang-built-linux, Song Liu, Matthew Ruffell,
	Xiao Ni, Mike Snitzer

[-- Attachment #1: Type: text/plain, Size: 3924 bytes --]

Hi Song,

I love your patch! Perhaps something to improve:

[auto build test WARNING on dm/for-next]
[also build test WARNING on linux/master linus/master v5.10-rc7 next-20201209]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Song-Liu/Revert-dm-raid-remove-unnecessary-discard-limits-for-raid10/20201210-060948
base:   https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
config: x86_64-randconfig-a006-20201209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1968804ac726e7674d5de22bc2204b45857da344)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/c041d7bf65519d8a09a4193a0963fdcadcfd639b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Song-Liu/Revert-dm-raid-remove-unnecessary-discard-limits-for-raid10/20201210-060948
        git checkout c041d7bf65519d8a09a4193a0963fdcadcfd639b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/md/dm-raid.c:3739:33: warning: comparison of distinct pointer types ('typeof (__x) *' (aka 'int *') and 'typeof (__y) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
                   limits->max_discard_sectors = min_not_zero(rs->md.chunk_sectors,
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:84:39: note: expanded from macro 'min_not_zero'
           __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
                                                ^~~~~~~~~~~~~
   include/linux/minmax.h:51:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:42:24: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                 ^~~~~~~~~~~~~~~~
   include/linux/minmax.h:32:4: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                    ^~~~~~~~~~~~~~~~~
   include/linux/minmax.h:18:28: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   1 warning generated.

vim +3739 drivers/md/dm-raid.c

  3723	
  3724	static void raid_io_hints(struct dm_target *ti, struct queue_limits *limits)
  3725	{
  3726		struct raid_set *rs = ti->private;
  3727		unsigned int chunk_size_bytes = to_bytes(rs->md.chunk_sectors);
  3728	
  3729		blk_limits_io_min(limits, chunk_size_bytes);
  3730		blk_limits_io_opt(limits, chunk_size_bytes * mddev_data_stripes(rs));
  3731	
  3732		/*
  3733		 * RAID10 personality requires bio splitting,
  3734		 * RAID0/1/4/5/6 don't and process large discard bios properly.
  3735		 */
  3736		if (rs_is_raid10(rs)) {
  3737			limits->discard_granularity = max(chunk_size_bytes,
  3738							  limits->discard_granularity);
> 3739			limits->max_discard_sectors = min_not_zero(rs->md.chunk_sectors,
  3740								   limits->max_discard_sectors);
  3741		}
  3742	}
  3743	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34835 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-10  5:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 21:58 [PATCH] Revert "dm raid: remove unnecessary discard limits for raid10" Song Liu
2020-12-09 22:36 ` Mike Snitzer
2020-12-09 23:14   ` Song Liu
2020-12-09 22:38 ` Mike Snitzer
2020-12-10  4:09 ` [PATCH] " kernel test robot
2020-12-10  5:33 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).