From patchwork Wed Sep 11 08:54:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799961 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 5719D15B0FE for ; Wed, 11 Sep 2024 08:54:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044887; cv=none; b=ReUSqBZoVf52tLj8hHmjJ8/FjKFzRDMITpxJktamncbZLHD7kfiSYw4Ns7w52sI4Kk7lEQeu29mrRQ5kva5wpTcmW+PHSWYV+6jIHrS26zjToHoUZGHp4ttp9jlfTDyfxO9eVhe2l1DsAruq4NzAxorJKgn7dsHNTokOvucpQqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044887; c=relaxed/simple; bh=ua/FYaODjHmjPDdhksun0THTWHHqhZssw4kaDnaeFOc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ihgOO6qAr2ut+T/ADPHUNreVzTyL1lIxYtq9QVYBx5bQX0mugp6FfpVnXJks4xWcvXjj6E95BNvNYXJK1Pwg5qa3pjAd8rRC8MazbmMRjZfnS5zBkebkIHe1kHWA4jqcu+CEiGygCgJWnBHqds4qsP+UXbO0UrFmA3lHLIgM4Iw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cqJhSHlK; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cqJhSHlK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TDrzRtQK5HXJvwcCoGJt29uDGncvitlKBo/++7u52BI=; b=cqJhSHlKeGQHRwWMWPxGjiFbqDO8gp/eQNhDb2wCxw4LRhISgFUG4Coy4jAw7c3xzoVIrQ fF/HymBvSlK2IZrnQ6lWoxoNXwq+PLzZF4deoLEf/2FRE8YgPOrJUIZnZsrJ3GtQa6DLKe FhRsJGqtCLxwKtgNY2A+Bcu0xavFSPc= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-438-vc4Mo8JvOeC5KWqgYjBnlw-1; Wed, 11 Sep 2024 04:54:43 -0400 X-MC-Unique: vc4Mo8JvOeC5KWqgYjBnlw-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D4F6C1955D55; Wed, 11 Sep 2024 08:54:41 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5F56A195608A; Wed, 11 Sep 2024 08:54:38 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH V2 1/1] mdadm/Grow: Update new level when starting reshape Date: Wed, 11 Sep 2024 16:54:23 +0800 Message-Id: <20240911085432.37828-2-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Reshape needs to specify a backup file when it can't update data offset of member disks. For this situation, first, it starts reshape and then it kicks off mdadm-grow-continue service which does backup job and monitors the reshape process. The service is a new process, so it needs to read superblock from member disks to get information. But in the first step, it doesn't update new level in superblock. So it can't change level after reshape finishes, because the new level is not right. So records the new level in the first step. Signed-off-by: Xiao Ni --- v2: format change, add get_linux_version Grow.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Grow.c b/Grow.c index 5810b128aa99..533f301468af 100644 --- a/Grow.c +++ b/Grow.c @@ -2941,15 +2941,24 @@ static int impose_reshape(struct mdinfo *sra, * persists from some earlier problem. */ int err = 0; + if (sysfs_set_num(sra, NULL, "chunk_size", info->new_chunk) < 0) err = errno; + if (!err && sysfs_set_num(sra, NULL, "layout", reshape->after.layout) < 0) err = errno; + + /* new_level is introduced in kernel 6.12 */ + if (!err && get_linux_version() >= 6012000 && + sysfs_set_num(sra, NULL, "new_level", info->new_level) < 0) + err = errno; + if (!err && subarray_set_num(container, sra, "raid_disks", reshape->after.data_disks + reshape->parity) < 0) err = errno; + if (err) { pr_err("Cannot set device shape for %s\n", devname); From patchwork Wed Sep 11 08:54:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799962 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 0852116EC1B for ; Wed, 11 Sep 2024 08:54:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044892; cv=none; b=FmmvhFt+R+Ga1Q5XtkYADNmQ1PvLy+KxwL+5/SIXvR/M02g9K0aTnOjxS5uMeFQ9DaUm36yhC4j5iZ5lAIMCmoQl16OaLQJeplmH40WdzhusTt+65FiAOfbXnsPue/4wQZjQP01R+x7tHMQRkYTQRv59dDD8Ff27Wut+2k4EFfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044892; c=relaxed/simple; bh=jYMSKKeoa+ORWQeKeqzkW2dP+EEVWlS8rS6izULQ3xw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iyp61iv4Cs+4SXpu51y5hwdYMbXEZrwcYDxYelSR6RXDX+OsX1P5y8CabkO4S8YR62UUyYHyTQQdc85+fGOK4Jvb7dUVq+p97s+j+cIEtsYUuqs8lbgfp2guTstkzrs/9HYqMy2c+acCxj4r5snKnVg7TXEHLr2Sr+9RUtjM/O0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JhjNaJja; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JhjNaJja" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mfxDnS7ExbPa4uvLftFRKyLdAS3ZcbvkBVeKamzO26g=; b=JhjNaJjaxKOm1n1MEyh/BIdAVn4dOHU9RwdMlMUL3R/k25dmbzzVhcKgZvtwOGhoFsMSc1 LqgM3mRVrMXbXKpQopHCLj9CLusgA63jyw+82mPg/+OB/Kfo60J3VrZR/FLZPAujIbajIZ DFdN77RXob/IXrDHNVSOjo6/TGc+okA= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-663-7VUIDpHPM2azmKlNGtRtvA-1; Wed, 11 Sep 2024 04:54:46 -0400 X-MC-Unique: 7VUIDpHPM2azmKlNGtRtvA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 962EE1955DC4; Wed, 11 Sep 2024 08:54:45 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F0A101956086; Wed, 11 Sep 2024 08:54:42 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH V2 2/2] mdadm/Grow: Update reshape_progress to need_back after reshape finishes Date: Wed, 11 Sep 2024 16:54:24 +0800 Message-Id: <20240911085432.37828-3-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 It tries to update data offset when kicking off reshape. If it can't change data offset, it needs to use child_monitor to monitor reshape progress and do back up job. And it needs to update reshape_progress to need_back when reshape finishes. If not, it will be in a infinite loop. Signed-off-by: Xiao Ni --- v2: add empty line after declaration Grow.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Grow.c b/Grow.c index 533f301468af..3b9f994200aa 100644 --- a/Grow.c +++ b/Grow.c @@ -4148,8 +4148,8 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape, * waiting forever on a dead array */ char action[SYSFS_MAX_BUF_SIZE]; - if (sysfs_get_str(info, NULL, "sync_action", action, sizeof(action)) <= 0 || - strncmp(action, "reshape", 7) != 0) + + if (sysfs_get_str(info, NULL, "sync_action", action, sizeof(action)) <= 0) break; /* Some kernels reset 'sync_completed' to zero * before setting 'sync_action' to 'idle'. @@ -4157,12 +4157,18 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape, */ if (completed == 0 && advancing && strncmp(action, "idle", 4) == 0 && - info->reshape_progress > 0) + info->reshape_progress > 0) { + info->reshape_progress = need_backup; break; + } if (completed == 0 && !advancing && strncmp(action, "idle", 4) == 0 && info->reshape_progress < - (info->component_size * reshape->after.data_disks)) + (info->component_size * reshape->after.data_disks)) { + info->reshape_progress = need_backup; + break; + } + if (strncmp(action, "reshape", 7) != 0) break; sysfs_wait(fd, NULL); if (sysfs_fd_get_ll(fd, &completed) < 0) From patchwork Wed Sep 11 08:54:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799963 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 100D115EFB9 for ; Wed, 11 Sep 2024 08:54:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044893; cv=none; b=GBRr3JDeIsx4DMTW4/Wm//mNoptr0UXNkkXp1rfLzzM4B/3Jgpx/GtIxIQqEu/DyWffvyJyVXPDwphd2qOZ5ouPJrPfiMkcdu+7+gUYgprjBjhYzGi8kiw/rfDAh5E6ieSiaWcHGIS5tk99Vkp6Sh+sqMxoL7Xba1zL5/BVSTfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044893; c=relaxed/simple; bh=QhSYxdhsq3hvM2Nd7sjS3TUsSIhsjWOKWBEziaPJ8i4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=s7E4WgLaqZDc4skP6YMlr8QdM8r/PHtH1h+itHR/rVopy+D8kCqa0+wSu+hGPf0qQnLKzYattfFEp0jLQKNxDlpN79fsrJc1g+mZz2Jfmd2h8z4eTjuu9xmAO8d/k1Hj9v7byEA+Bnx4+qDGL9WicHm40NPUcqoh3IANoTDO79I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZibtNhqp; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZibtNhqp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/HC0VZKh/qNGFi7wtrdTq0IQi5hLwfOqLQKq/H2n9vk=; b=ZibtNhqpktUOqLiPGkYIYkXWMyCxlRDs71AYOfKgPxO9WiorD9kjTY40+cRS9SZNUvYYF1 W1s78hiODFvBCZo9r2RF9o+7NLqud6/z9Y3+z1C6sr8zRk63SaB84+SZ7P6uanhCK9fjPO dSwFYk0ggQfRKtSk3Ah9EpRytcTDoi4= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-a1tt4afGOj2YioXHMrYjjQ-1; Wed, 11 Sep 2024 04:54:49 -0400 X-MC-Unique: a1tt4afGOj2YioXHMrYjjQ-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C5E631953965; Wed, 11 Sep 2024 08:54:48 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 613A0195608A; Wed, 11 Sep 2024 08:54:45 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH 03/10] mdadm/Grow: Can't open raid when running --grow --continue Date: Wed, 11 Sep 2024 16:54:25 +0800 Message-Id: <20240911085432.37828-4-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 It passes 'array' as devname in Grow_continue. So it fails to open raid device. Use mdinfo to open raid device. Signed-off-by: Xiao Ni --- Grow.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Grow.c b/Grow.c index 6b621aea4ecc..2a7587315817 100644 --- a/Grow.c +++ b/Grow.c @@ -3688,9 +3688,12 @@ started: set_array_size(st, info, info->text_version); if (info->new_level != reshape.level) { - if (fd < 0) - fd = open(devname, O_RDONLY); - impose_level(fd, info->new_level, devname, verbose); + fd = open_dev(sra->sys_name); + if (fd < 0) { + pr_err("Can't open %s\n", sra->sys_name); + goto out; + } + impose_level(fd, info->new_level, sra->sys_name, verbose); close(fd); if (info->new_level == 0) st->update_tail = NULL; From patchwork Wed Sep 11 08:54:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799964 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 AE34516BE20 for ; Wed, 11 Sep 2024 08:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044898; cv=none; b=Ml/xe7d1sdsYaNbaKzoxAlXqeJ6yMfFhV9+Tdl94HmTgARw+DL1UbYiPGtiLTBIolZlfid1yYEU0ev4OVHvK/OYA/UhbfTnGuIjXbAlB32fGcjMSbmqEHwSjUMm0ZhKc6J44dlOv4q1o8wBnqkmAHyDq1GPSMHIpphfvduSA/mI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044898; c=relaxed/simple; bh=LSvYbW9kcj+RRSVffoEa1a2vnLzAzbyaqBSrvir4zkU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=L0bVUbJAkjP6tCohka0hnfzozAip/271/Y1R8AMJZC/RpVcylOeZC/qFt5gT20WrWEqA0lVN3QjLo/5QRaTpossmZjyl0kQiGvJXdJPlf72PqE8EGA250kFKBS8VJckinJ25Br1rldT9+7wGzCjkFgvsMd3VEIBQGvo9y+n5zOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cz9UzN0k; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cz9UzN0k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ooleHeqN2lGXjv0S+2TWorgSGK9FJvdY80iru/XKGaY=; b=cz9UzN0k1X2K+Kq6d2T4DlzYCFez4yOz5CfkuB/oEuoIPcMJ5wFpWf+pFDktnHUmIJPk1l GRH2dVoIIIppHQ9y4xpU0Lveo1WZlGze3Ixs/oSfoS6QD1lwyUZtGQff3z9ENXRPdNjBQe 2NOSYRwDtakzWv8MwBQ1HQgG1tnnvR8= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-290-RFaureYQPemhxFHr5XAOwA-1; Wed, 11 Sep 2024 04:54:53 -0400 X-MC-Unique: RFaureYQPemhxFHr5XAOwA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 61E7E1955DB2; Wed, 11 Sep 2024 08:54:52 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C28B21956086; Wed, 11 Sep 2024 08:54:49 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH v2 4/4] mdadm/Grow: sleep a while after removing disk in impose_level Date: Wed, 11 Sep 2024 16:54:26 +0800 Message-Id: <20240911085432.37828-5-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 It needs to remove disks when reshaping from raid456 to raid0. In kernel space it sets MD_RECOVERY_RUNNING. And it will fail to change level. So wait sometime to let md thread to clear this flag. This is found by test case 05r6tor0. Signed-off-by: Xiao Ni --- v2: add log to give friendly message Grow.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Grow.c b/Grow.c index ebb53a0dfe9c..60076f56054c 100644 --- a/Grow.c +++ b/Grow.c @@ -3034,6 +3034,13 @@ static int impose_level(int fd, int level, char *devname, int verbose) makedev(disk.major, disk.minor)); hot_remove_disk(fd, makedev(disk.major, disk.minor), 1); } + /* + * hot_remove_disk lets kernel set MD_RECOVERY_RUNNING + * and it can't set level. It needs to wait sometime + * to let md thread to clear the flag. + */ + pr_info("wait 5 seconds to give kernel space to finish job\n"); + sleep_for(5, 0, true); } c = map_num(pers, level); if (c) { From patchwork Wed Sep 11 08:54:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799965 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 0751616BE20 for ; Wed, 11 Sep 2024 08:54:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044901; cv=none; b=Uzl9/xsffuTGdGQ6Uv/A8uQ3F3plD27pFELAV9Q27wvhPsHnF0lcFG2QiVaJYa7o21Ttu0aqUUZW0Jop0PCX9z4iFkNmMNzQBtoKoSO9jPSgkBeT9lLOOx0+RkbqAmpPRVYIdRllLMZ2rFAP31oAca97ujOC1kIgDAjEkeCOnHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044901; c=relaxed/simple; bh=q3mdBdhvEPP3XCQSyxUjsSgFizaFpUqhVjHpdv/xslg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TDGZpwJiGPsQYm4WfsNuYZhxatq8YrQiiX9OjC2L9q1rA/MrqT5tl4Pp81A5wsW9IhYjty7qVfV0u2QDwoEaWDQemGNhVFaJlZhTNZ8aKos5+s8n4KJZtQ8SYdw1LHPbfIGOuAPggdxYniGNcvlMqOeCbn3hFJ5Zrm+Dgnp1aRc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XEna9D9W; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XEna9D9W" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a+1VjOfx8xpJDgToWYqTQnaqNxwgZ+emJVaCvXR4SzY=; b=XEna9D9WBaHRigJKa/h2krbQwY40mZbI0hKZu+hYAOBniYZ7u6bw0616x9X7wKcekxkhH7 dDnMDe4g0Ujly60Q2HptZremqxG50nTYu87/wqYMZu+6epZkGmRkIFmG6mav+YuhmSIcCy zd+2jp3vFoZp5Sz/0kUaPfdVHUxP7o4= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-18-q8QuZA-BPOSbOJE0bvPLKg-1; Wed, 11 Sep 2024 04:54:57 -0400 X-MC-Unique: q8QuZA-BPOSbOJE0bvPLKg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A818619773C6; Wed, 11 Sep 2024 08:54:56 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 28AA11956086; Wed, 11 Sep 2024 08:54:52 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH 05/10] mdadm/tests: wait until level changes Date: Wed, 11 Sep 2024 16:54:27 +0800 Message-Id: <20240911085432.37828-6-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 check wait waits reshape finishes, but it doesn't wait level changes. The level change happens in a forked child progress. So we need to search the child progress and monitor it. Signed-off-by: Xiao Ni --- tests/05r6tor0 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/05r6tor0 b/tests/05r6tor0 index 2fd51f2ea4bb..b2685b721c2e 100644 --- a/tests/05r6tor0 +++ b/tests/05r6tor0 @@ -13,6 +13,10 @@ check raid5 testdev $md0 3 19456 512 mdadm -G $md0 -l0 check wait; sleep 1 +while ps auxf | grep "mdadm -G" | grep -v grep +do + sleep 1 +done check raid0 testdev $md0 3 19456 512 mdadm -G $md0 -l5 --add $dev3 $dev4 From patchwork Wed Sep 11 08:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799966 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 2D84A1802DD for ; Wed, 11 Sep 2024 08:55:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044908; cv=none; b=ruTlDlCvN11zJPsIih1Sg5dFWGs9h2Omc5iyAesFFNk4IvrcnpbLhrjD/6vWQWd49I98JEQ3qwLNEGdeDZ2IqFqQu5fvNQs900Mj+e8Yrs+gJGVDSUoZK0O+ygx6D+MHk3GjgY1FJDW6vajMEiVXZUkOW/gdKScl5qyOxoRRyT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044908; c=relaxed/simple; bh=NlIXywn103hmbIvNI7t45fJ7x57KZ2xFODYgbsr3fbI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lAsyV38NmQfiZ9oh9MaXcys0s20+Atuw2Bn4J69m1D4rLn9ZkFx0JNW3I7B6jyF+xEPErIWt7lMPJPQfgLPF+jJBG2aUfuITQR+1J1vxFQfCCgpyAy0h1TW8ODasgH0vWiYpQSEpGTbXaQQaFH3G6quxZ9sCc6YGptOAJQgtfTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=C6kcUMjk; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C6kcUMjk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/ZEBkdeVCLuo/Jd6z7j1RE6T3dAcznWBnGYmgr5DDUo=; b=C6kcUMjkNoHGUAaIbIkPyni19NI+fycrKpDSfeiKY+cZzsv1GNMoiGzlwaqLv/QBkkhfhm b76rusQ52BtlZfoPUvzpvUeWTkGZ8/6cecl576DgB57bWCQPzEweI4Mc5RMPeFgGroADAd YGYVWxSx4bHhYEAjsdYbtt9wRhuNoT4= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-209-8HWUP4y9M-Cc_Zi_7zO-5w-1; Wed, 11 Sep 2024 04:55:01 -0400 X-MC-Unique: 8HWUP4y9M-Cc_Zi_7zO-5w-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 53FA3197702F; Wed, 11 Sep 2024 08:54:59 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A5BCB1956066; Wed, 11 Sep 2024 08:54:56 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH 06/10] mdadm/tests: 07changelevels fix Date: Wed, 11 Sep 2024 16:54:28 +0800 Message-Id: <20240911085432.37828-7-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 There are five changes to this case. 1. remove testdev check. It can't work anymore and check if it's a block device directly. 2. It can't change level and chunk size at the same time 3. Sleep more than 10s before check wait. The test devices are small. Sometimes it can finish so quickly once the reshape just starts. mdadm will be stuck before it waits reshape to start. So the sync speed is limited. And it restores the sync speed when it waits reshape to finish. It's good for case without backup file. It uses systemd service mdadm-grow-continue to monitor reshape progress when specifying backup file. If reshape finishes so quickly before it starts monitoring reshape progress, the daemon will be stuck too. Because reshape_progress is 0 which means the reshape hasn't been started. So give more time to let service can get right information from kernel space. But before getting these information. It needs to suspend array. At the same time the reshape is running. The kernel reshape daemon will update metadata 10s. So it needs to limit the sync speed more than 10s before restoring sync speed. Then systemd service can suspend array and start monitoring reshape progress. 4. Wait until mdadm-grow-continue service exits mdadm --wait doesn't wait systemd service. For the case that needs backup file, systemd service deletes the backup file after reshape finishes. In this test case, it runs next case when reshape finishes. And it fails because it can't create backup file because the backup file exits. 5. Don't reshape from raid5 to raid1. It can't work now. Signed-off-by: Xiao Ni --- tests/07changelevels | 27 ++++++++++++--------------- tests/07changelevels.broken | 9 --------- tests/func.sh | 4 ++++ 3 files changed, 16 insertions(+), 24 deletions(-) delete mode 100644 tests/07changelevels.broken diff --git a/tests/07changelevels b/tests/07changelevels index a328874ac43f..3df8660e6bae 100644 --- a/tests/07changelevels +++ b/tests/07changelevels @@ -10,7 +10,6 @@ export MDADM_GROW_VERIFY=1 dotest() { sleep 2 check wait - testdev $md0 $1 19968 64 nd blockdev --flushbufs $md0 cmp -s -n $[textK*1024] $md0 /tmp/RandFile || { echo cmp failed; exit 2; } # write something new - shift chars 4 space @@ -24,7 +23,7 @@ checkgeo() { # level raid_disks chunk_size layout dev=$1 shift - sleep 0.5 + sleep 15 check wait sleep 1 for attr in level raid_disks chunk_size layout @@ -43,22 +42,25 @@ checkgeo() { bu=/tmp/md-test-backup rm -f $bu -mdadm -CR $md0 -l1 -n2 -x1 $dev0 $dev1 $dev2 -z 19968 -testdev $md0 1 $mdsize1a 64 +mdadm -CR $md0 -l1 -n2 -x1 $dev0 $dev1 $dev2 +[ -b $md0 ] || die "$1 isn't a block device." dd if=/tmp/RandFile of=$md0 dotest 1 -mdadm --grow $md0 -l5 -n3 --chunk 64 +mdadm --grow $md0 -l5 -n3 +checkgeo md0 raid5 3 dotest 2 mdadm $md0 --add $dev3 $dev4 mdadm --grow $md0 -n4 --chunk 32 +checkgeo md0 raid5 4 $[32*1024] dotest 3 mdadm -G $md0 -l6 --backup-file $bu +checkgeo md0 raid6 5 $[32*1024] dotest 3 -mdadm -G /dev/md0 --array-size 39936 +mdadm -G /dev/md0 --array-size 37888 mdadm -G $md0 -n4 --backup-file $bu checkgeo md0 raid6 4 $[32*1024] dotest 2 @@ -67,14 +69,11 @@ mdadm -G $md0 -l5 --backup-file $bu checkgeo md0 raid5 3 $[32*1024] dotest 2 -mdadm -G /dev/md0 --array-size 19968 +mdadm -G /dev/md0 --array-size 18944 mdadm -G $md0 -n2 --backup-file $bu checkgeo md0 raid5 2 $[32*1024] dotest 1 -mdadm -G --level=1 $md0 -dotest 1 - # now repeat that last few steps only with a degraded array. mdadm -S $md0 mdadm -CR $md0 -l6 -n5 $dev0 $dev1 $dev2 $dev3 $dev4 @@ -83,7 +82,7 @@ dotest 3 mdadm $md0 --fail $dev0 -mdadm -G /dev/md0 --array-size 37888 +mdadm -G /dev/md0 --array-size 35840 mdadm -G $md0 -n4 --backup-file $bu dotest 2 checkgeo md0 raid6 4 $[512*1024] @@ -103,12 +102,10 @@ dotest 2 mdadm -G $md0 -l5 --backup-file $bu dotest 2 -mdadm -G /dev/md0 --array-size 18944 +mdadm -G /dev/md0 --array-size 17920 mdadm -G $md0 -n2 --backup-file $bu dotest 1 checkgeo md0 raid5 2 $[512*1024] mdadm $md0 --fail $dev2 -mdadm -G --level=1 $md0 -dotest 1 -checkgeo md0 raid1 2 +mdadm -S $md0 diff --git a/tests/07changelevels.broken b/tests/07changelevels.broken index 9b930d932c48..000000000000 --- a/tests/07changelevels.broken +++ /dev/null @@ -1,9 +0,0 @@ -always fails - -Fails with errors: - - mdadm: /dev/loop0 is smaller than given size. 18976K < 19968K + metadata - mdadm: /dev/loop1 is smaller than given size. 18976K < 19968K + metadata - mdadm: /dev/loop2 is smaller than given size. 18976K < 19968K + metadata - - ERROR: /dev/md0 isn't a block device. diff --git a/tests/func.sh b/tests/func.sh index e7ccc4fc66eb..567d91d9173e 100644 --- a/tests/func.sh +++ b/tests/func.sh @@ -362,6 +362,10 @@ check() { do sleep 0.5 done + while ps auxf | grep "mdadm --grow --continue" | grep -v grep + do + sleep 1 + done echo $min > /proc/sys/dev/raid/speed_limit_min echo $max > /proc/sys/dev/raid/speed_limit_max ;; From patchwork Wed Sep 11 08:54:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799967 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 42EE817F500 for ; Wed, 11 Sep 2024 08:55:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044908; cv=none; b=YiyVjdcI26ld/xpbIIPLc8JjOVfEVVG2jvCBSNCAr1lRQ+xFB+4T9zkhYkKvgSn/gSGJij+2kBJyMh+Z8IIbOqQuXq+wUMufuOAttt+oKbwQ4q6YstWGtsmDxVfLx/eBn9IZp6zKF/1EpbVrZlL1Lncmy6jy1f28fSOWR0nPgX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044908; c=relaxed/simple; bh=3R5bjZW2k+13MxV8qtgaazliryK+LB595Y/ZnuaZfu0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tSU3s6rUGWHlIjQ4ZBqA4OdrBZRZQ+ji2J6teh3YWZPNfd4dhjtZmPp9+K3XtD5ahfuFhCARsU0AIwLzyKd6MLDW/uQ4ecPJLjJoWOwJNa7Aha/WEbCAAd1JrM7kFtMkkyxBUHsZUJT49ySSeiiMqk06Qut45pB6UGhuA8jCbEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hn1umpI+; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hn1umpI+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qOjV1DD5nLgIPRR5RHA+HtBbJtXk+/9yuAPgArD0GCU=; b=hn1umpI++JNZdvQhV6gJ0GuRRVauxK+wpbIu9saS1HbiMGargMJKb0f35sKLKTS/myT+nn OXAu0ZxRPsBtuXWpcyiKBafJbFF0ZK8ekskjAIDZBXpEIyOES7QNDlFmZ0Fdob7GLhZc+H 38RHlkeaoBhO45Di56Adobvhke2tn1Q= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-hHRQ29k0PMm3KdE71Phpgg-1; Wed, 11 Sep 2024 04:55:04 -0400 X-MC-Unique: hHRQ29k0PMm3KdE71Phpgg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A9C5A1955D47; Wed, 11 Sep 2024 08:55:02 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 245DC1956086; Wed, 11 Sep 2024 08:54:59 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH 07/10] mdadm/tests: Remove 07reshape5intr.broken Date: Wed, 11 Sep 2024 16:54:29 +0800 Message-Id: <20240911085432.37828-8-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 07reshape5intr can run successfully now. Signed-off-by: Xiao Ni --- tests/07reshape5intr.broken | 45 ------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 tests/07reshape5intr.broken diff --git a/tests/07reshape5intr.broken b/tests/07reshape5intr.broken index efe52a667172..000000000000 --- a/tests/07reshape5intr.broken +++ /dev/null @@ -1,45 +0,0 @@ -always fails - -This patch, recently added to md-next causes the test to always fail: - -7e6ba434cc60 ("md: don't unregister sync_thread with reconfig_mutex -held") - -The new error is simply: - - ERROR: no reshape happening - -Before the patch, the error seen is below. - --- - -fails infrequently - -Fails roughly 1 in 4 runs with errors: - - mdadm: Merging with already-assembled /dev/md/0 - mdadm: cannot re-read metadata from /dev/loop6 - aborting - - ERROR: no reshape happening - -Also have seen a random deadlock: - - INFO: task mdadm:109702 blocked for more than 30 seconds. - Not tainted 5.18.0-rc3-eid-vmlocalyes-dbg-00095-g3c2b5427979d #2040 - "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. - task:mdadm state:D stack: 0 pid:109702 ppid: 1 flags:0x00004000 - Call Trace: - - __schedule+0x67e/0x13b0 - schedule+0x82/0x110 - mddev_suspend+0x2e1/0x330 - suspend_lo_store+0xbd/0x140 - md_attr_store+0xcb/0x130 - sysfs_kf_write+0x89/0xb0 - kernfs_fop_write_iter+0x202/0x2c0 - new_sync_write+0x222/0x330 - vfs_write+0x3bc/0x4d0 - ksys_write+0xd9/0x180 - __x64_sys_write+0x43/0x50 - do_syscall_64+0x3b/0x90 - entry_SYSCALL_64_after_hwframe+0x44/0xae From patchwork Wed Sep 11 08:54:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799968 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 9DA3A17F500 for ; Wed, 11 Sep 2024 08:55:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044913; cv=none; b=TOsrl3rFcJQBBcLOVhml9sv4Wy05K/CdUwr8MIrwp/A1dbL3lTTbBFQR8nMtLpq/B5YDljB6mn/xLHThkNVSI9dh+NrKFRWzaFwbtBsu/sFAcBxlAbSjyMUMhej4GE8iQ1g61h4s4WHdLpkBhg7UTxzUGKbbIm4W5tWqKK49t+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044913; c=relaxed/simple; bh=8PqiUkFVBO/ty1x89DfvANMtc9MNw1bLGJfMq5PzzOc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KxJAQ38SKDNKolvB6kpyUb/arXEzugZw6DG6iHTdz32unSfx4qnwt9ldvWRYVtjNMX/zQXBRrpItBKk7QUq3a48BzOOvLen3qrS+0nvxrMgUU72TT1x7D522OYbOrd7kiGbDnU1aYthmtp9f+t542sRJgtEr62XViw0U6PTvkuk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ReQ6g4Cu; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ReQ6g4Cu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1hTP7jiUhayaW8uExnNuDO1aX1pMU5eDC1T6UohjVIo=; b=ReQ6g4CubCIUxIM3siDa5X0SBH6hmJErBUSbCcibGwqJyvRYkIOO9LsqK45aE6JIeQHg+x YYnGLWNTwE8NiTpOdHyvGv1oHqTGypW/BohTXkDlrdu5z6oV8eqJQR2gODlx1Jfi1lAHXv fAcIppfx3D2n5fn+sKeGf3NZAY3J8sg= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-371-b65YinnBPG6Laa2r2rD2lQ-1; Wed, 11 Sep 2024 04:55:07 -0400 X-MC-Unique: b65YinnBPG6Laa2r2rD2lQ-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 390951958B1D; Wed, 11 Sep 2024 08:55:06 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 909C01956086; Wed, 11 Sep 2024 08:55:03 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH 08/10] mdadm/tests: 07testreshape5 fix Date: Wed, 11 Sep 2024 16:54:30 +0800 Message-Id: <20240911085432.37828-9-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Init dir to avoid test failure. Signed-off-by: Xiao Ni --- tests/07testreshape5 | 1 + tests/07testreshape5.broken | 12 ------------ 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 tests/07testreshape5.broken diff --git a/tests/07testreshape5 b/tests/07testreshape5 index 0e1f25f98bc8..d90fd15e0e61 100644 --- a/tests/07testreshape5 +++ b/tests/07testreshape5 @@ -4,6 +4,7 @@ # kernel md code to move data into and out of variously # shaped md arrays. set -x +dir="." layouts=(la ra ls rs) for level in 5 6 do diff --git a/tests/07testreshape5.broken b/tests/07testreshape5.broken index a8ce03e491b3..000000000000 --- a/tests/07testreshape5.broken +++ /dev/null @@ -1,12 +0,0 @@ -always fails - -Test seems to run 'test_stripe' at $dir directory, but $dir is never -set. If $dir is adjusted to $PWD, the test still fails with: - - mdadm: /dev/loop2 is not suitable for this array. - mdadm: create aborted - ++ return 1 - ++ cmp -s -n 8192 /dev/md0 /tmp/RandFile - ++ echo cmp failed - cmp failed - ++ exit 2 From patchwork Wed Sep 11 08:54:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799969 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 C26091714A1 for ; Wed, 11 Sep 2024 08:55:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044916; cv=none; b=lFpkERdafvqVLZuMfkjJuPSIrjQvUNsKK1KZH6V7hb2c1WJfzM3f3gSWWM1kp+Or60Kziecuk9qgFSyq0oaBSs1dOIXV0SJvqZ+XTTDfihitPbjWbS06wenz/2bxpEQtAg0vxzi5tSBfnL1WmJS8vymmZTjwKFKbOIXjlqhvXb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044916; c=relaxed/simple; bh=vKFkNuEedEjjKQPRKZIOznDQ6HPCvciNpWM/fv8O0lE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KDXT9qhaHN8XUBbKvEbWwowt+YbE7o1TGVLjlN00v9Qd0450+9DsaUfwGbIEwzHGXhc1glrbHuWNXnwhw2sFKas7XiGOR2xxgwLFhhB4K14sv6VK6rFpLm4h3patnSji6GKVKqpxDbWFrwLb7rqGMbIU8pPspDXh3ynFNWOrmAY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ahV2asOh; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ahV2asOh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wO51OinyxmL8YM6r78uSv88XCuoLuUrLG9NsHQWm1ZM=; b=ahV2asOhWwZSUvQzUmvMiI/1TxbHkJcw3H7Qk+6piEiw8abOZJ9aGnStmj3rruM9YerGg0 bh5xw7JdHHFs1R5HD7PR0P9+aEbik92SPx0TMiw6FpDHhaza/YttZkPE9maHTPlVbkxtVl gYBH3IGNmWte8CCh3Q/o0s9vUlbqBwQ= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-558-zvFk1B6tMnu3QM1k36XoQA-1; Wed, 11 Sep 2024 04:55:10 -0400 X-MC-Unique: zvFk1B6tMnu3QM1k36XoQA-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B38951955DC1; Wed, 11 Sep 2024 08:55:09 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 10D7B1956086; Wed, 11 Sep 2024 08:55:06 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH 09/10] mdadm/tests: remove 09imsm-assemble.broken Date: Wed, 11 Sep 2024 16:54:31 +0800 Message-Id: <20240911085432.37828-10-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 09imsm-assemble can run successfully. Signed-off-by: Xiao Ni --- tests/09imsm-assemble.broken | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 tests/09imsm-assemble.broken diff --git a/tests/09imsm-assemble.broken b/tests/09imsm-assemble.broken index a6d4d5cf911b..000000000000 --- a/tests/09imsm-assemble.broken +++ /dev/null @@ -1,6 +0,0 @@ -fails infrequently - -Fails roughly 1 in 10 runs with errors: - - mdadm: /dev/loop2 is still in use, cannot remove. - /dev/loop2 removal from /dev/md/container should have succeeded From patchwork Wed Sep 11 08:54:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Ni X-Patchwork-Id: 13799970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 0BE3D1714D3 for ; Wed, 11 Sep 2024 08:55:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044917; cv=none; b=mNCquBp2PAplP8POmy5tmNTtRcRWLFT3oQEyPQcwg9gSveGf9deTdpeuWJvrG2awqv3WdFObpS4dycCl4dyWsxZskCDsSsu8BQQBOzQaUNRnOud5iq96uRIOFQjce9XlE4+9WVu6nJsqaVVpnlA9+b/u2cXAM83Y5w9bbSS+mbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726044917; c=relaxed/simple; bh=igfVsssIvRAX/6DmDpKDYJ/OAv6zpJBv4CpmVx5nCvw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JWjTNuKmiNFlFoe6AshgUMyMvw/qqJrfj5BnNd1YJjSEUba/6+h7MHQJJeuy0lO2VUfyZHvocaM6djaLLqeh9DX20KzKcXuRycCXiHzCilc8RTeYcQoKsnt3VAL2RZPguT6d2IymbaVI722fr2wF6OHsgxYexIVsiU3KKCT+vhY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Oq8PDC6l; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Oq8PDC6l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726044915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wWH5gDud2ndQLIPMQhg3f5hHUoHebPVMFZppoap6NHw=; b=Oq8PDC6lsvtFXH/94GHf2C3cgyX4mphpP85KkmhuxJcZ2xQjL+yBI74NXCv3C+Ck2JMqcE DfGWHtPnxyFWUmBrFpiP77Xheh7GyTtiCZre8xQutNtSZV80of2iMsXjEiaHp1LJGU8Cib SAaepMfJGWHiLfZVIjXoebEdl448F9Q= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-284-LhSId8hYMsSSMhVH24RPmg-1; Wed, 11 Sep 2024 04:55:13 -0400 X-MC-Unique: LhSId8hYMsSSMhVH24RPmg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EEDDF1955EA2; Wed, 11 Sep 2024 08:55:12 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.120.25]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8A9EE1956096; Wed, 11 Sep 2024 08:55:10 +0000 (UTC) From: Xiao Ni To: mariusz.tkaczyk@linux.intel.com Cc: linux-raid@vger.kernel.org, ncroxon@redhat.com Subject: [PATCH 10/10] mdadm/Manage: record errno Date: Wed, 11 Sep 2024 16:54:32 +0800 Message-Id: <20240911085432.37828-11-xni@redhat.com> In-Reply-To: <20240911085432.37828-1-xni@redhat.com> References: <20240911085432.37828-1-xni@redhat.com> Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Sometimes it reports: mdadm: failed to stop array /dev/md0: Success It's the reason the errno is reset. So record errno during the loop. Signed-off-by: Xiao Ni --- Manage.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Manage.c b/Manage.c index 241de05520d6..aba97df8e122 100644 --- a/Manage.c +++ b/Manage.c @@ -238,13 +238,14 @@ int Manage_stop(char *devname, int fd, int verbose, int will_retry) "array_state", "inactive")) < 0 && errno == EBUSY) { + err = errno; sleep_for(0, MSEC_TO_NSEC(200), true); count--; } if (err) { if (verbose >= 0) pr_err("failed to stop array %s: %s\n", - devname, strerror(errno)); + devname, strerror(err)); rv = 1; goto out; } @@ -438,14 +439,15 @@ done: count = 25; err = 0; while (count && fd >= 0 && (err = ioctl(fd, STOP_ARRAY, NULL)) < 0 && errno == EBUSY) { + err = errno; sleep_for(0, MSEC_TO_NSEC(200), true); count --; } if (fd >= 0 && err) { if (verbose >= 0) { pr_err("failed to stop array %s: %s\n", - devname, strerror(errno)); - if (errno == EBUSY) + devname, strerror(err)); + if (err == EBUSY) cont_err("Perhaps a running process, mounted filesystem or active volume group?\n"); } rv = 1;