← Documents Documentation/filesystems/ext4/mmp.rst GitHub 원문 ↗

Linux 6.18.37 · Filesystems

Multiple Mount Protection

ext4 MMP의 sequence 검사, 주기적 감시와 on-disk block 형식의 전문 번역입니다.

Source pathDocumentation/filesystems/ext4/mmp.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

mmp.rst:1-77

MMP는 주기적으로 갱신되는 sequence number를 비교해 두 host의 동시 writable mount를 감지하고 기존 mount를 read-only로 전환합니다.

핵심 흐름
open 전 sequence 검사interval 대기 후 재검사새 sequence로 mount 소유 표시주기적 불일치 감지 시 read-only remount

문서의 핵심 관계를 짧게 정리합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 Multiple Mount Protection
4 -------------------------
5
6 Multiple mount protection (MMP) is a feature that protects the
7 filesystem against multiple hosts trying to use the filesystem
8 simultaneously. When a filesystem is opened (for mounting, or fsck,
9 etc.), the MMP code running on the node (call it node A) checks a
10 sequence number. If the sequence number is EXT4_MMP_SEQ_CLEAN, the
11 open continues. If the sequence number is EXT4_MMP_SEQ_FSCK, then
12 fsck is (hopefully) running, and open fails immediately. Otherwise, the
13 open code will wait for twice the specified MMP check interval and check
14 the sequence number again. If the sequence number has changed, then the
15 filesystem is active on another machine and the open fails. If the MMP
16 code passes all of those checks, a new MMP sequence number is generated
17 and written to the MMP block, and the mount proceeds.
18
19 While the filesystem is live, the kernel sets up a timer to re-check the
20 MMP block at the specified MMP check interval. To perform the re-check,
21 the MMP sequence number is re-read; if it does not match the in-memory
22 MMP sequence number, then another node (node B) has mounted the
23 filesystem, and node A remounts the filesystem read-only. If the
24 sequence numbers match, the sequence number is incremented both in
25 memory and on disk, and the re-check is complete.
26
27 The hostname and device filename are written into the MMP block whenever
28 an open operation succeeds. The MMP code does not use these values; they
29 are provided purely for informational purposes.
30
31 The checksum is calculated against the FS UUID and the MMP structure.
32 The MMP structure (``struct mmp_struct``) is as follows:
33
34 .. list-table::
35 :widths: 8 12 20 40
36 :header-rows: 1
37
38 * - Offset
39 - Type
40 - Name
41 - Description
42 * - 0x0
43 - __le32
44 - mmp_magic
45 - Magic number for MMP, 0x004D4D50 (“MMP”).
46 * - 0x4
47 - __le32
48 - mmp_seq
49 - Sequence number, updated periodically.
50 * - 0x8
51 - __le64
52 - mmp_time
53 - Time that the MMP block was last updated.
54 * - 0x10
55 - char[64]
56 - mmp_nodename
57 - Hostname of the node that opened the filesystem.
58 * - 0x50
59 - char[32]
60 - mmp_bdevname
61 - Block device name of the filesystem.
62 * - 0x70
63 - __le16
64 - mmp_check_interval
65 - The MMP re-check interval, in seconds.
66 * - 0x72
67 - __le16
68 - mmp_pad1
69 - Zero.
70 * - 0x74
71 - __le32[226]
72 - mmp_pad2
73 - Zero.
74 * - 0x3FC
75 - __le32
76 - mmp_checksum
77 - Checksum of the MMP block.
78

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Multiple Mount Protection 동작

1-31

Multiple Mount Protection, 즉 MMP는 여러 host가 같은 filesystem을 동시에 사용하려는 상황을 막습니다.

mount나 `fsck`를 위해 filesystem을 열 때 node A의 MMP code는 sequence number를 확인합니다. 값이 `EXT4_MMP_SEQ_CLEAN`이면 open을 계속합니다. `EXT4_MMP_SEQ_FSCK`이면 `fsck`가 실행 중인 것으로 보고 즉시 실패합니다.

그 밖의 값이면 설정된 MMP check interval의 두 배를 기다린 뒤 sequence를 다시 읽습니다. 값이 바뀌었으면 다른 machine에서 filesystem이 active하므로 open에 실패합니다. 모든 검사를 통과하면 새 sequence number를 생성해 MMP block에 기록하고 mount를 진행합니다.

filesystem이 활성 상태인 동안 kernel은 지정된 check interval마다 MMP block을 다시 읽는 timer를 둡니다. disk sequence가 memory의 sequence와 다르면 node B가 mount한 것이므로 node A는 filesystem을 read-only로 remount합니다.

두 sequence가 같으면 memory와 disk의 값을 모두 증가시키고 재검사를 끝냅니다.

open 성공 때 hostname과 device filename을 MMP block에 기록하지만 MMP 판단에는 사용하지 않으며 정보 제공용입니다.

MMP open 및 감시 흐름
`mmp_seq == EXT4_MMP_SEQ_CLEAN`: open 계속`mmp_seq == EXT4_MMP_SEQ_FSCK`: 즉시 실패그 밖의 값: check interval의 2배 대기sequence가 바뀌면 다른 host active로 판단해 실패같으면 새 sequence를 기록하고 mountmount 후 interval마다 memory와 disk sequence 비교불일치하면 read-only remount, 일치하면 양쪽 sequence 증가

초기 open 검사와 mount 후 주기적 검사를 함께 보여줍니다.

.. SPDX-License-Identifier: GPL-2.0

Multiple Mount Protection
-------------------------

Multiple mount protection (MMP) is a feature that protects the
filesystem against multiple hosts trying to use the filesystem
simultaneously. When a filesystem is opened (for mounting, or fsck,
etc.), the MMP code running on the node (call it node A) checks a
sequence number. If the sequence number is EXT4_MMP_SEQ_CLEAN, the
open continues. If the sequence number is EXT4_MMP_SEQ_FSCK, then
fsck is (hopefully) running, and open fails immediately. Otherwise, the
open code will wait for twice the specified MMP check interval and check
the sequence number again. If the sequence number has changed, then the
filesystem is active on another machine and the open fails. If the MMP
code passes all of those checks, a new MMP sequence number is generated
and written to the MMP block, and the mount proceeds.

While the filesystem is live, the kernel sets up a timer to re-check the
MMP block at the specified MMP check interval. To perform the re-check,
the MMP sequence number is re-read; if it does not match the in-memory
MMP sequence number, then another node (node B) has mounted the
filesystem, and node A remounts the filesystem read-only. If the
sequence numbers match, the sequence number is incremented both in
memory and on disk, and the re-check is complete.

The hostname and device filename are written into the MMP block whenever
an open operation succeeds. The MMP code does not use these values; they
are provided purely for informational purposes.

The checksum is calculated against the FS UUID and the MMP structure.

`struct mmp_struct`

32-77

MMP checksum은 FS UUID와 MMP structure를 입력으로 계산합니다. `struct mmp_struct`는 1024바이트이며 magic, sequence, 마지막 update 시각, node·device 이름, check interval, padding, checksum을 저장합니다.

`struct mmp_struct`
OffsetTypeName설명
`0x0``__le32``mmp_magic`MMP magic `0x004D4D50` (`MMP`)
`0x4``__le32``mmp_seq`주기적으로 갱신되는 sequence number
`0x8``__le64``mmp_time`MMP block의 마지막 update 시각
`0x10``char[64]``mmp_nodename`filesystem을 연 node의 hostname
`0x50``char[32]``mmp_bdevname`filesystem block device 이름
`0x70``__le16``mmp_check_interval`MMP 재검사 간격(seconds)
`0x72``__le16``mmp_pad1`0
`0x74``__le32[226]``mmp_pad2`0
`0x3FC``__le32``mmp_checksum`MMP block checksum

MMP block의 on-disk 필드입니다.

The MMP structure (``struct mmp_struct``) is as follows:

.. list-table::
   :widths: 8 12 20 40
   :header-rows: 1

   * - Offset
     - Type
     - Name
     - Description
   * - 0x0
     - __le32
     - mmp_magic
     - Magic number for MMP, 0x004D4D50 (“MMP”).
   * - 0x4
     - __le32
     - mmp_seq
     - Sequence number, updated periodically.
   * - 0x8
     - __le64
     - mmp_time
     - Time that the MMP block was last updated.
   * - 0x10
     - char[64]
     - mmp_nodename
     - Hostname of the node that opened the filesystem.
   * - 0x50
     - char[32]
     - mmp_bdevname
     - Block device name of the filesystem.
   * - 0x70
     - __le16
     - mmp_check_interval
     - The MMP re-check interval, in seconds.
   * - 0x72
     - __le16
     - mmp_pad1
     - Zero.
   * - 0x74
     - __le32[226]
     - mmp_pad2
     - Zero.
   * - 0x3FC
     - __le32
     - mmp_checksum
     - Checksum of the MMP block.