Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1050024lqb; Sat, 25 May 2024 04:00:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUy/Yhs8VvYuC+GHulNjHNzLNSKaQzbKapgAksljA7UcRuN6GQ85RjoK/MQR8FNK2RKtzZPRhs6shKzPgioVhS5XcYxUf4URzA3C2aHlg== X-Google-Smtp-Source: AGHT+IFMHyTTYyDkaq6WTz5LsGj4QvlzvyTSfesUR5qRm+HJFJWlPIq8Iz0llRbfmQSSc/QQPyYI X-Received: by 2002:ac8:7f09:0:b0:43a:b16d:a0ca with SMTP id d75a77b69052e-43fb0f0652cmr57358301cf.60.1716634819567; Sat, 25 May 2024 04:00:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716634819; cv=pass; d=google.com; s=arc-20160816; b=T4A6dXdr/wJe/Xya+ZzY8qUgKgtavrigL3jgqkdOUFerXKMXgCvtUzxPt7vP68fhDL POIuimCAGdqvN4r2liiyRVjiGK/pkYLiaD90EQjj8q7Wy2Atku/qc0xdB6PuFocovuMw lFgz7U2r5hnf1ykq3UAvUnHPGnv+24zl7r/K/HDKKk9R51nt+KOmVDbwsUORYJuacCVW EmmU4CeNgwXMV41F0aOKB3YIp27GbmphG53DrDkbGR8S5ogI7fhqvM4sqBX/QQMWFGvW dYFAv+9K+f6X9y93tAG4hJUiD0pzeZdA7Yytq96TbQ4gZbFGpQbHWUQXct4XEvUFHIWP a6wg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=qXG2TtHI/S46D2Z5YWUuqTwTL5Z7GkUTi27fAn/nC7E=; fh=rohc9p9Yc8KW3f8e96UOkL0PmV2g9mNbxLi6PQaSMkI=; b=lAGdPMfvSIz2T3Tov0QcsOcpdU8voSiM2vx1HKxzZgytnF6Xs/dtxebake8lyx1BaR oyWDxuHwflLIAjNNUwRJ0V5K1C6Pp7avBTQTdp2rnQlqUHlVl36yExuLl4lJ9gpJk2go di0K7NPhkRWyWneg4x6h/DRggoXK6x7C5wIgWTsBnULNmeq4j1yfiiC/NgLph7sH3++F mF8TIYBR3kj7Zbnfz1HDoDc/ZuD8jB5HuiPMBEMDYqHdH7KeJKeveWrqGuHEV9gW0D4A rbfH6KHO7E9laVpXLHpPOVGqFVo1fKJmeuivRY9iMATfsKe57TsA1SOmskzOGnP2fVor D+gw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-189340-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189340-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fb5d5f042si31117961cf.601.2024.05.25.04.00.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 04:00:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189340-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-189340-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189340-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6CCD71C20B85 for ; Sat, 25 May 2024 11:00:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C51A3BBD9; Sat, 25 May 2024 11:00:04 +0000 (UTC) Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C43683032A; Sat, 25 May 2024 11:00:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716634803; cv=none; b=LnpaR90fTsWbdzbOdss9UkPMeYEx89hZfsGHAfvwr1aOsdCMAfwqCkNu+JA5Y+U3OvRM7HhSh3OHcoOxphSLXVnfZPDec6pGTr8Ze+/3NTZGMLf6/KGijVpu1E3e+2F02o25ITY8qRiF7bS2yPAJVOUp/EtJW2LRzwJOpu3DBxQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716634803; c=relaxed/simple; bh=LZvXYMiHOVOJ9bHLljR1O/39ahgXrVwf2Tu33KfAIa0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Hc2h6Acm9DYqd3dZIknrCW+R76RHCIr+AwJno1yc65jeG5/IozC2i/ovYUk37zTF6ZtXn74DzVBR5JLTrza+TNOJpR10NQokHu2roD86ee9UBkxFyns/RB8NZ43JZMfxcOPkm18xb1277Td/LfeKAbTdIMAi/nw1t3Rmg8FS+78= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4Vmf7M3xfMz4f3jMS; Sat, 25 May 2024 18:59:43 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id A3F091A01B9; Sat, 25 May 2024 18:59:52 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgBHZQ6mxFFm87GJNg--.25077S5; Sat, 25 May 2024 18:59:52 +0800 (CST) From: linan666@huaweicloud.com To: song@kernel.org, yukuai3@huawei.com Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linan666@huaweicloud.com, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com Subject: [PATCH 1/2] md: change the return value type of md_write_start to void Date: Sun, 26 May 2024 02:52:56 +0800 Message-Id: <20240525185257.3896201-2-linan666@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240525185257.3896201-1-linan666@huaweicloud.com> References: <20240525185257.3896201-1-linan666@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgBHZQ6mxFFm87GJNg--.25077S5 X-Coremail-Antispam: 1UD129KBjvJXoWxJFy5XFy8Gr18Zw47Kw1Dtrb_yoWrAFy3p3 92yFy5Zw4jq3y5X3WDCFWDua45Jw1xKrZFyFW7C34rX3ZxWFWDGa15XayFqrn8uas3C3sI q3Z0yayUuF1IqFUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUmG14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2048vs2IY02 0E87I2jVAFwI0_Jr4l82xGYIkIc2x26xkF7I0E14v26r1I6r4UM28lY4IEw2IIxxk0rwA2 F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjx v20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2 jsIEc7CjxVAFwI0_GcCE3s1lnxkEFVAIw20F6cxK64vIFxWle2I262IYc4CY6c8Ij28IcV AaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0E x4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI 8F5VA0II8E6IAqYI8I648v4I1lw4CEc2x0rVAKj4xxMxAIw28IcxkI7VAKI48JMxC20s02 6xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_Jr I_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v2 6r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj4 0_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8 JrUvcSsGvfC2KfnxnUUI43ZEXa7sR_PrcUUUUUU== X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ From: Li Nan Commit cc27b0c78c79 ("md: fix deadlock between mddev_suspend() and md_write_start()") aborted md_write_start() with false when mddev is suspended, which fixed a deadlock if calling mddev_suspend() with holding reconfig_mutex(). Since mddev_suspend() now includes lockdep_assert_not_held(), it no longer holds the reconfig_mutex. This makes previous abort unnecessary. Now, remove unnecessary abort and change function return value to void. Signed-off-by: Li Nan --- drivers/md/md.h | 2 +- drivers/md/md.c | 14 ++++---------- drivers/md/raid1.c | 3 +-- drivers/md/raid10.c | 3 +-- drivers/md/raid5.c | 3 +-- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/md/md.h b/drivers/md/md.h index ca085ecad504..487582058f74 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -785,7 +785,7 @@ extern void md_unregister_thread(struct mddev *mddev, struct md_thread __rcu **t extern void md_wakeup_thread(struct md_thread __rcu *thread); extern void md_check_recovery(struct mddev *mddev); extern void md_reap_sync_thread(struct mddev *mddev); -extern bool md_write_start(struct mddev *mddev, struct bio *bi); +extern void md_write_start(struct mddev *mddev, struct bio *bi); extern void md_write_inc(struct mddev *mddev, struct bio *bi); extern void md_write_end(struct mddev *mddev); extern void md_done_sync(struct mddev *mddev, int blocks, int ok); diff --git a/drivers/md/md.c b/drivers/md/md.c index 509e5638cea1..14d6e615bcbb 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -8638,12 +8638,12 @@ EXPORT_SYMBOL(md_done_sync); * A return value of 'false' means that the write wasn't recorded * and cannot proceed as the array is being suspend. */ -bool md_write_start(struct mddev *mddev, struct bio *bi) +void md_write_start(struct mddev *mddev, struct bio *bi) { int did_change = 0; if (bio_data_dir(bi) != WRITE) - return true; + return; BUG_ON(mddev->ro == MD_RDONLY); if (mddev->ro == MD_AUTO_READ) { @@ -8676,15 +8676,9 @@ bool md_write_start(struct mddev *mddev, struct bio *bi) if (did_change) sysfs_notify_dirent_safe(mddev->sysfs_state); if (!mddev->has_superblocks) - return true; + return; wait_event(mddev->sb_wait, - !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags) || - is_md_suspended(mddev)); - if (test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)) { - percpu_ref_put(&mddev->writes_pending); - return false; - } - return true; + !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags)); } EXPORT_SYMBOL(md_write_start); diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 7b8a71ca66dd..0d80ff471c73 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1687,8 +1687,7 @@ static bool raid1_make_request(struct mddev *mddev, struct bio *bio) if (bio_data_dir(bio) == READ) raid1_read_request(mddev, bio, sectors, NULL); else { - if (!md_write_start(mddev,bio)) - return false; + md_write_start(mddev,bio); raid1_write_request(mddev, bio, sectors); } return true; diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index a4556d2e46bf..f8d7c02c6ed5 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1836,8 +1836,7 @@ static bool raid10_make_request(struct mddev *mddev, struct bio *bio) && md_flush_request(mddev, bio)) return true; - if (!md_write_start(mddev, bio)) - return false; + md_write_start(mddev, bio); if (unlikely(bio_op(bio) == REQ_OP_DISCARD)) if (!raid10_handle_discard(mddev, bio)) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 2bd1ce9b3922..a84389311dd1 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -6078,8 +6078,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi) ctx.do_flush = bi->bi_opf & REQ_PREFLUSH; } - if (!md_write_start(mddev, bi)) - return false; + md_write_start(mddev, bi); /* * If array is degraded, better not do chunk aligned read because * later we might have to read it again in order to reconstruct -- 2.39.2