Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5660959rwl; Wed, 22 Mar 2023 00:00:21 -0700 (PDT) X-Google-Smtp-Source: AK7set8pex4AQj3uT/rB0a0eT9kLOMh15NT2fv5EaqBqWuVY7STQDqVIyv/xpv41ZZFbvWoTXcI6 X-Received: by 2002:a17:902:dac3:b0:1a1:ad5e:bdb2 with SMTP id q3-20020a170902dac300b001a1ad5ebdb2mr1848394plx.57.1679468420901; Wed, 22 Mar 2023 00:00:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679468420; cv=none; d=google.com; s=arc-20160816; b=PRviKVoVUtPU6MY3x8SgJkprt5eKURC5sR1jgTVJ/hroT6wo+z2JTjr2d/x1g7Wjgo fTx/QbiAsRStRBbyJs7ZjlHYj8DXhSry1harHur11eO94pe18BGeIkf92gYKYhZAnBcY DFzanx3Ycg8joukEKqOnjB9DWqaKrGju61DAkM0Zz7c9z+0gh4NG0DxIk0XvpZKfdeep C7ZueIx5yl0lpb26QVhN7SaPL23rsDEdjNVASdfCLLtlwhI5wk/KOjwPFBpwCiJskuET RGYFx5+ubKASsdx9cJfc4Js51qUumkPox+c9WQpPN+WHBx64nkCNQ4D0OYs8k/OJZGGI 7n7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=dc5ckLj0iNgsN7elSv9nAJEVedN29HbPEKLbm2m8hX8=; b=xyLPS5/V5eAWBeBbUPIqsHb7YHFWLS+0qFZ0898aFm/X9LDP4BL2ecSphNM6+XwYcJ Cl7F5maV6voo2EnUsskwxKfFPq/gI5vukup2bL1ymoXWzT9d5i5VzX6REv4+pv7u8HjO jzKTc7nnSftA3efYZF+Etw3HbV+ZBTHiaOADc/qK2MnZFLnJKVWFlO4E4kKweKf2VB8/ 4sxv/MmcQ5aisX8OBn6hxDmF3W+9+G/J4ZHzZzcFYGgaQ9YM7GiHIYZLwc7Y68OQu0ky YJ3OKQ2tYwC46JCMEK2gIs1tOzVXoHyfjFXrLyBQZ3nRuw3tgeSr93P8KG68NYBjVIz0 OO0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PDgbxYgO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a170902c94a00b0019e6e61c1bcsi16836227pla.9.2023.03.22.00.00.05; Wed, 22 Mar 2023 00:00:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PDgbxYgO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbjCVGw4 (ORCPT + 99 others); Wed, 22 Mar 2023 02:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230047AbjCVGwl (ORCPT ); Wed, 22 Mar 2023 02:52:41 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B4E2B9EA; Tue, 21 Mar 2023 23:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679467957; x=1711003957; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ylgya/uy4m5dg2f0yWBBb1jbOoNOCKIoIbUTuCbiP4c=; b=PDgbxYgO3gKFfDkwDk2lUiuVXBNRK59Miz0Q4ZYVcO2IQcW2mQdCsZGS FqRmJ+ZpBO6XI3F0hLX/34lZVRM3f2gm3UpcKN1XKm2RTtAyzOD8kFp+6 DI+/9XpuvbzaA8FlkhYDkLMWajSjFb1ojiFohBYzCwaLIv+MIRXPcRZWe rFrwPj/SiUqo9w/1RrtQ8QrH3TF4NjZQVrFwDej+WLw1/PpckAAzEL6Cf tOzxr5a7Ct7eNXsYj8XpIns2LzEae7NQI83u73o4VNR2BipuNZOLrXJXE 73hfA47Njyu2Lq2R0W1UQxf49HD3hjMNm/ySLpdqN66KF5N0eoyIytmt5 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="401710162" X-IronPort-AV: E=Sophos;i="5.98,281,1673942400"; d="scan'208";a="401710162" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 23:51:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="825267927" X-IronPort-AV: E=Sophos;i="5.98,281,1673942400"; d="scan'208";a="825267927" Received: from mtkaczyk-mobl.ger.corp.intel.com (HELO localhost) ([10.252.62.75]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 23:51:16 -0700 Date: Wed, 22 Mar 2023 07:51:11 +0100 From: Mariusz Tkaczyk To: "NeilBrown" Cc: "Xiao Ni" , "Jes Sorensen" , "Song Liu" , "Linux regressions mailing list" , "linux-raid" , "LKML" , "Nikolay Kichukov" , Logan Gunthorpe Subject: Re: [PATCH - mdadm] mdopen: always try create_named_array() Message-ID: <20230322075111.000064bc@linux.intel.com> In-Reply-To: <167945548970.8008.8910680813298326328@noble.neil.brown.name> References: <167875238571.8008.9808655454439667586@noble.neil.brown.name> <167945548970.8008.8910680813298326328@noble.neil.brown.name> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 22 Mar 2023 14:24:49 +1100 "NeilBrown" wrote: > On Wed, 22 Mar 2023, Xiao Ni wrote: > > On Tue, Mar 14, 2023 at 8:08=E2=80=AFAM NeilBrown wrote= : =20 > > > > > > > > > mdopen() will use create_named_array() to ask the kernel to create the > > > given md array, but only if it is given a number or name. > > > If it is NOT given a name and is required to choose one itself using > > > find_free_devnm() it does NOT use create_named_array(). > > > > > > On kernels with CONFIG_BLOCK_LEGACY_AUTOLOAD not set, this can result= in > > > failure to assemble an array. This can particularly seen when the > > > "name" of the array begins with a host name different to the name of = the > > > host running the command. > > > > > > So add the missing call to create_named_array(). > > > > > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D217074 =20 > >=20 > > Hi Neil > >=20 > > I have two questions, hope you can help to understand the function > > create_mddev better. > >=20 > > Frist, from the comment7 of the bug you mentioned: > >=20 > > There are two different sorts names. Note that you almost > > acknowledged this by writing "name for my md device node" while the > > documentation only talks about names for "md devices", not for "md > > device nodes". > >=20 > > There are > > 1/ there are names in /dev or /dev/md/ (device nodes) > > 2/ there are names that appear in /proc/mdstat and in /sys/block/ (devi= ces) > >=20 > > Thanks for the clarification. But it looks like it doesn't work like > > what you said. > > For example: > > mdadm -CR /dev/md/root -l0 -n2 /dev/sda /dev/sdc --name=3Dtest > > cat /proc/mdstat > > Personalities : [raid0] > > md127 : active raid0 sdc[1] sda[0] > > 3906764800 blocks super 1.2 512k chunks > > cd /sys/block/md127/md/ > >=20 > > In /proc/mdstat and /sys/block, they all use md127 rather than the > > name(root) =20 >=20 > Try again with "CREATE names=3Dyes" in /etc/mdadm.conf. >=20 > mdadm generally tries to keep: > - the names in /dev/ > - the names in /dev/md/ > - the names in /proc/mdstat > - the names stored in the metadata >=20 > in sync. It can only do this when: > - you enabled "names=3Dyes" > - you don't confuse it by specifying a device name (/dev/md/root) that > is different from the metadata names "test". >=20 > If you don't have "names=3Dyes" then the name in /proc/mdstat and the name > in /dev/md* will be numeric. The name in /dev/md/ and the name in the > metadata can be different and will usually be the same. >=20 > If you explicitly give a different name with --name=3D than the device > name then obviously they will be different. If you then stop the array > and restart with "mdadm -As" or "mdadm -I /dev/sda; mdadm -I /dev/sdb" > then mdadm will create a name in /dev/md/ that matches the name in the > metadata. >=20 > >=20 > > Before this patch, it creates a symbol link with the name root rather = than > > test ll /dev/md/root > > lrwxrwxrwx. 1 root root 8 Mar 21 22:35 /dev/md/root -> ../md127 =20 >=20 > That is what you asked it to do. >=20 > >=20 > > So "test" which is specified by --name looks like it has little usage. > > =20 >=20 > It is stored in the metadata. You can see it in --examine output. If > you reassemble the array without specifying a device name, it will use > the name "test". >=20 > >=20 > > By the way, after this patch, the symbol link /dev/md/root can't be > > created anymore. > > Is it a regression problem? =20 >=20 > I cannot reproduce any problem like that. Please provide a sequence of > steps so that I can try to duplicate it. Hi, It is not caused by this patch. Regression is caused by: https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=3D8a4ce2c05= 3866ac97feb436c4c85a54446ee0016 We noticed that yesterday. In our case, udev fails to create link, timeout happens. This is caused by missing MD_DEVNAME property in --detail --export. At that is all I know for= now. Work in progress. Steps: #mdadm -CR imsm -e imsm -n4 /dev/nvme[0-3]n1 #mdadm -CR vol -l5 -n4 /dev/nvme[0-3]n1 --assume-clean Thanks, Mariusz >=20 > >=20 > > Second, are there possibilities that the arguments "dev" and "name" of > > function create_mddev > > are null at the same time? =20 >=20 > No. For Build or Create, dev is never NULL. For Assemble and > Incremental, name is never NULL. >=20 >=20 > > After some tests, I found dev can't be null when creating a raid > > device. It can be checked before > > calling create_mddev. And we must get a name after creating a raid > > device. So when assembling > > a raid device, the name must not be null. So the dev and name can't be > > null at the same time, right? =20 >=20 > Correct. >=20 > NeilBrown >=20 >=20 > >=20 > > Best Regards > > Xiao > >=20 > > =20 > > > Signed-off-by: NeilBrown > > > --- > > > mdopen.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/mdopen.c b/mdopen.c > > > index d18c931996d2..810f79a3d19a 100644 > > > --- a/mdopen.c > > > +++ b/mdopen.c > > > @@ -370,6 +370,7 @@ int create_mddev(char *dev, char *name, int autof, > > > int trustworthy, } > > > if (block_udev) > > > udev_block(devnm); > > > + create_named_array(devnm); > > > } > > > > > > sprintf(devname, "/dev/%s", devnm); > > > -- > > > 2.39.2 > > > =20 > >=20 > > =20 >=20