^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) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) uevents and GFS2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) During the lifetime of a GFS2 mount, a number of uevents are generated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) This document explains what the events are and what they are used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) for (by gfs_controld in gfs2-utils).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) A list of GFS2 uevents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 1. ADD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) ------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) The ADD event occurs at mount time. It will always be the first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) uevent generated by the newly created filesystem. If the mount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) is successful, an ONLINE uevent will follow. If it is not successful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) then a REMOVE uevent will follow.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) The ADD uevent has two environment variables: SPECTATOR=[0|1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) and RDONLY=[0|1] that specify the spectator status (a read-only mount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) with no journal assigned), and read-only (with journal assigned) status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) of the filesystem respectively.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 2. ONLINE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) The ONLINE uevent is generated after a successful mount or remount. It
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) has the same environment variables as the ADD uevent. The ONLINE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) uevent, along with the two environment variables for spectator and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) RDONLY are a relatively recent addition (2.6.32-rc+) and will not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) be generated by older kernels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 3. CHANGE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) The CHANGE uevent is used in two places. One is when reporting the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) successful mount of the filesystem by the first node (FIRSTMOUNT=Done).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) This is used as a signal by gfs_controld that it is then ok for other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) nodes in the cluster to mount the filesystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) The other CHANGE uevent is used to inform of the completion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) of journal recovery for one of the filesystems journals. It has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) two environment variables, JID= which specifies the journal id which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) has just been recovered, and RECOVERY=[Done|Failed] to indicate the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) success (or otherwise) of the operation. These uevents are generated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) for every journal recovered, whether it is during the initial mount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) process or as the result of gfs_controld requesting a specific journal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) recovery via the /sys/fs/gfs2/<fsname>/lock_module/recovery file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) Because the CHANGE uevent was used (in early versions of gfs_controld)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) without checking the environment variables to discover the state, we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) cannot add any more functions to it without running the risk of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) someone using an older version of the user tools and breaking their
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) cluster. For this reason the ONLINE uevent was used when adding a new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) uevent for a successful mount or remount.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 4. OFFLINE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) ----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) The OFFLINE uevent is only generated due to filesystem errors and is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) as part of the "withdraw" mechanism. Currently this doesn't give any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) information about what the error is, which is something that needs to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) be fixed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 5. REMOVE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) The REMOVE uevent is generated at the end of an unsuccessful mount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) or at the end of a umount of the filesystem. All REMOVE uevents will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) have been preceded by at least an ADD uevent for the same filesystem,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) and unlike the other uevents is generated automatically by the kernel's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) kobject subsystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) Information common to all GFS2 uevents (uevent environment variables)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) =====================================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 1. LOCKTABLE=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) The LOCKTABLE is a string, as supplied on the mount command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) line (locktable=) or via fstab. It is used as a filesystem label
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) as well as providing the information for a lock_dlm mount to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) able to join the cluster.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 2. LOCKPROTO=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) -------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) The LOCKPROTO is a string, and its value depends on what is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) on the mount command line, or via fstab. It will be either
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) lock_nolock or lock_dlm. In the future other lock managers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) may be supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) 3. JOURNALID=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) -------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) If a journal is in use by the filesystem (journals are not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) assigned for spectator mounts) then this will give the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) numeric journal id in all GFS2 uevents.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 4. UUID=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) With recent versions of gfs2-utils, mkfs.gfs2 writes a UUID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) into the filesystem superblock. If it exists, this will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) be included in every uevent relating to the filesystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)