Re: [dm-devel] [PATCH -next v2 03/28] md: add new helpers to suspend/resume array

2023-09-25 Thread Xiao Ni
On Mon, Sep 25, 2023 at 3:21 PM Xiao Ni wrote: > > On Mon, Aug 28, 2023 at 10:04 AM Yu Kuai wrote: > > > > From: Yu Kuai > > > > Advantages for new apis: > > - reconfig_mutex is not required; > > - the weird logical that suspend array hold 'recon

Re: [dm-devel] [PATCH -next v2 03/28] md: add new helpers to suspend/resume array

2023-09-25 Thread Xiao Ni
On Mon, Aug 28, 2023 at 10:04 AM Yu Kuai wrote: > > From: Yu Kuai > > Advantages for new apis: > - reconfig_mutex is not required; > - the weird logical that suspend array hold 'reconfig_mutex' for >mddev_check_recovery() to update superblock is not needed; > - the specail handling, 'pers-

Re: [dm-devel] [PATCH -next v2 02/28] md: use 'mddev->suspended' for is_md_suspended()

2023-09-20 Thread Xiao Ni
On Mon, Aug 28, 2023 at 10:04 AM Yu Kuai wrote: > > From: Yu Kuai > > 'pers->prepare_suspend' is introduced to prevent a deadlock for raid456, > this change prepares to clean this up in later patches while refactoring > mddev_suspend(). Specifically allow reshape to make progress while > waiting

Re: [dm-devel] [PATCH -next v2 01/28] md: use READ_ONCE/WRITE_ONCE for 'suspend_lo' and 'suspend_hi'

2023-09-13 Thread Xiao Ni
On Mon, Aug 28, 2023 at 10:04 AM Yu Kuai wrote: > > From: Yu Kuai > > Because reading 'suspend_lo' and 'suspend_hi' from md_handle_request() > is not protected, use READ_ONCE/WRITE_ONCE to prevent reading abnormal > value. Hi Kuai If we don't use READ_ONCE/WRITE_ONCE, What's the risk here? Coul

Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

2023-06-15 Thread Xiao Ni
On Thu, Jun 15, 2023 at 5:05 PM Yu Kuai wrote: > > Hi, > > 在 2023/06/15 16:17, Xiao Ni 写道: > >> Thanks for the example. I can understand the usage of it. It's the > >> side effect that removes the mutex protection for idle_sync_thread. > >> > >&

Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

2023-06-15 Thread Xiao Ni
On Thu, Jun 15, 2023 at 4:01 PM Xiao Ni wrote: > > On Thu, Jun 15, 2023 at 9:29 AM Yu Kuai wrote: > > > > Hi, > > > > 在 2023/06/14 17:08, Xiao Ni 写道: > > > On Wed, Jun 14, 2023 at 4:29 PM Yu Kuai wrote: > > >> > > >> Hi, > > &

Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

2023-06-15 Thread Xiao Ni
On Thu, Jun 15, 2023 at 9:29 AM Yu Kuai wrote: > > Hi, > > 在 2023/06/14 17:08, Xiao Ni 写道: > > On Wed, Jun 14, 2023 at 4:29 PM Yu Kuai wrote: > >> > >> Hi, > >> > >> 在 2023/06/14 15:57, Xiao Ni 写道: > >>> On Wed, Jun 14, 2023 at 3:

Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

2023-06-14 Thread Xiao Ni
On Wed, Jun 14, 2023 at 4:29 PM Yu Kuai wrote: > > Hi, > > 在 2023/06/14 15:57, Xiao Ni 写道: > > On Wed, Jun 14, 2023 at 3:38 PM Yu Kuai wrote: > >> > >> Hi, > >> > >> 在 2023/06/14 15:12, Xiao Ni 写道: > >>> On Wed, Jun 14, 2023 at

Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

2023-06-14 Thread Xiao Ni
On Wed, Jun 14, 2023 at 3:38 PM Yu Kuai wrote: > > Hi, > > 在 2023/06/14 15:12, Xiao Ni 写道: > > On Wed, Jun 14, 2023 at 10:04 AM Yu Kuai wrote: > >> > >> Hi, > >> > >> 在 2023/06/14 9:48, Yu Kuai 写道: > >> > >>

Re: [dm-devel] [PATCH -next v2 6/6] md: enhance checking in md_check_recovery()

2023-06-14 Thread Xiao Ni
ddev->sync_thread)) + goto unlock; + md_reap_sync_thread(mddev); goto unlock; } + /* Set RUNNING before clearing NEEDED to avoid * any transients in the value of "sync_action".

Re: [dm-devel] [PATCH -next v2 5/6] md: wake up 'resync_wait' at last in md_reap_sync_thread()

2023-06-14 Thread Xiao Ni
+ wake_up(&resync_wait); } EXPORT_SYMBOL(md_reap_sync_thread); Reviewd-by: Xiao Ni -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel

Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

2023-06-14 Thread Xiao Ni
On Wed, Jun 14, 2023 at 10:04 AM Yu Kuai wrote: > > Hi, > > 在 2023/06/14 9:48, Yu Kuai 写道: > > > >> > >> In the patch, sync_seq is added in md_reap_sync_thread. In > >> idle_sync_thread, if sync_seq isn't equal > >> > >> mddev->sync_seq, it should mean there is someone that stops the sync > >> thr

Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

2023-06-13 Thread Xiao Ni
On Wed, Jun 14, 2023 at 2:05 PM Yu Kuai wrote: > > Hi, > > 在 2023/06/14 11:47, Xiao Ni 写道: > > On Wed, Jun 14, 2023 at 9:48 AM Yu Kuai wrote: > >> > >> Hi, > >> > >> 在 2023/06/13 22:50, Xiao Ni 写道: > >>> > >>> 在 2023

Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

2023-06-13 Thread Xiao Ni
On Wed, Jun 14, 2023 at 9:48 AM Yu Kuai wrote: > > Hi, > > 在 2023/06/13 22:50, Xiao Ni 写道: > > > > 在 2023/5/29 下午9:20, Yu Kuai 写道: > >> From: Yu Kuai > >> > >> Our test found a following deadlock in raid10: >

Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

2023-06-13 Thread Xiao Ni
在 2023/5/29 下午9:20, Yu Kuai 写道: From: Yu Kuai Our test found a following deadlock in raid10: 1) Issue a normal write, and such write failed: raid10_end_write_request set_bit(R10BIO_WriteError, &r10_bio->state) one_write_done reschedule_retry // later from md thread rai

Re: [dm-devel] [PATCH -next v2 3/6] md: add a mutex to synchronize idle and frozen in action_store()

2023-06-13 Thread Xiao Ni
在 2023/5/29 下午9:20, Yu Kuai 写道: From: Yu Kuai Currently, for idle and frozen, action_store will hold 'reconfig_mutex' and call md_reap_sync_thread() to stop sync thread, however, this will cause deadlock (explained in the next patch). In order to fix the problem, following patch will release '

Re: [dm-devel] [PATCH -next v2 2/6] md: refactor action_store() for 'idle' and 'frozen'

2023-06-13 Thread Xiao Ni
在 2023/6/13 下午8:44, Yu Kuai 写道: Hi, 在 2023/06/13 20:25, Xiao Ni 写道: On Tue, Jun 13, 2023 at 8:00 PM Yu Kuai wrote: Hi, 在 2023/06/13 16:02, Xiao Ni 写道: 在 2023/5/29 下午9:20, Yu Kuai 写道: From: Yu Kuai Prepare to handle 'idle' and 'frozen' differently to fix a de

Re: [dm-devel] [PATCH -next v2 2/6] md: refactor action_store() for 'idle' and 'frozen'

2023-06-13 Thread Xiao Ni
On Tue, Jun 13, 2023 at 8:00 PM Yu Kuai wrote: > > Hi, > > 在 2023/06/13 16:02, Xiao Ni 写道: > > > > 在 2023/5/29 下午9:20, Yu Kuai 写道: > >> From: Yu Kuai > >> > >> Prepare to handle 'idle' and 'frozen' differently t

Re: [dm-devel] [PATCH -next v2 2/6] md: refactor action_store() for 'idle' and 'frozen'

2023-06-13 Thread Xiao Ni
在 2023/5/29 下午9:20, Yu Kuai 写道: From: Yu Kuai Prepare to handle 'idle' and 'frozen' differently to fix a deadlock, there are no functional changes except that MD_RECOVERY_RUNNING is checked again after 'reconfig_mutex' is held. Can you explain more about why it needs to check MD_RECOVERY_RU

Re: [dm-devel] [PATCH -next v2 1/6] Revert "md: unlock mddev before reap sync_thread in action_store"

2023-06-12 Thread Xiao Ni
在 2023/5/29 下午9:20, Yu Kuai 写道: From: Yu Kuai This reverts commit 9dfbdafda3b34e262e43e786077bab8e476a89d1. Because it will introduce a defect that sync_thread can be running while MD_RECOVERY_RUNNING is cleared, which will cause some unexpected problems, for example: list_add corruption. pr

Re: [dm-devel] [PATCH] md: use preallocated hashed wait queues instead of mddev->sb_wait

2023-01-30 Thread Xiao Ni
Hi Mikulas Can we fix this by this: --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -929,10 +929,10 @@ static void super_written(struct bio *bio) bio_put(bio); - rdev_dec_pending(rdev, mddev); - if (atomic_dec_and_test(&mddev->pending_writes)) wake_up(&mddev

Re: [dm-devel] [PATCH] md: use preallocated hashed wait queues instead of mddev->sb_wait

2023-01-30 Thread Xiao Ni
On Tue, Jan 24, 2023 at 10:06 PM Mikulas Patocka wrote: > > There's a theoretical race condition in md. > > super_written calls: > if (atomic_dec_and_test(&mddev->pending_writes)) > wake_up(&mddev->sb_wait); > > If the process is rescheduled just after atomic_dec_and_test a

Re: [dm-devel] A crash caused by the commit 0dd84b319352bb8ba64752d4e45396d8b13e6018

2022-11-04 Thread Xiao Ni
On Fri, Nov 4, 2022 at 7:10 PM Zdenek Kabelac wrote: > > Dne 04. 11. 22 v 2:23 Guoqing Jiang napsal(a): > > > > > > On 11/3/22 10:46 PM, Heming Zhao wrote: > >> On 11/3/22 11:47 AM, Guoqing Jiang wrote: > >>> Hi, > >>> > >>> On 11/3/22 12:27 AM, Mikulas Patocka wrote: > Hi > > There

Re: [dm-devel] [PATCH] udev-md-raid-assembly.rules: skip if DM_UDEV_DISABLE_OTHER_RULES_FLAG

2022-02-28 Thread Xiao Ni
On Thu, Feb 17, 2022 at 9:10 PM Peter Rajnoha wrote: > > On Thu 17 Feb 2022 11:58, Martin Wilck wrote: > > On Thu, 2022-02-17 at 09:09 +1100, NeilBrown wrote: > > > On Thu, 17 Feb 2022, mwi...@suse.com wrote: > > > > From: Martin Wilck > > > > > > > > device-mapper sets the flag DM_UDEV_DISABLE_O