Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3496552pxb; Mon, 25 Jan 2021 18:52:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzL1xepxLT8EnbXDf5JdszoshzSrt9lqiIXXO/WiZmvs/aCZMCFnB8pEPFnw/PrpWTPF0s X-Received: by 2002:a17:906:d8b4:: with SMTP id qc20mr2214845ejb.451.1611629559602; Mon, 25 Jan 2021 18:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611629559; cv=none; d=google.com; s=arc-20160816; b=TCAYEfGTy+WUpWk6QSo8zrf9GMKrbvrdD7N+kpW6xTWkAB6S8jS7Qo/b3ZBjM+VQjV slx7eD1NrfzR/0SlN5Vy3xnC7POV32ouTcI99A5zIcBxoBIjhU2MbYVU8uoYZrTAGYzU uaHvpDlkExdQ88z+QJvRoytkHR9WaHOYXbwnZ16+ILziBsWPP3PKCpK2VXOfPZAdfHx4 5X2DGeBB4trn4wIWwaLJQsNQ3mohdJsHp0JmPAhvcN4UsGbSdGnjtY95UHGLQfm+rQQb cRXVoDERvZRihw1S0hnZyhj5JtNZhP1Y440AKlT3SfThRicM5VGFrvQR/3DE75sMRBlK iRPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :dkim-signature; bh=JLsx2L2mSV0OI5IXzT5lJD4w9AzsejCJ+52IlMaTO9c=; b=hWk5QFxv72yefBiUHAdYVJXERfFVggg17jRQxpnYOG4AItQBwgmmWZmq5BE51mFNOf uEX5Nm2PLY1qbOpW/5nTTYdEbsHxcdv5lPV7xbOy8/cKfGdeExkn75PgJUHtElvILNXx INbwnNZev4gZZabQLRXTfCsfVVCrHGKV8Q+EkvOPJCOOSK/k8AuSDzHAKZ48KROSeB+p iPdCHaCm1dXF/CL35HsqrtiD7fLEnEBGkRd9cLB2sB5OpwtCn92zk2zQk6qiKvyBvbt7 +Js84dD6vuD+V/6uhi4qtfC1ZGEZJwErtIcAwvgTMn2VWt9LuJD6hg9DigiB9VEwqi0M qtJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=F0AZig+5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ionos.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb28si6470862ejc.510.2021.01.25.18.52.15; Mon, 25 Jan 2021 18:52:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cloud.ionos.com header.s=google header.b=F0AZig+5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ionos.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729826AbhAZBnR (ORCPT + 99 others); Mon, 25 Jan 2021 20:43:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729698AbhAZBhB (ORCPT ); Mon, 25 Jan 2021 20:37:01 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1219CC06121D for ; Mon, 25 Jan 2021 16:44:39 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id q131so9391420pfq.10 for ; Mon, 25 Jan 2021 16:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.ionos.com; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=JLsx2L2mSV0OI5IXzT5lJD4w9AzsejCJ+52IlMaTO9c=; b=F0AZig+5OEwman0KskucivmzrumfaVNX01p7tBHZudvTohCZ72w1jlBvWO800V1yoc xrYLRJ47+XNOFsPKMZIfxlrFQpW3PPKD3tEpjuLlXLPLoqNyprHFxirVvWfnoqjnaMIS gzWl5GSXWR241Ye3jJII+7YI4wruYGY30QiHOR91r/4t6ggMEoOocxHhJdK5quXQx5qZ 5FkzXxhYL+KXoxFxZAbV1OnlAr/jiYVJPdJtivacznNZGEeENOMcQwLtFqMKOKnhiYcx WkzGpM+bdCNLjTbf37LV0Gsf8ZPPBvfkHUdAznzEBvRb+/FDxw0OLH4kwXecmn+uO3UQ LHiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=JLsx2L2mSV0OI5IXzT5lJD4w9AzsejCJ+52IlMaTO9c=; b=FLtrRZd7Dk+WOp95OyKo07iHxRJchga2oY/JBILAMk6sUFWpsoJ/8RonW38MVfCYbD fLNxtefRjUaWXCezj6E8SsVcgKLWIbkqaZhPp0n4OPcnT21+fngNJpsKVRPYZ3YH64+0 QpwTaTABO9KNtL0fIZUOG7hcr+jofbzK2hsv1eFEEzfnSjZCnM0Xb0wUurwLqWTxadlz F1Vbxn2xbHJGSEh7m809Y8t7l33dohmjmkVrZWDox9smvtXO9lpeRedh4adErEUly2ww 1obKM8HUeomr+TOGJ3H3l7u6AB6FbWYPX62CqnlOrHyQ0dmYMeeLd6Qs5RdcW/KoM25p iD6Q== X-Gm-Message-State: AOAM531ddGFXYcD5wBxULOpcSLlhogo+KrCjmFBbUrQMjzUbLJJ2oyyq h/IZcdFrzQN4d5SLwyw2i4AaPMU+insJDA== X-Received: by 2002:a63:fe13:: with SMTP id p19mr3108179pgh.119.1611621876742; Mon, 25 Jan 2021 16:44:36 -0800 (PST) Received: from [10.8.1.5] ([185.125.207.232]) by smtp.gmail.com with ESMTPSA id 11sm17631611pgz.22.2021.01.25.16.44.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Jan 2021 16:44:35 -0800 (PST) Subject: Re: md_raid: mdX_raid6 looping after sync_action "check" to "idle" transition To: Donald Buczek , Song Liu , linux-raid@vger.kernel.org, Linux Kernel Mailing List , it+raid@molgen.mpg.de References: <95fbd558-5e46-7a6a-43ac-bcc5ae8581db@cloud.ionos.com> <77244d60-1c2d-330e-71e6-4907d4dd65fc@molgen.mpg.de> <7c5438c7-2324-cc50-db4d-512587cb0ec9@molgen.mpg.de> <37c158cb-f527-34f5-2482-cae138bc8b07@molgen.mpg.de> <55e30408-ac63-965f-769f-18be5fd5885c@molgen.mpg.de> <30576384-682c-c021-ff16-bebed8251365@molgen.mpg.de> From: Guoqing Jiang Message-ID: Date: Tue, 26 Jan 2021 01:44:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------93515907419EC43A70E50E97" Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------93515907419EC43A70E50E97 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi Donald, On 1/25/21 22:32, Donald Buczek wrote: > > > On 25.01.21 09:54, Donald Buczek wrote: >> Dear Guoqing, >> >> a colleague of mine was able to produce the issue inside a vm and were >> able to find a procedure to run the vm into the issue within minutes >> (not unreliably after hours on a physical system as before). This of >> course helped to pinpoint the problem. >> >> My current theory of what is happening is: >> >> - MD_SB_CHANGE_CLEAN + MD_SB_CHANGE_PENDING are set by >> md_write_start() when file-system I/O wants to do a write and the >> array transitions from "clean" to "active". >> (https://elixir.bootlin.com/linux/v5.4.57/source/drivers/md/md.c#L8308) >> >> - Before raid5d gets to write the superblock (its busy processing >> active stripes because of the sync activity) , userspace wants to >> pause the check by `echo idle > /sys/block/mdX/md/sync_action` >> >> - action_store() takes the reconfig_mutex before trying to stop the >> sync thread. >> (https://elixir.bootlin.com/linux/v5.4.57/source/drivers/md/md.c#L4689) Dump >> of struct mddev of email 1/19/21 confirms reconf_mutex non-zero. >> >> - raid5d is running in its main loop. >> raid5d()->handle_active_stripes() returns a positive batch size ( >> https://elixir.bootlin.com/linux/v5.4.57/source/drivers/md/raid5.c#L6329 >> ) although raid5d()->handle_active_stripes()->handle_stripe() doesn't >> process any stripe because of MD_SB_CHANGE_PENDING. >> (https://elixir.bootlin.com/linux/v5.4.57/source/drivers/md/raid5.c#L4729 >> ). This is the reason, raid5d is busy looping. >> >> - raid5d()->md_check_recovery() is called by the raid5d main loop. One >> of its duties is to write the superblock, if a change is pending. >> However to do so, it needs either MD_ALLOW_SB_UPDATE or must be able >> to take the reconfig_mutex. >> (https://elixir.bootlin.com/linux/v5.4.57/source/drivers/md/md.c#L8967 >> , >> https://elixir.bootlin.com/linux/v5.4.57/source/drivers/md/md.c#L9006) >> Both is not true, so the superblock is not written and >> MD_SB_CHANGE_PENDING is not cleared. >> >> - (as discussed previously) the sync thread is waiting for the number >> of active stripes to go down and doesn't terminate. The userspace >> thread is waiting for the sync thread to terminate. >> >> Does this make sense? Yes, exactly! That was my thought too, the scenario is twisted. Then resync thread is blocked due to there are too many active stripes, because raid5d is in busy loop since SB_CHANGE_PENDING is set which means tactive stripes can't be decreased, and echo idle cmd can't make progress given resync thread is blocked while the cmd still hold reconfig_mutex which make raid5d in busy loop and can't clear SB_CHANGE_PENDING flag. And raid5 could suffer from the same issue I think. >> >> Just for reference, I add the procedure which triggers the issue on >> the vm (with /dev/md3 mounted on /mnt/raid_md3) and some debug output: >> >> ``` >> #! /bin/bash >> >> ( >>          while true; do >>                  echo "start check" >>                  echo check > /sys/block/md3/md/sync_action >>                  sleep 10 >>                  echo "stop check" >>                  echo idle > /sys/block/md3/md/sync_action >>                  sleep 2 >>          done >> ) & >> >> ( >>          while true; do >>                  dd bs=1k count=$((5*1024*1024)) if=/dev/zero >> of=/mnt/raid_md3/bigfile status=none >>                  sync /mnt/raid_md3/bigfile >>                  rm /mnt/raid_md3/bigfile >>                  sleep .1 >>          done >> ) & >> >> start="$(date +%s)" >> cd /sys/block/md3/md >> wp_count=0 >> while true; do >>          array_state=$(cat array_state) >>          if [ "$array_state" = write-pending ]; then >>                  wp_count=$(($wp_count+1)) >>          else >>                  wp_count=0 >>          fi >>          echo $(($(date +%s)-$start)) $(cat sync_action) $(cat >> sync_completed) $array_state $(cat stripe_cache_active) >>          if [ $wp_count -ge 3 ]; then >>                  kill -- -$$ >>                  exit >>          fi >>          sleep 1 >> done >> ``` >> >> The time, this needs to trigger the issue, varies from under a minute >> to one hour with 5 minute being typical. The output ends like this: >> >>      309 check 6283872 / 8378368 active-idle 4144 >>      310 check 6283872 / 8378368 active 1702 >>      311 check 6807528 / 8378368 active 4152 >>      312 check 7331184 / 8378368 clean 3021 >>      stop check >>      313 check 7331184 / 8378368 write-pending 3905 >>      314 check 7331184 / 8378368 write-pending 3905 >>      315 check 7331184 / 8378368 write-pending 3905 >>      Terminated >> >> If I add >> >>      pr_debug("XXX batch_size %d release %d mdddev->sb_flags %lx\n", >> batch_size, released, mddev->sb_flags); >> >> in raid5d after the call to handle_active_stripes and enable the debug >> location after the deadlock occurred, I get >> >>      [ 3123.939143] [1223] raid5d:6332: XXX batch_size 8 release 0 >> mdddev->sb_flags 6 >>      [ 3123.939156] [1223] raid5d:6332: XXX batch_size 8 release 0 >> mdddev->sb_flags 6 >>      [ 3123.939170] [1223] raid5d:6332: XXX batch_size 8 release 0 >> mdddev->sb_flags 6 >>      [ 3123.939184] [1223] raid5d:6332: XXX batch_size 8 release 0 >> mdddev->sb_flags 6 >> >> If I add >> >>      pr_debug("XXX 1 %s:%d mddev->flags %08lx mddev->sb_flags >> %08lx\n", __FILE__, __LINE__, mddev->flags, mddev->sb_flags); >> >> at the head of md_check_recovery, I get: >> >>      [  789.555462] [1191] md_check_recovery:8970: XXX 1 >> drivers/md/md.c:8970 mddev->flags 00000000 mddev->sb_flags 00000006 >>      [  789.555477] [1191] md_check_recovery:8970: XXX 1 >> drivers/md/md.c:8970 mddev->flags 00000000 mddev->sb_flags 00000006 >>      [  789.555491] [1191] md_check_recovery:8970: XXX 1 >> drivers/md/md.c:8970 mddev->flags 00000000 mddev->sb_flags 00000006 >>      [  789.555505] [1191] md_check_recovery:8970: XXX 1 >> drivers/md/md.c:8970 mddev->flags 00000000 mddev->sb_flags 00000006 >>      [  789.555520] [1191] md_check_recovery:8970: XXX 1 >> drivers/md/md.c:8970 mddev->flags 00000000 mddev->sb_flags 00000006 >> >> More debug lines in md_check_recovery confirm the control flow ( `if >> (mddev_trylock(mddev))` block not taken ) >> That is great that you have a reproducer now! >> What approach would you suggest to fix this? > > I naively tried the following patch and it seems to fix the problem. The > test procedure didn't trigger the deadlock in 10 hours. > > D. > > diff --git a/drivers/md/md.c b/drivers/md/md.c > index 2d21c298ffa7..f40429843906 100644 > --- a/drivers/md/md.c > +++ b/drivers/md/md.c > @@ -4687,11 +4687,13 @@ action_store(struct mddev *mddev, const char > *page, size_t len) >              clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); >          if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) && >              mddev_lock(mddev) == 0) { > +            set_bit(MD_ALLOW_SB_UPDATE, &mddev->flags); >              flush_workqueue(md_misc_wq); >              if (mddev->sync_thread) { >                  set_bit(MD_RECOVERY_INTR, &mddev->recovery); >                  md_reap_sync_thread(mddev); >              } > +            clear_bit(MD_ALLOW_SB_UPDATE, &mddev->flags); >              mddev_unlock(mddev); >          } >      } else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) Yes, it could break the deadlock issue, but I am not sure if it is the right way given we only set ALLOW_SB_UPDATE in suspend which makes sense since the io will be quiesced, but write idle action can't guarantee the similar thing. I prefer to make resync thread not wait forever here. wait_event_lock_irq( conf->wait_for_stripe, !list_empty(conf->inactive_list + hash) && (atomic_read(&conf->active_stripes) < (conf->max_nr_stripes * 3 / 4) || !test_bit(R5_INACTIVE_BLOCKED, &conf->cache_state) *(conf->hash_locks + hash)); So, could you please try the attached? Thanks, Guoqing --------------93515907419EC43A70E50E97 Content-Type: text/plain; charset=UTF-8; name="raid5-proposal" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="raid5-proposal" ZGlmZiAtLWdpdCBhL2RyaXZlcnMvbWQvcmFpZDUtY2FjaGUuYyBiL2RyaXZlcnMvbWQvcmFp ZDUtY2FjaGUuYwppbmRleCA0MzM3YWUwLi4zNzhjZTVjIDEwMDY0NAotLS0gYS9kcml2ZXJz L21kL3JhaWQ1LWNhY2hlLmMKKysrIGIvZHJpdmVycy9tZC9yYWlkNS1jYWNoZS5jCkBAIC0x OTMxLDcgKzE5MzEsNyBAQCByNWNfcmVjb3ZlcnlfYWxsb2Nfc3RyaXBlKAogewogCXN0cnVj dCBzdHJpcGVfaGVhZCAqc2g7CiAKLQlzaCA9IHJhaWQ1X2dldF9hY3RpdmVfc3RyaXBlKGNv bmYsIHN0cmlwZV9zZWN0LCAwLCBub2Jsb2NrLCAwKTsKKwlzaCA9IHJhaWQ1X2dldF9hY3Rp dmVfc3RyaXBlKGNvbmYsIHN0cmlwZV9zZWN0LCAwLCAwLCBub2Jsb2NrLCAwKTsKIAlpZiAo IXNoKQogCQlyZXR1cm4gTlVMTDsgIC8qIG5vIG1vcmUgc3RyaXBlIGF2YWlsYWJsZSAqLwog CmRpZmYgLS1naXQgYS9kcml2ZXJzL21kL3JhaWQ1LmMgYi9kcml2ZXJzL21kL3JhaWQ1LmMK aW5kZXggODg4ODk3My4uMzNhMmEyMiAxMDA2NDQKLS0tIGEvZHJpdmVycy9tZC9yYWlkNS5j CisrKyBiL2RyaXZlcnMvbWQvcmFpZDUuYwpAQCAtNzAwL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