linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE
@ 2020-06-16  9:25 Guoqing Jiang
  2020-06-16  9:25 ` [PATCH 2/3] raid5: put the comment of clear_batch_ready to the right place Guoqing Jiang
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Guoqing Jiang @ 2020-06-16  9:25 UTC (permalink / raw)
  To: linux-raid; +Cc: song, Guoqing Jiang

We tried to only put the head sh of batch list to handle_list, then the
handle_stripe doesn't handle other members in the batch list. However,
we still got the calltrace in break_stripe_batch_list.

[593764.644269] stripe state: 2003
kernel: [593764.644299] ------------[ cut here ]------------
kernel: [593764.644308] WARNING: CPU: 12 PID: 856 at drivers/md/raid5.c:4625 break_stripe_batch_list+0x203/0x240 [raid456]
[...]
kernel: [593764.644363] Call Trace:
kernel: [593764.644370]  handle_stripe+0x907/0x20c0 [raid456]
kernel: [593764.644376]  ? __wake_up_common_lock+0x89/0xc0
kernel: [593764.644379]  handle_active_stripes.isra.57+0x35f/0x570 [raid456]
kernel: [593764.644382]  ? raid5_wakeup_stripe_thread+0x96/0x1f0 [raid456]
kernel: [593764.644385]  raid5d+0x480/0x6a0 [raid456]
kernel: [593764.644390]  ? md_thread+0x11f/0x160
kernel: [593764.644392]  md_thread+0x11f/0x160
kernel: [593764.644394]  ? wait_woken+0x80/0x80
kernel: [593764.644396]  kthread+0xfc/0x130
kernel: [593764.644398]  ? find_pers+0x70/0x70
kernel: [593764.644399]  ? kthread_create_on_node+0x70/0x70
kernel: [593764.644401]  ret_from_fork+0x1f/0x30

As we can see, the stripe was set with STRIPE_ACTIVE and STRIPE_HANDLE,
and only handle_stripe could set those flags then return. And since the
stipe was already in the batch list, we need to return earlier before
set the two flags.

And after dig a little about git history especially commit 3664847d95e6
("md/raid5: fix a race condition in stripe batch"), it seems the batched
stipe still could be handled by handle_stipe, then handle_stipe needs to
return earlier if clear_batch_ready to return true.

Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
Another alternative would be just not warn if STRIPE_ACTIVE is valid for 
the batched list.

What do you think?

Thanks,
Guoqing

 drivers/md/raid5.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ab8067f9ce8c..a35332364f07 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4682,6 +4682,16 @@ static void handle_stripe(struct stripe_head *sh)
 	struct r5dev *pdev, *qdev;
 
 	clear_bit(STRIPE_HANDLE, &sh->state);
+
+	/*
+	 * handle_stripe should not continue handle the batched stripe, only
+	 * the head of batch list or lone stripe can continue. Otherwise we
+	 * could see break_stripe_batch_list warns about the STRIPE_ACTIVE
+	 * is set for the batched stripe.
+	 */
+	if (clear_batch_ready(sh))
+		return;
+
 	if (test_and_set_bit_lock(STRIPE_ACTIVE, &sh->state)) {
 		/* already being handled, ensure it gets handled
 		 * again when current action finishes */
@@ -4689,11 +4699,6 @@ static void handle_stripe(struct stripe_head *sh)
 		return;
 	}
 
-	if (clear_batch_ready(sh) ) {
-		clear_bit_unlock(STRIPE_ACTIVE, &sh->state);
-		return;
-	}
-
 	if (test_and_clear_bit(STRIPE_BATCH_ERR, &sh->state))
 		break_stripe_batch_list(sh, 0);
 
-- 
2.17.1

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

* [PATCH 2/3] raid5: put the comment of clear_batch_ready to the right place
  2020-06-16  9:25 [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE Guoqing Jiang
@ 2020-06-16  9:25 ` Guoqing Jiang
  2020-06-16  9:25 ` [PATCH 3/3] raid5: remove the meaningless check in raid5_make_request Guoqing Jiang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Guoqing Jiang @ 2020-06-16  9:25 UTC (permalink / raw)
  To: linux-raid; +Cc: song, Guoqing Jiang

To make people understand the function well, let's put the comment to
the right place.

Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
 drivers/md/raid5.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index a35332364f07..45398b9b0a46 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4573,12 +4573,12 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
 	rcu_read_unlock();
 }
 
+/*
+ * Return '1' if this is a member of batch, or '0' if it is a lone stripe or
+ * a head which can now be handled.
+ */
 static int clear_batch_ready(struct stripe_head *sh)
 {
-	/* Return '1' if this is a member of batch, or
-	 * '0' if it is a lone stripe or a head which can now be
-	 * handled.
-	 */
 	struct stripe_head *tmp;
 	if (!test_and_clear_bit(STRIPE_BATCH_READY, &sh->state))
 		return (sh->batch_head && sh->batch_head != sh);
-- 
2.17.1

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

* [PATCH 3/3] raid5: remove the meaningless check in raid5_make_request
  2020-06-16  9:25 [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE Guoqing Jiang
  2020-06-16  9:25 ` [PATCH 2/3] raid5: put the comment of clear_batch_ready to the right place Guoqing Jiang
@ 2020-06-16  9:25 ` Guoqing Jiang
  2020-06-19 14:16 ` [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE Guoqing Jiang
  2020-06-23 23:58 ` Song Liu
  3 siblings, 0 replies; 9+ messages in thread
From: Guoqing Jiang @ 2020-06-16  9:25 UTC (permalink / raw)
  To: linux-raid; +Cc: song, Guoqing Jiang

We can't guarntee the batched stripe to be set with STRIPE_HANDLE since
there are lots of functions could set the flag, such as sync_request,
ops_complete_* and end_{read,write}_request etc.

Also clear_batch_ready called in handle_stripe ensures the batched list
can't continue to be handled by handle_stripe.

Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
 drivers/md/raid5.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 45398b9b0a46..bd010835332a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5738,8 +5738,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi)
 				do_flush = false;
 			}
 
-			if (!sh->batch_head || sh == sh->batch_head)
-				set_bit(STRIPE_HANDLE, &sh->state);
+			set_bit(STRIPE_HANDLE, &sh->state);
 			clear_bit(STRIPE_DELAYED, &sh->state);
 			if ((!sh->batch_head || sh == sh->batch_head) &&
 			    (bi->bi_opf & REQ_SYNC) &&
-- 
2.17.1

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

* Re: [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE
  2020-06-16  9:25 [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE Guoqing Jiang
  2020-06-16  9:25 ` [PATCH 2/3] raid5: put the comment of clear_batch_ready to the right place Guoqing Jiang
  2020-06-16  9:25 ` [PATCH 3/3] raid5: remove the meaningless check in raid5_make_request Guoqing Jiang
@ 2020-06-19 14:16 ` Guoqing Jiang
  2020-06-23 23:58 ` Song Liu
  3 siblings, 0 replies; 9+ messages in thread
From: Guoqing Jiang @ 2020-06-19 14:16 UTC (permalink / raw)
  To: linux-raid; +Cc: song

On 6/16/20 11:25 AM, Guoqing Jiang wrote:
> [593764.644269] stripe state: 2003
> kernel: [593764.644299] ------------[ cut here ]------------
> kernel: [593764.644308] WARNING: CPU: 12 PID: 856 at drivers/md/raid5.c:4625 break_stripe_batch_list+0x203/0x240 [raid456]

This happens with our own kernel, so the line number can't match with 
upstream kernel.

static void break_stripe_batch_list(struct stripe_head *head_sh,
                                     unsigned long handle_flags)
{
         struct stripe_head *sh, *next;
         int i;
         int do_wakeup = 0;

         list_for_each_entry_safe(sh, next, &head_sh->batch_list, 
batch_list) {

                 list_del_init(&sh->batch_list);

*WARN_ONCE(sh->state & ((1 << STRIPE_ACTIVE) |*

The warning was happened at above line.

Thanks,
Guoqing

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

* Re: [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE
  2020-06-16  9:25 [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE Guoqing Jiang
                   ` (2 preceding siblings ...)
  2020-06-19 14:16 ` [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE Guoqing Jiang
@ 2020-06-23 23:58 ` Song Liu
  2020-06-25  9:22   ` Guoqing Jiang
  3 siblings, 1 reply; 9+ messages in thread
From: Song Liu @ 2020-06-23 23:58 UTC (permalink / raw)
  To: Guoqing Jiang; +Cc: linux-raid

On Tue, Jun 16, 2020 at 2:25 AM Guoqing Jiang
<guoqing.jiang@cloud.ionos.com> wrote:
>
> We tried to only put the head sh of batch list to handle_list, then the
> handle_stripe doesn't handle other members in the batch list. However,
> we still got the calltrace in break_stripe_batch_list.
>
> [593764.644269] stripe state: 2003
> kernel: [593764.644299] ------------[ cut here ]------------
> kernel: [593764.644308] WARNING: CPU: 12 PID: 856 at drivers/md/raid5.c:4625 break_stripe_batch_list+0x203/0x240 [raid456]
> [...]
> kernel: [593764.644363] Call Trace:
> kernel: [593764.644370]  handle_stripe+0x907/0x20c0 [raid456]
> kernel: [593764.644376]  ? __wake_up_common_lock+0x89/0xc0
> kernel: [593764.644379]  handle_active_stripes.isra.57+0x35f/0x570 [raid456]
> kernel: [593764.644382]  ? raid5_wakeup_stripe_thread+0x96/0x1f0 [raid456]
> kernel: [593764.644385]  raid5d+0x480/0x6a0 [raid456]
> kernel: [593764.644390]  ? md_thread+0x11f/0x160
> kernel: [593764.644392]  md_thread+0x11f/0x160
> kernel: [593764.644394]  ? wait_woken+0x80/0x80
> kernel: [593764.644396]  kthread+0xfc/0x130
> kernel: [593764.644398]  ? find_pers+0x70/0x70
> kernel: [593764.644399]  ? kthread_create_on_node+0x70/0x70
> kernel: [593764.644401]  ret_from_fork+0x1f/0x30
>
> As we can see, the stripe was set with STRIPE_ACTIVE and STRIPE_HANDLE,
> and only handle_stripe could set those flags then return. And since the
> stipe was already in the batch list, we need to return earlier before
> set the two flags.
>
> And after dig a little about git history especially commit 3664847d95e6
> ("md/raid5: fix a race condition in stripe batch"), it seems the batched
> stipe still could be handled by handle_stipe, then handle_stipe needs to
> return earlier if clear_batch_ready to return true.
>
> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> ---
> Another alternative would be just not warn if STRIPE_ACTIVE is valid for
> the batched list.
>
> What do you think?
>

This patch looks good to me (haven't tested yet). Let's try with this one.

Thanks,
Song

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

* Re: [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE
  2020-06-23 23:58 ` Song Liu
@ 2020-06-25  9:22   ` Guoqing Jiang
  2020-06-26  0:16     ` Song Liu
  0 siblings, 1 reply; 9+ messages in thread
From: Guoqing Jiang @ 2020-06-25  9:22 UTC (permalink / raw)
  To: Song Liu; +Cc: linux-raid



On 6/24/20 1:58 AM, Song Liu wrote:
> On Tue, Jun 16, 2020 at 2:25 AM Guoqing Jiang
> <guoqing.jiang@cloud.ionos.com> wrote:
>> We tried to only put the head sh of batch list to handle_list, then the
>> handle_stripe doesn't handle other members in the batch list. However,
>> we still got the calltrace in break_stripe_batch_list.
>>
>> [593764.644269] stripe state: 2003
>> kernel: [593764.644299] ------------[ cut here ]------------
>> kernel: [593764.644308] WARNING: CPU: 12 PID: 856 at drivers/md/raid5.c:4625 break_stripe_batch_list+0x203/0x240 [raid456]
>> [...]
>> kernel: [593764.644363] Call Trace:
>> kernel: [593764.644370]  handle_stripe+0x907/0x20c0 [raid456]
>> kernel: [593764.644376]  ? __wake_up_common_lock+0x89/0xc0
>> kernel: [593764.644379]  handle_active_stripes.isra.57+0x35f/0x570 [raid456]
>> kernel: [593764.644382]  ? raid5_wakeup_stripe_thread+0x96/0x1f0 [raid456]
>> kernel: [593764.644385]  raid5d+0x480/0x6a0 [raid456]
>> kernel: [593764.644390]  ? md_thread+0x11f/0x160
>> kernel: [593764.644392]  md_thread+0x11f/0x160
>> kernel: [593764.644394]  ? wait_woken+0x80/0x80
>> kernel: [593764.644396]  kthread+0xfc/0x130
>> kernel: [593764.644398]  ? find_pers+0x70/0x70
>> kernel: [593764.644399]  ? kthread_create_on_node+0x70/0x70
>> kernel: [593764.644401]  ret_from_fork+0x1f/0x30
>>
>> As we can see, the stripe was set with STRIPE_ACTIVE and STRIPE_HANDLE,
>> and only handle_stripe could set those flags then return. And since the
>> stipe was already in the batch list, we need to return earlier before
>> set the two flags.
>>
>> And after dig a little about git history especially commit 3664847d95e6
>> ("md/raid5: fix a race condition in stripe batch"), it seems the batched
>> stipe still could be handled by handle_stipe, then handle_stipe needs to
>> return earlier if clear_batch_ready to return true.
>>
>> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
>> ---
>> Another alternative would be just not warn if STRIPE_ACTIVE is valid for
>> the batched list.
>>
>> What do you think?
>>
> This patch looks good to me (haven't tested yet). Let's try with this one.

Ok, pls let me know if there is issue during test.

And do you want a new patch to reflect which I clarified for the line
number and kernel version?

Thanks,
Guoqing

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

* Re: [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE
  2020-06-25  9:22   ` Guoqing Jiang
@ 2020-06-26  0:16     ` Song Liu
  2020-07-16  7:44       ` Guoqing Jiang
  0 siblings, 1 reply; 9+ messages in thread
From: Song Liu @ 2020-06-26  0:16 UTC (permalink / raw)
  To: Guoqing Jiang; +Cc: linux-raid

On Thu, Jun 25, 2020 at 2:22 AM Guoqing Jiang
<guoqing.jiang@cloud.ionos.com> wrote:
>
>
>
> On 6/24/20 1:58 AM, Song Liu wrote:
> > On Tue, Jun 16, 2020 at 2:25 AM Guoqing Jiang
> > <guoqing.jiang@cloud.ionos.com> wrote:
> >> We tried to only put the head sh of batch list to handle_list, then the
> >> handle_stripe doesn't handle other members in the batch list. However,
> >> we still got the calltrace in break_stripe_batch_list.
> >>
> >> [593764.644269] stripe state: 2003
> >> kernel: [593764.644299] ------------[ cut here ]------------
> >> kernel: [593764.644308] WARNING: CPU: 12 PID: 856 at drivers/md/raid5.c:4625 break_stripe_batch_list+0x203/0x240 [raid456]
> >> [...]
> >> kernel: [593764.644363] Call Trace:
> >> kernel: [593764.644370]  handle_stripe+0x907/0x20c0 [raid456]
> >> kernel: [593764.644376]  ? __wake_up_common_lock+0x89/0xc0
> >> kernel: [593764.644379]  handle_active_stripes.isra.57+0x35f/0x570 [raid456]
> >> kernel: [593764.644382]  ? raid5_wakeup_stripe_thread+0x96/0x1f0 [raid456]
> >> kernel: [593764.644385]  raid5d+0x480/0x6a0 [raid456]
> >> kernel: [593764.644390]  ? md_thread+0x11f/0x160
> >> kernel: [593764.644392]  md_thread+0x11f/0x160
> >> kernel: [593764.644394]  ? wait_woken+0x80/0x80
> >> kernel: [593764.644396]  kthread+0xfc/0x130
> >> kernel: [593764.644398]  ? find_pers+0x70/0x70
> >> kernel: [593764.644399]  ? kthread_create_on_node+0x70/0x70
> >> kernel: [593764.644401]  ret_from_fork+0x1f/0x30
> >>
> >> As we can see, the stripe was set with STRIPE_ACTIVE and STRIPE_HANDLE,
> >> and only handle_stripe could set those flags then return. And since the
> >> stipe was already in the batch list, we need to return earlier before
> >> set the two flags.
> >>
> >> And after dig a little about git history especially commit 3664847d95e6
> >> ("md/raid5: fix a race condition in stripe batch"), it seems the batched
> >> stipe still could be handled by handle_stipe, then handle_stipe needs to
> >> return earlier if clear_batch_ready to return true.
> >>
> >> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> >> ---
> >> Another alternative would be just not warn if STRIPE_ACTIVE is valid for
> >> the batched list.
> >>
> >> What do you think?
> >>
> > This patch looks good to me (haven't tested yet). Let's try with this one.
>
> Ok, pls let me know if there is issue during test.
>
> And do you want a new patch to reflect which I clarified for the line
> number and kernel version?

That's not necessary. If needed, I will make some change when I apply the patch.

Thanks,
Song

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

* Re: [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE
  2020-06-26  0:16     ` Song Liu
@ 2020-07-16  7:44       ` Guoqing Jiang
  2020-07-16 17:32         ` Song Liu
  0 siblings, 1 reply; 9+ messages in thread
From: Guoqing Jiang @ 2020-07-16  7:44 UTC (permalink / raw)
  To: Song Liu; +Cc: linux-raid

On 6/26/20 2:16 AM, Song Liu wrote:
> On Thu, Jun 25, 2020 at 2:22 AM Guoqing Jiang
> <guoqing.jiang@cloud.ionos.com> wrote:
>>
>>
>> On 6/24/20 1:58 AM, Song Liu wrote:
>>> On Tue, Jun 16, 2020 at 2:25 AM Guoqing Jiang
>>> <guoqing.jiang@cloud.ionos.com> wrote:
>>>> We tried to only put the head sh of batch list to handle_list, then the
>>>> handle_stripe doesn't handle other members in the batch list. However,
>>>> we still got the calltrace in break_stripe_batch_list.
>>>>
>>>> [593764.644269] stripe state: 2003
>>>> kernel: [593764.644299] ------------[ cut here ]------------
>>>> kernel: [593764.644308] WARNING: CPU: 12 PID: 856 at drivers/md/raid5.c:4625 break_stripe_batch_list+0x203/0x240 [raid456]
>>>> [...]
>>>> kernel: [593764.644363] Call Trace:
>>>> kernel: [593764.644370]  handle_stripe+0x907/0x20c0 [raid456]
>>>> kernel: [593764.644376]  ? __wake_up_common_lock+0x89/0xc0
>>>> kernel: [593764.644379]  handle_active_stripes.isra.57+0x35f/0x570 [raid456]
>>>> kernel: [593764.644382]  ? raid5_wakeup_stripe_thread+0x96/0x1f0 [raid456]
>>>> kernel: [593764.644385]  raid5d+0x480/0x6a0 [raid456]
>>>> kernel: [593764.644390]  ? md_thread+0x11f/0x160
>>>> kernel: [593764.644392]  md_thread+0x11f/0x160
>>>> kernel: [593764.644394]  ? wait_woken+0x80/0x80
>>>> kernel: [593764.644396]  kthread+0xfc/0x130
>>>> kernel: [593764.644398]  ? find_pers+0x70/0x70
>>>> kernel: [593764.644399]  ? kthread_create_on_node+0x70/0x70
>>>> kernel: [593764.644401]  ret_from_fork+0x1f/0x30
>>>>
>>>> As we can see, the stripe was set with STRIPE_ACTIVE and STRIPE_HANDLE,
>>>> and only handle_stripe could set those flags then return. And since the
>>>> stipe was already in the batch list, we need to return earlier before
>>>> set the two flags.
>>>>
>>>> And after dig a little about git history especially commit 3664847d95e6
>>>> ("md/raid5: fix a race condition in stripe batch"), it seems the batched
>>>> stipe still could be handled by handle_stipe, then handle_stipe needs to
>>>> return earlier if clear_batch_ready to return true.
>>>>
>>>> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
>>>> ---
>>>> Another alternative would be just not warn if STRIPE_ACTIVE is valid for
>>>> the batched list.
>>>>
>>>> What do you think?
>>>>
>>> This patch looks good to me (haven't tested yet). Let's try with this one.
>> Ok, pls let me know if there is issue during test.
>>
>> And do you want a new patch to reflect which I clarified for the line
>> number and kernel version?
> That's not necessary. If needed, I will make some change when I apply the patch.

May I know your decision about this?

Thanks,
Guoqing

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

* Re: [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE
  2020-07-16  7:44       ` Guoqing Jiang
@ 2020-07-16 17:32         ` Song Liu
  0 siblings, 0 replies; 9+ messages in thread
From: Song Liu @ 2020-07-16 17:32 UTC (permalink / raw)
  To: Guoqing Jiang; +Cc: linux-raid

On Thu, Jul 16, 2020 at 12:45 AM Guoqing Jiang
<guoqing.jiang@cloud.ionos.com> wrote:
>
> On 6/26/20 2:16 AM, Song Liu wrote:
> > On Thu, Jun 25, 2020 at 2:22 AM Guoqing Jiang
> > <guoqing.jiang@cloud.ionos.com> wrote:
> >>
> >>
> >> On 6/24/20 1:58 AM, Song Liu wrote:
> >>> On Tue, Jun 16, 2020 at 2:25 AM Guoqing Jiang
> >>> <guoqing.jiang@cloud.ionos.com> wrote:
> >>>> We tried to only put the head sh of batch list to handle_list, then the
> >>>> handle_stripe doesn't handle other members in the batch list. However,
> >>>> we still got the calltrace in break_stripe_batch_list.
> >>>>
> >>>> [593764.644269] stripe state: 2003
> >>>> kernel: [593764.644299] ------------[ cut here ]------------
> >>>> kernel: [593764.644308] WARNING: CPU: 12 PID: 856 at drivers/md/raid5.c:4625 break_stripe_batch_list+0x203/0x240 [raid456]
> >>>> [...]
> >>>> kernel: [593764.644363] Call Trace:
> >>>> kernel: [593764.644370]  handle_stripe+0x907/0x20c0 [raid456]
> >>>> kernel: [593764.644376]  ? __wake_up_common_lock+0x89/0xc0
> >>>> kernel: [593764.644379]  handle_active_stripes.isra.57+0x35f/0x570 [raid456]
> >>>> kernel: [593764.644382]  ? raid5_wakeup_stripe_thread+0x96/0x1f0 [raid456]
> >>>> kernel: [593764.644385]  raid5d+0x480/0x6a0 [raid456]
> >>>> kernel: [593764.644390]  ? md_thread+0x11f/0x160
> >>>> kernel: [593764.644392]  md_thread+0x11f/0x160
> >>>> kernel: [593764.644394]  ? wait_woken+0x80/0x80
> >>>> kernel: [593764.644396]  kthread+0xfc/0x130
> >>>> kernel: [593764.644398]  ? find_pers+0x70/0x70
> >>>> kernel: [593764.644399]  ? kthread_create_on_node+0x70/0x70
> >>>> kernel: [593764.644401]  ret_from_fork+0x1f/0x30
> >>>>
> >>>> As we can see, the stripe was set with STRIPE_ACTIVE and STRIPE_HANDLE,
> >>>> and only handle_stripe could set those flags then return. And since the
> >>>> stipe was already in the batch list, we need to return earlier before
> >>>> set the two flags.
> >>>>
> >>>> And after dig a little about git history especially commit 3664847d95e6
> >>>> ("md/raid5: fix a race condition in stripe batch"), it seems the batched
> >>>> stipe still could be handled by handle_stipe, then handle_stipe needs to
> >>>> return earlier if clear_batch_ready to return true.
> >>>>
> >>>> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> >>>> ---
> >>>> Another alternative would be just not warn if STRIPE_ACTIVE is valid for
> >>>> the batched list.
> >>>>
> >>>> What do you think?
> >>>>
> >>> This patch looks good to me (haven't tested yet). Let's try with this one.
> >> Ok, pls let me know if there is issue during test.
> >>
> >> And do you want a new patch to reflect which I clarified for the line
> >> number and kernel version?
> > That's not necessary. If needed, I will make some change when I apply the patch.
>
> May I know your decision about this?
>

I am sorry that I missed this one. Applied to md-next.

Thanks,
Song

> Thanks,
> Guoqing

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

end of thread, other threads:[~2020-07-16 17:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16  9:25 [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE Guoqing Jiang
2020-06-16  9:25 ` [PATCH 2/3] raid5: put the comment of clear_batch_ready to the right place Guoqing Jiang
2020-06-16  9:25 ` [PATCH 3/3] raid5: remove the meaningless check in raid5_make_request Guoqing Jiang
2020-06-19 14:16 ` [PATCH 1/3] raid5: call clear_batch_ready before set STRIPE_ACTIVE Guoqing Jiang
2020-06-23 23:58 ` Song Liu
2020-06-25  9:22   ` Guoqing Jiang
2020-06-26  0:16     ` Song Liu
2020-07-16  7:44       ` Guoqing Jiang
2020-07-16 17:32         ` Song Liu

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