Thread (6 messages) 6 messages, 3 authors, 2023-02-02

Re: [PATCH] md: don't update recovery_cp when curr_resync is ACTIVE

From: Song Liu <song@kernel.org>
Date: 2023-02-02 06:53:55

On Wed, Feb 1, 2023 at 4:51 PM Hou Tao [off-list ref] wrote:
Hi,

On 2/2/2023 12:35 AM, Song Liu wrote:
quoted
On Mon, Jan 30, 2023 at 10:39 PM Hou Tao [off-list ref] wrote:
quoted
From: Hou Tao <redacted>

Don't update recovery_cp when curr_resync is MD_RESYNC_ACTIVE, otherwise
md may skip the resync of the first 3 sectors if the resync procedure is
interrupted before the first calling of ->sync_request() as shown below:

md_do_sync thread          control thread
  // setup resync
  mddev->recovery_cp = 0
  j = 0
  mddev->curr_resync = MD_RESYNC_ACTIVE

                             // e.g., set array as idle
                             set_bit(MD_RECOVERY_INTR, &&mddev_recovery)
  // resync loop
  // check INTR before calling sync_request
  !test_bit(MD_RECOVERY_INTR, &mddev->recovery

  // resync interrupted
  // update recovery_cp from 0 to 3
  // the resync of three 3 sectors will be skipped
  mddev->recovery_cp = 3

Fixes: eac58d08d493 ("md: Use enum for overloaded magic numbers used by mddev->curr_resync")
Signed-off-by: Hou Tao <redacted>
By the way, how did you find this issue? Is it from users/production?
Or just from reading the code?
Found the issue when reading the code and reproduced the problem to confirm that.
Thanks for the information!

Song
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help