1*4882a593Smuzhiyun==================== 2*4882a593Smuzhiyundevice-mapper uevent 3*4882a593Smuzhiyun==================== 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunThe device-mapper uevent code adds the capability to device-mapper to create 6*4882a593Smuzhiyunand send kobject uevents (uevents). Previously device-mapper events were only 7*4882a593Smuzhiyunavailable through the ioctl interface. The advantage of the uevents interface 8*4882a593Smuzhiyunis the event contains environment attributes providing increased context for 9*4882a593Smuzhiyunthe event avoiding the need to query the state of the device-mapper device after 10*4882a593Smuzhiyunthe event is received. 11*4882a593Smuzhiyun 12*4882a593SmuzhiyunThere are two functions currently for device-mapper events. The first function 13*4882a593Smuzhiyunlisted creates the event and the second function sends the event(s):: 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti, 16*4882a593Smuzhiyun const char *path, unsigned nr_valid_paths) 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun void dm_send_uevents(struct list_head *events, struct kobject *kobj) 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunThe variables added to the uevent environment are: 22*4882a593Smuzhiyun 23*4882a593SmuzhiyunVariable Name: DM_TARGET 24*4882a593Smuzhiyun------------------------ 25*4882a593Smuzhiyun:Uevent Action(s): KOBJ_CHANGE 26*4882a593Smuzhiyun:Type: string 27*4882a593Smuzhiyun:Description: 28*4882a593Smuzhiyun:Value: Name of device-mapper target that generated the event. 29*4882a593Smuzhiyun 30*4882a593SmuzhiyunVariable Name: DM_ACTION 31*4882a593Smuzhiyun------------------------ 32*4882a593Smuzhiyun:Uevent Action(s): KOBJ_CHANGE 33*4882a593Smuzhiyun:Type: string 34*4882a593Smuzhiyun:Description: 35*4882a593Smuzhiyun:Value: Device-mapper specific action that caused the uevent action. 36*4882a593Smuzhiyun PATH_FAILED - A path has failed; 37*4882a593Smuzhiyun PATH_REINSTATED - A path has been reinstated. 38*4882a593Smuzhiyun 39*4882a593SmuzhiyunVariable Name: DM_SEQNUM 40*4882a593Smuzhiyun------------------------ 41*4882a593Smuzhiyun:Uevent Action(s): KOBJ_CHANGE 42*4882a593Smuzhiyun:Type: unsigned integer 43*4882a593Smuzhiyun:Description: A sequence number for this specific device-mapper device. 44*4882a593Smuzhiyun:Value: Valid unsigned integer range. 45*4882a593Smuzhiyun 46*4882a593SmuzhiyunVariable Name: DM_PATH 47*4882a593Smuzhiyun---------------------- 48*4882a593Smuzhiyun:Uevent Action(s): KOBJ_CHANGE 49*4882a593Smuzhiyun:Type: string 50*4882a593Smuzhiyun:Description: Major and minor number of the path device pertaining to this 51*4882a593Smuzhiyun event. 52*4882a593Smuzhiyun:Value: Path name in the form of "Major:Minor" 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunVariable Name: DM_NR_VALID_PATHS 55*4882a593Smuzhiyun-------------------------------- 56*4882a593Smuzhiyun:Uevent Action(s): KOBJ_CHANGE 57*4882a593Smuzhiyun:Type: unsigned integer 58*4882a593Smuzhiyun:Description: 59*4882a593Smuzhiyun:Value: Valid unsigned integer range. 60*4882a593Smuzhiyun 61*4882a593SmuzhiyunVariable Name: DM_NAME 62*4882a593Smuzhiyun---------------------- 63*4882a593Smuzhiyun:Uevent Action(s): KOBJ_CHANGE 64*4882a593Smuzhiyun:Type: string 65*4882a593Smuzhiyun:Description: Name of the device-mapper device. 66*4882a593Smuzhiyun:Value: Name 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunVariable Name: DM_UUID 69*4882a593Smuzhiyun---------------------- 70*4882a593Smuzhiyun:Uevent Action(s): KOBJ_CHANGE 71*4882a593Smuzhiyun:Type: string 72*4882a593Smuzhiyun:Description: UUID of the device-mapper device. 73*4882a593Smuzhiyun:Value: UUID. (Empty string if there isn't one.) 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunAn example of the uevents generated as captured by udevmonitor is shown 76*4882a593Smuzhiyunbelow 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun1.) Path failure:: 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun UEVENT[1192521009.711215] change@/block/dm-3 81*4882a593Smuzhiyun ACTION=change 82*4882a593Smuzhiyun DEVPATH=/block/dm-3 83*4882a593Smuzhiyun SUBSYSTEM=block 84*4882a593Smuzhiyun DM_TARGET=multipath 85*4882a593Smuzhiyun DM_ACTION=PATH_FAILED 86*4882a593Smuzhiyun DM_SEQNUM=1 87*4882a593Smuzhiyun DM_PATH=8:32 88*4882a593Smuzhiyun DM_NR_VALID_PATHS=0 89*4882a593Smuzhiyun DM_NAME=mpath2 90*4882a593Smuzhiyun DM_UUID=mpath-35333333000002328 91*4882a593Smuzhiyun MINOR=3 92*4882a593Smuzhiyun MAJOR=253 93*4882a593Smuzhiyun SEQNUM=1130 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun2.) Path reinstate:: 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun UEVENT[1192521132.989927] change@/block/dm-3 98*4882a593Smuzhiyun ACTION=change 99*4882a593Smuzhiyun DEVPATH=/block/dm-3 100*4882a593Smuzhiyun SUBSYSTEM=block 101*4882a593Smuzhiyun DM_TARGET=multipath 102*4882a593Smuzhiyun DM_ACTION=PATH_REINSTATED 103*4882a593Smuzhiyun DM_SEQNUM=2 104*4882a593Smuzhiyun DM_PATH=8:32 105*4882a593Smuzhiyun DM_NR_VALID_PATHS=1 106*4882a593Smuzhiyun DM_NAME=mpath2 107*4882a593Smuzhiyun DM_UUID=mpath-35333333000002328 108*4882a593Smuzhiyun MINOR=3 109*4882a593Smuzhiyun MAJOR=253 110*4882a593Smuzhiyun SEQNUM=1131 111