linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Doug Ledford <dledford@redhat.com>
Cc: LinuxRaid RAID <linux-raid@vger.kernel.org>
Subject: Re: mdadm udev rules change
Date: Wed, 8 Apr 2009 17:31:10 +1000	[thread overview]
Message-ID: <18908.21182.706667.310243@notabene.brown> (raw)
In-Reply-To: message from Doug Ledford on Monday April 6

On Monday April 6, dledford@redhat.com wrote:
> I'm not attaching a patch for this because it's so simple.  Long story  
> short, watching both add and change events in udev rules is bad for md  
> devices.  Specifically, the kernel will generate a change event on  
> things like array stop, and on things like fdisk close.  In the case  
> of array stop, it can result in the array being assembled again  
> immediately.  In the case of fdisk close, the situation is worse.   
> Let's say you stop all the md devices on some block device in order to  
> repartition.  You run fdisk, change the partition table, then issue a  
> write of the table.  The write of the table triggers the change event  
> *before* the kernel updates the partition table in memory for the  
> block device, causing udev to rerun the incremental rules on the old  
> partition table and restart all the arrays you just stopped with the  
> old partition table layout, at which point the kernel is unable to  
> reread the partition table.  So, once you've enable incremental  
> assembly, it becomes apparent that what we really want is to only  
> start devices on add, not on add|change.

So you aren't really talking about events on md devices, but rather on
events that might become components of md devices - correct?
So in udev-md-raid.rules we currently have

....
ACTION!="add|change", GOTO="md_end"

# import data from a raid member and activate it
#ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
# import data from a raid set
KERNEL!="md*", GOTO="md_end"
......

And you are saying that if we uncomment the "#ENV{...." line, then we
only want it to fire on add devices.  So something like:

....
 ACTION!="add|change", GOTO="md_end"
+ACTION=="change", GOTO="no_incr"
 
 # import data from a raid member and activate it
 #ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
 # import data from a raid set
+LABEL="no_incr"
 KERNEL!="md*", GOTO="md_end"
......

Is that correct?

Your explanation certainly seems reasonable.

Thanks.
NeilBrown

  reply	other threads:[~2009-04-08  7:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-06 14:57 mdadm udev rules change Doug Ledford
2009-04-08  7:31 ` Neil Brown [this message]
2009-04-09 19:20   ` Doug Ledford
2009-04-10  9:22     ` Neil Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18908.21182.706667.310243@notabene.brown \
    --to=neilb@suse.de \
    --cc=dledford@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).