From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Rajnoha Subject: Re: [mdadm PATCH] Create: tell udev md device is not ready when first created. Date: Thu, 4 May 2017 12:58:53 +0200 Message-ID: <85c9e9e1-3d2c-9f88-e923-235fb69a4188@redhat.com> References: <149265560315.31004.3851231165281498425.stgit@noble> <149265600601.31004.323865505557190368.stgit@noble> <87mvbasqx6.fsf@notabene.neil.brown.name> <40a5fbff-9eef-07b3-fe1b-fb9a888cfb8b@redhat.com> <87h919ruj5.fsf@notabene.neil.brown.name> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <87h919ruj5.fsf@notabene.neil.brown.name> Content-Language: en-US Sender: linux-raid-owner@vger.kernel.org To: NeilBrown , Jes Sorensen Cc: linux-raid@vger.kernel.org, dm-devel@redhat.com List-Id: linux-raid.ids On 04/28/2017 07:05 AM, NeilBrown wrote: > > When an array is created the content is not initialized, > so it could have remnants of an old filesystem or md array > etc on it. > udev will see this and might try to activate it, which is almost > certainly not what is wanted. > > So create a mechanism for mdadm to communicate with udev to tell > it that the device isn't ready. This mechanism is the existance > of a file /run/mdadm/created-mdXXX where mdXXX is the md device name. > > When creating an array, mdadm will create the file. > A new udev rule file, 01-md-raid-creating.rules, will detect the > precense of thst file and set ENV{SYSTEMD_READY}="0". > This is fairly uniformly used to suppress actions based on the > contents of the device. > ... > diff --git a/udev-md-raid-creating.rules b/udev-md-raid-creating.rules > new file mode 100644 > index 000000000000..2be466bcefd2 > --- /dev/null > +++ b/udev-md-raid-creating.rules > @@ -0,0 +1,7 @@ > +# do not edit this file, it will be overwritten on update > +# While mdadm is creating an array, it creates a file > +# /run/mdadm/creating-mdXXX. If that file exists, then > +# the array is not "ready" and we should make sure the > +# content is ignored. > + > +KERNEL=="md*", TEST="/run/mdadm/creating-$kernel", ENV{SYSTEMD_READY}="0" > This should be TEST=="/run/mdadm/creating-$kernel" (double equals sign, otherwise it's ignored by udev as incorrect rule). -- Peter