linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Timestamps from the future (was: [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc())
  2023-02-24  6:52 [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc() Hou Tao
@ 2023-02-24  6:42 ` Paul Menzel
  2023-02-24  6:55   ` Hou Tao
  2023-02-28 18:37 ` [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc() Greg Kroah-Hartman
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2023-02-24  6:42 UTC (permalink / raw)
  To: Hou Tao
  Cc: Greg Kroah-Hartman, stable, linux-raid, David Sloan,
	Logan Gunthorpe, Song Liu, Jens Axboe, Sasha Levin, houtao1

Dear Hou,


Am 24.02.23 um 07:52 schrieb Hou Tao:

[…]

Just a heads-up that the date/timestamp is from the future

     Received: from huaweicloud.com (unknown [10.175.124.27])
             by APP4 (Coremail) with SMTP id 
gCh0CgBXwLPzV_hjqVfcEA--.64482S4;
             Fri, 24 Feb 2023 14:23:49 +0800 (CST)
     […]
     Date:   Fri, 24 Feb 2023 14:52:09 +0800

Please check the time of your (development) system.


Kind regards,

Paul

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

* [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc()
@ 2023-02-24  6:52 Hou Tao
  2023-02-24  6:42 ` Timestamps from the future (was: [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc()) Paul Menzel
  2023-02-28 18:37 ` [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc() Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Hou Tao @ 2023-02-24  6:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman, stable
  Cc: linux-raid, David Sloan, Logan Gunthorpe, Song Liu, Jens Axboe,
	Sasha Levin, houtao1

From: David Sloan <david.sloan@eideticom.com>

commit 5e8daf906f890560df430d30617c692a794acb73 upstream.

A race condition still exists when removing and re-creating md devices
in test cases. However, it is only seen on some setups.

The race condition was tracked down to a reference still being held
to the kobject by the rdev in the md_rdev_misc_wq which will be released
in rdev_delayed_delete().

md_alloc() waits for previous deletions by waiting on the md_misc_wq,
but the md_rdev_misc_wq may still be holding a reference to a recently
removed device.

To fix this, also flush the md_rdev_misc_wq in md_alloc().

Signed-off-by: David Sloan <david.sloan@eideticom.com>
[logang@deltatee.com: rewrote commit message]
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Hou Tao <houtao1@huawei.com>
---
Hi Greg,

We found the problem also exists on v5.10, so could you please pick it up
for v5.10 ?

Thanks.

 drivers/md/md.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 3038e7ecb7e1..c0b34637bd66 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5683,6 +5683,7 @@ static int md_alloc(dev_t dev, char *name)
 	 * completely removed (mddev_delayed_delete).
 	 */
 	flush_workqueue(md_misc_wq);
+	flush_workqueue(md_rdev_misc_wq);
 
 	mutex_lock(&disks_mutex);
 	error = -EEXIST;
-- 
2.29.2


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

* Re: Timestamps from the future (was: [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc())
  2023-02-24  6:42 ` Timestamps from the future (was: [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc()) Paul Menzel
@ 2023-02-24  6:55   ` Hou Tao
  0 siblings, 0 replies; 4+ messages in thread
From: Hou Tao @ 2023-02-24  6:55 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Greg Kroah-Hartman, stable, linux-raid, David Sloan,
	Logan Gunthorpe, Song Liu, Jens Axboe, Sasha Levin, houtao1

Hi,

On 2/24/2023 2:42 PM, Paul Menzel wrote:
> Dear Hou,
>
>
> Am 24.02.23 um 07:52 schrieb Hou Tao:
>
> […]
>
> Just a heads-up that the date/timestamp is from the future
>
>     Received: from huaweicloud.com (unknown [10.175.124.27])
>             by APP4 (Coremail) with SMTP id gCh0CgBXwLPzV_hjqVfcEA--.64482S4;
>             Fri, 24 Feb 2023 14:23:49 +0800 (CST)
>     […]
>     Date:   Fri, 24 Feb 2023 14:52:09 +0800
>
> Please check the time of your (development) system.
The time of our development server is incorrect. Will calibrate it.

Thanks.
>
>
> Kind regards,
>
> Paul


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

* Re: [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc()
  2023-02-24  6:52 [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc() Hou Tao
  2023-02-24  6:42 ` Timestamps from the future (was: [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc()) Paul Menzel
@ 2023-02-28 18:37 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2023-02-28 18:37 UTC (permalink / raw)
  To: Hou Tao
  Cc: stable, linux-raid, David Sloan, Logan Gunthorpe, Song Liu,
	Jens Axboe, Sasha Levin, houtao1

On Fri, Feb 24, 2023 at 02:52:09PM +0800, Hou Tao wrote:
> From: David Sloan <david.sloan@eideticom.com>
> 
> commit 5e8daf906f890560df430d30617c692a794acb73 upstream.
> 
> A race condition still exists when removing and re-creating md devices
> in test cases. However, it is only seen on some setups.
> 
> The race condition was tracked down to a reference still being held
> to the kobject by the rdev in the md_rdev_misc_wq which will be released
> in rdev_delayed_delete().
> 
> md_alloc() waits for previous deletions by waiting on the md_misc_wq,
> but the md_rdev_misc_wq may still be holding a reference to a recently
> removed device.
> 
> To fix this, also flush the md_rdev_misc_wq in md_alloc().
> 
> Signed-off-by: David Sloan <david.sloan@eideticom.com>
> [logang@deltatee.com: rewrote commit message]
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> Signed-off-by: Song Liu <song@kernel.org>
> Signed-off-by: Hou Tao <houtao1@huawei.com>
> ---
> Hi Greg,
> 
> We found the problem also exists on v5.10, so could you please pick it up
> for v5.10 ?

Now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2023-02-28 18:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-24  6:52 [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc() Hou Tao
2023-02-24  6:42 ` Timestamps from the future (was: [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc()) Paul Menzel
2023-02-24  6:55   ` Hou Tao
2023-02-28 18:37 ` [PATCH 5.10] md: Flush workqueue md_rdev_misc_wq in md_alloc() Greg Kroah-Hartman

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).