History

Add new disk to clustered array

Algorithm: 1. Node 1 issues mdadm --manage /dev/mdX --add /dev/sdYY which issues ioctl(ADD_NEW_DISC with disc.state set to MD_DISK_CLUSTER_ADD) 2. Node 1 sends NEWDISK with uuid and slot number 3. Other nodes issue kobject_uevent_env with uuid and slot number (Steps 4,5 could be a udev rule) 4. In userspace, the node searches for the disk, perhaps using blkid -t SUB_UUID="" 5. Other nodes issue either of the following depending on whether the disk was found: ioctl(ADD_NEW_DISK with disc.state set to MD_DISK_CANDIDATE and disc.number set to slot number) ioctl(CLUSTERED_DISK_NACK) 6. Other nodes drop lock on no-new-devs (CR) if device is found 7. Node 1 attempts EX lock on no-new-devs 8. If node 1 gets the lock, it sends METADATA_UPDATED after unmarking the disk as SpareLocal 9. If not (get no-new-dev lock), it fails the operation and sends METADATA_UPDATED 10. Other nodes understand if the device is added or not by reading the superblock again after receiving the METADATA_UPDATED message.

Goldwyn Rodrigues committed 12 years ago

Commit 1aee41f1 parent 7d49ffc7 files · +169 −4Browse files

Showing the changes to include/uapi/linux/raid (2 of 7 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/raid/md_p.h +6 −0
  2. include/uapi/linux/raid/md_u.h +1 −0
include/uapi/linux/raid/md_p.h+6−0
@@ -78,6 +78,12 @@ · 77 unmodified lines
7878 #define MD_DISK_ACTIVE 1 /* disk is running or spare disk */
7979 #define MD_DISK_SYNC 2 /* disk is in sync with the raid set */
8080 #define MD_DISK_REMOVED 3 /* disk is in sync with the raid set */
81+#define MD_DISK_CLUSTER_ADD 4 /* Initiate a disk add across the cluster
82+ * For clustered enviroments only.
83+ */
84+#define MD_DISK_CANDIDATE 5 /* disk is added as spare (local) until confirmed
85+ * For clustered enviroments only.
86+ */
8187
8288 #define MD_DISK_WRITEMOSTLY 9 /* disk is "write-mostly" is RAID1 config.
8389 * read requests will only be sent here in
include/uapi/linux/raid/md_u.h+1−0
@@ -62,6 +62,7 @@ · 61 unmodified lines
6262 #define STOP_ARRAY _IO (MD_MAJOR, 0x32)
6363 #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
6464 #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
65+#define CLUSTERED_DISK_NACK _IO (MD_MAJOR, 0x35)
6566
6667 /* 63 partitions with the alternate major number (mdp) */
6768 #define MdpMinorShift 6