[PATCH 06/35] Updates to udev rules and ReadMe.c for incremental --grab support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From d31e6ce7660254652e83df3b51c912495fa05d26 Mon Sep 17 00:00:00 2001
From: Anna Czarnowska <anna.czarnowska@xxxxxxxxx>
Date: Fri, 28 May 2010 14:42:21 +0200
Subject: [PATCH 06/35] Updates to udev rules and ReadMe.c for incremental --grab support

Update Makefile to install new udev early rules,
update ReadMe.c for new options to pass to incremental mode,
update udev rules file for new options.

    Signed-off-by: Doug Ledford <dledford@xxxxxxxxxx>
---
 Makefile            |    3 ++-
 ReadMe.c            |   14 ++++++++------
 udev-early-md.rules |   28 ++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 7 deletions(-)
 create mode 100644 udev-early-md.rules

diff --git a/Makefile b/Makefile
index 3af1665..354554c 100644
--- a/Makefile
+++ b/Makefile
@@ -232,7 +232,8 @@ install-man: mdadm.8 md.4 mdadm.conf.5 mdmon.8
 	$(INSTALL) -D -m 644 md.4 $(DESTDIR)$(MAN4DIR)/md.4
 	$(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5
 
-install-udev: udev-md-raid.rules
+install-udev: udev-md-raid.rules udev-early-md.rules
+	$(INSTALL) -D -m 644 udev-early-md.rules $(DESTDIR)/lib/udev/rules.d/05-md-early.rules
 	$(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)/lib/udev/rules.d/64-md-raid.rules
 
 uninstall:
diff --git a/ReadMe.c b/ReadMe.c
index 355aa64..5b59369 100644
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -87,11 +87,11 @@ char Version[] = Name " - v3.1.2 - 10th March 2010\n";
  */
 
 char short_options[]=
-	"-ABCDEFGIQhVXWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tyge:";
+	"-ABCDEFGIQhVXYWZ:vqbc:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tyge:";
 char short_bitmap_options[]=
-	"-ABCDEFGIQhVXWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tyge:";
+	"-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sarfRSow1tyge:";
 char short_bitmap_auto_options[]=
-	"-ABCDEFGIQhVXWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tyge:";
+	"-ABCDEFGIQhVXYWZ:vqb:c:i:l:p:m:n:x:u:c:d:z:U:N:sa:rfRSow1tyge:";
 
 struct option long_options[] = {
     {"manage",    0, 0, '@'},
@@ -169,7 +169,7 @@ struct option long_options[] = {
 
     /* For Detail/Examine */
     {"brief",	  0, 0, 'b'},
-    {"export",	  0, 0, 'Y'},
+    {"export",	  0, 0, 'Y'}, /* used for Incremental now too */
     {"sparc2.2",  0, 0, Sparc22},
     {"test",      0, 0, 't'},
 
@@ -246,8 +246,8 @@ char OptionHelp[] =
 "  --verbose     -v   : Be more verbose about what is happening\n"
 "  --quiet       -q   : Don't print un-necessary messages\n"
 "  --brief       -b   : Be less verbose, more brief\n"
-"  --export      -Y   : With --detail, use key=value format for easy\n"
-"                       import into environment\n"
+"  --export      -Y   : With --detail, --examine, and --incremental use\n"
+"                       key=value format for easy import into environment\n"
 "  --force       -f   : Override normal checks and be more forceful\n"
 "\n"
 "  --assemble    -A   : Assemble an array\n"
@@ -560,6 +560,8 @@ char Help_incr[] =
 "                  : take it for the purpose listed in said DOMAIN line.\n"
 "  --fail      -f  : First fail (if needed) and then remove device from\n"
 "                  : any array that it is a member of.\n"
+"  --export      -Y  : Output the results in a format that is consumable as\n"
+"                    : environment variables by udev.  Only used with --grab.\n"
 ;
 
 char Help_config[] =
diff --git a/udev-early-md.rules b/udev-early-md.rules
new file mode 100644
index 0000000..176ad61
--- /dev/null
+++ b/udev-early-md.rules
@@ -0,0 +1,28 @@
+# do not edit this file, it will be overwritten on update
+
+SUBSYSTEM!="block", GOTO="md_end"
+ACTION!="add|change", GOTO="md_end"
+# We only care about constituent devices, md arrays are handled in the later
+# rules file
+KERNEL=="md*", GOTO="md_end"
+# If this is already labeled as an md device, we will get it later in the
+# incremental rules assembly section
+ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}!="?*", GOTO="md_end"
+ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="md_end"
+# Does this device belong to a path which we are configured to "own"?
+# For now, we don't have a good way to differentiate that inside of a
+# udev rule, so we are using a really big hammer and just calling mdadm
+# in incremental mode with the flag that indicates that mdadm should only
+# do something with this device if it determines that it should own it.
+# That allows us to program in whatever smarts are needed into mdadm,
+# but at the expense of running mdadm on every blk device add|change event :-(
+IMPORT{program}="/sbin/mdadm -I --new-device $tempnode"
+ENV{MD_OWNED}!="?*", GOTO="md_end"
+# We owned the device, so have udev reset the database info in case we
+# changed it
+IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
+OPTIONS+="link_priority=100"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+LABEL="md_end"
-- 
1.6.4.2

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
z siedziba w Gdansku
ul. Slowackiego 173
80-298 Gdansk

Sad Rejonowy Gdansk Polnoc w Gdansku, 
VII Wydzial Gospodarczy Krajowego Rejestru Sadowego, 
numer KRS 101882

NIP 957-07-52-316
Kapital zakladowy 200.000 zl

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux