요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
환경 변수
dm-uevent.rst:21-74Target, action, sequence, path 수와 mapped-device identity 필드를 정리합니다.
Failure와 reinstate
dm-uevent.rst:75-110Udevmonitor 캡처에서 action·sequence·valid path 변화를 비교합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
====================
device-mapper uevent
====================
The device-mapper uevent code adds the capability to device-mapper to create
and send kobject uevents (uevents). Previously device-mapper events were only
available through the ioctl interface. The advantage of the uevents interface
is the event contains environment attributes providing increased context for
the event avoiding the need to query the state of the device-mapper device after
the event is received.
There are two functions currently for device-mapper events. The first function
listed creates the event and the second function sends the event(s)::
void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
const char *path, unsigned nr_valid_paths)
void dm_send_uevents(struct list_head *events, struct kobject *kobj)
The variables added to the uevent environment are:
Variable Name: DM_TARGET
------------------------
:Uevent Action(s): KOBJ_CHANGE
:Type: string
:Description:
:Value: Name of device-mapper target that generated the event.
Variable Name: DM_ACTION
------------------------
:Uevent Action(s): KOBJ_CHANGE
:Type: string
:Description:
:Value: Device-mapper specific action that caused the uevent action.
PATH_FAILED - A path has failed;
PATH_REINSTATED - A path has been reinstated.
Variable Name: DM_SEQNUM
------------------------
:Uevent Action(s): KOBJ_CHANGE
:Type: unsigned integer
:Description: A sequence number for this specific device-mapper device.
:Value: Valid unsigned integer range.
Variable Name: DM_PATH
----------------------
:Uevent Action(s): KOBJ_CHANGE
:Type: string
:Description: Major and minor number of the path device pertaining to this
event.
:Value: Path name in the form of "Major:Minor"
Variable Name: DM_NR_VALID_PATHS
--------------------------------
:Uevent Action(s): KOBJ_CHANGE
:Type: unsigned integer
:Description:
:Value: Valid unsigned integer range.
Variable Name: DM_NAME
----------------------
:Uevent Action(s): KOBJ_CHANGE
:Type: string
:Description: Name of the device-mapper device.
:Value: Name
Variable Name: DM_UUID
----------------------
:Uevent Action(s): KOBJ_CHANGE
:Type: string
:Description: UUID of the device-mapper device.
:Value: UUID. (Empty string if there isn't one.)
An example of the uevents generated as captured by udevmonitor is shown
below
1.) Path failure::
UEVENT[1192521009.711215] change@/block/dm-3
ACTION=change
DEVPATH=/block/dm-3
SUBSYSTEM=block
DM_TARGET=multipath
DM_ACTION=PATH_FAILED
DM_SEQNUM=1
DM_PATH=8:32
DM_NR_VALID_PATHS=0
DM_NAME=mpath2
DM_UUID=mpath-35333333000002328
MINOR=3
MAJOR=253
SEQNUM=1130
2.) Path reinstate::
UEVENT[1192521132.989927] change@/block/dm-3
ACTION=change
DEVPATH=/block/dm-3
SUBSYSTEM=block
DM_TARGET=multipath
DM_ACTION=PATH_REINSTATED
DM_SEQNUM=2
DM_PATH=8:32
DM_NR_VALID_PATHS=1
DM_NAME=mpath2
DM_UUID=mpath-35333333000002328
MINOR=3
MAJOR=253
SEQNUM=1131
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
상태 context를 포함하는 kobject uevent
1-20Device-mapper uevent 코드는 device-mapper가 kobject uevent를 생성하고 전송할 수 있게 합니다. 이전에는 device-mapper event를 ioctl interface로만 받을 수 있었습니다.
Uevent interface의 장점은 event 자체에 환경 속성이 들어 있어 더 많은 context를 제공한다는 점입니다. 따라서 event 수신 후 device-mapper 장치 상태를 다시 query할 필요가 없습니다.
Uevent는 원인과 path 상태를 payload에 포함해 후속 상태 조회를 줄입니다.
현재 device-mapper event에는 두 함수가 있습니다. `dm_path_uevent()`가 event를 만들고 `dm_send_uevents()`가 하나 이상의 event를 전송합니다.
void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
const char *path, unsigned nr_valid_paths)
void dm_send_uevents(struct list_head *events, struct kobject *kobj)
Target path 상태로 event를 만든 뒤 kobject를 통해 전송합니다.
DM_TARGET·DM_ACTION·DM_SEQNUM
21-44모든 변수는 `KOBJ_CHANGE` action의 uevent 환경에 추가됩니다.
Event 생성 target, device-mapper 고유 action과 장치별 순번을 제공합니다.
DM_PATH·DM_NR_VALID_PATHS·DM_NAME·DM_UUID
45-74Event가 가리키는 path와 해당 device-mapper 장치 identity를 담습니다.
하나의 payload가 target, action, path, 남은 path 수와 mapped-device identity를 결합합니다.
Path failure와 reinstate 캡처
75-110다음은 `udevmonitor`가 캡처한 path failure event입니다. Multipath target `mpath2`의 path `8:32`가 실패했고 유효 path 수가 0이 되었습니다. Device-mapper sequence는 1입니다.
UEVENT[1192521009.711215] change@/block/dm-3
ACTION=change
DEVPATH=/block/dm-3
SUBSYSTEM=block
DM_TARGET=multipath
DM_ACTION=PATH_FAILED
DM_SEQNUM=1
DM_PATH=8:32
DM_NR_VALID_PATHS=0
DM_NAME=mpath2
DM_UUID=mpath-35333333000002328
MINOR=3
MAJOR=253
SEQNUM=1130
두 번째 event는 같은 path가 복구된 경우입니다. `DM_ACTION`이 `PATH_REINSTATED`, 유효 path 수가 1, `DM_SEQNUM`이 2로 증가했습니다.
UEVENT[1192521132.989927] change@/block/dm-3
ACTION=change
DEVPATH=/block/dm-3
SUBSYSTEM=block
DM_TARGET=multipath
DM_ACTION=PATH_REINSTATED
DM_SEQNUM=2
DM_PATH=8:32
DM_NR_VALID_PATHS=1
DM_NAME=mpath2
DM_UUID=mpath-35333333000002328
MINOR=3
MAJOR=253
SEQNUM=1131
동일 mapped device와 path에서 action, valid-path 수와 sequence가 바뀝니다.
Uevent interface
dm-uevent.rst:1-20Context-rich event 생성·전송 함수와 ioctl 방식의 차이를 설명합니다.