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