diff mbox series

[6/7] md: partially revert "md/raid6: use valid sector values to determine if an I/O should wait on the reshape"

Message ID b725da99-d649-6f1d-af82-c3e482f7f6e@redhat.com (mailing list archive)
State New, archived
Headers show
Series MD fixes for the LVM2 testsuite | expand

Commit Message

Mikulas Patocka Jan. 17, 2024, 6:22 p.m. UTC
Revert the commit c467e97f079f ("md/raid6: use valid sector values to
determine if an I/O should wait on the reshape") - it causes deadlock in
the LVM2 test shell/lvconvert-raid-reshape.sh

sysrq: Show Blocked State
task:(udev-worker)   state:D stack:0     pid:98633 tgid:98633 ppid:320    flags:0x00000006
Call Trace:
 <TASK>
 __schedule+0x213/0x550
 schedule+0x29/0xa0
 schedule_timeout+0xbe/0xd0
 ? __wake_up+0x3b/0x50
 wait_woken+0x47/0x50
 raid5_make_request+0x501/0x10e0 [raid456]
 ? swake_up_all+0xb0/0xb0
 md_handle_request+0x132/0x1e0 [md_mod]
 raid_map+0x20/0x30 [dm_raid]
 __map_bio+0x179/0x1a0 [dm_mod]
 dm_submit_bio+0x166/0x4c0 [dm_mod]
 __submit_bio+0x78/0xf0
 submit_bio_noacct_nocheck+0xb6/0x290
 mpage_readahead+0xc7/0xe0
 ? blkdev_iomap_begin+0x80/0x80
 read_pages+0x42/0x1e0
 page_cache_ra_unbounded+0x128/0x170
 force_page_cache_ra+0x8c/0xb0
 filemap_get_pages+0xf3/0x530
 ? current_time+0x16/0xc0
 filemap_read+0xb3/0x2b0
 ? sgl_alloc_order+0xf0/0x1c0
 ? dm_copy_name_and_uuid+0x6c/0x90 [dm_mod]
 ? dm_attr_uuid_show+0x1a/0x40 [dm_mod]
 ? do_wp_page+0x20c/0xaf0
 ? dm_attr_show+0x32/0x50 [dm_mod]
 ? __pte_offset_map+0x12/0x170
 blkdev_read_iter+0x62/0x140
 vfs_read+0x1a9/0x2a0
 ksys_read+0x4e/0xc0
 do_syscall_64+0x3c/0x110
 entry_SYSCALL_64_after_hwframe+0x46/0x4e
 </TASK>
task:lvm             state:D stack:0     pid:151667 tgid:151667 ppid:150522 flags:0x00000002
Call Trace:
 <TASK>
 __schedule+0x213/0x550
 schedule+0x29/0xa0
 schedule_timeout+0xbe/0xd0
 ? queue_delayed_work_on+0x1b/0x30
 ? srcu_gp_start_if_needed+0x33e/0x4a0
 wait_for_completion+0x6d/0x110
 __synchronize_srcu.part.0+0x6f/0x80
 ? get_rcu_tasks_trace_gp_kthread+0x10/0x10
 __dm_suspend+0x50/0x180 [dm_mod]
 ? table_deps+0x1b0/0x1b0 [dm_mod]
 dm_suspend+0xaf/0xd0 [dm_mod]
 dev_suspend+0x186/0x2d0 [dm_mod]
 ? table_deps+0x1b0/0x1b0 [dm_mod]
 ctl_ioctl+0x2e1/0x570 [dm_mod]
 dm_ctl_ioctl+0x5/0x10 [dm_mod]
 __x64_sys_ioctl+0x85/0xa0
 do_syscall_64+0x3c/0x110
 entry_SYSCALL_64_after_hwframe+0x46/0x4e
 </TASK>

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: c467e97f079f ("md/raid6: use valid sector values to determine if an I/O should wait on the reshape")
Cc: stable@vger.kernel.org	# v6.1+

---
 drivers/md/raid5.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Song Liu Jan. 17, 2024, 11:56 p.m. UTC | #1
On Wed, Jan 17, 2024 at 10:22 AM Mikulas Patocka <mpatocka@redhat.com> wrote:
>
[...]
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Fixes: c467e97f079f ("md/raid6: use valid sector values to determine if an I/O should wait on the reshape")
> Cc: stable@vger.kernel.org      # v6.1+
>
> ---
>  drivers/md/raid5.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6/drivers/md/raid5.c
> ===================================================================
> --- linux-2.6.orig/drivers/md/raid5.c
> +++ linux-2.6/drivers/md/raid5.c
> @@ -5851,7 +5851,7 @@ static bool stripe_ahead_of_reshape(stru
>                         continue;
>
>                 min_sector = min(min_sector, sh->dev[dd_idx].sector);
> -               max_sector = max(max_sector, sh->dev[dd_idx].sector);
> +               max_sector = min(max_sector, sh->dev[dd_idx].sector);

This looks wrong. max_sector was initialized to 0, so
min(max_sector, sh->dev[dd_idx].sector) will always be 0.

Did I miss/misread something here?

Thanks,
Song

>         }
>
>         spin_lock_irq(&conf->device_lock);
>
diff mbox series

Patch

Index: linux-2.6/drivers/md/raid5.c
===================================================================
--- linux-2.6.orig/drivers/md/raid5.c
+++ linux-2.6/drivers/md/raid5.c
@@ -5851,7 +5851,7 @@  static bool stripe_ahead_of_reshape(stru
 			continue;
 
 		min_sector = min(min_sector, sh->dev[dd_idx].sector);
-		max_sector = max(max_sector, sh->dev[dd_idx].sector);
+		max_sector = min(max_sector, sh->dev[dd_idx].sector);
 	}
 
 	spin_lock_irq(&conf->device_lock);