Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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