xref: /OK3568_Linux_fs/kernel/Documentation/filesystems/gfs2-uevents.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun================
4*4882a593Smuzhiyunuevents and GFS2
5*4882a593Smuzhiyun================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunDuring the lifetime of a GFS2 mount, a number of uevents are generated.
8*4882a593SmuzhiyunThis document explains what the events are and what they are used
9*4882a593Smuzhiyunfor (by gfs_controld in gfs2-utils).
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunA list of GFS2 uevents
12*4882a593Smuzhiyun======================
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun1. ADD
15*4882a593Smuzhiyun------
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunThe ADD event occurs at mount time. It will always be the first
18*4882a593Smuzhiyunuevent generated by the newly created filesystem. If the mount
19*4882a593Smuzhiyunis successful, an ONLINE uevent will follow.  If it is not successful
20*4882a593Smuzhiyunthen a REMOVE uevent will follow.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunThe ADD uevent has two environment variables: SPECTATOR=[0|1]
23*4882a593Smuzhiyunand RDONLY=[0|1] that specify the spectator status (a read-only mount
24*4882a593Smuzhiyunwith no journal assigned), and read-only (with journal assigned) status
25*4882a593Smuzhiyunof the filesystem respectively.
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun2. ONLINE
28*4882a593Smuzhiyun---------
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunThe ONLINE uevent is generated after a successful mount or remount. It
31*4882a593Smuzhiyunhas the same environment variables as the ADD uevent. The ONLINE
32*4882a593Smuzhiyunuevent, along with the two environment variables for spectator and
33*4882a593SmuzhiyunRDONLY are a relatively recent addition (2.6.32-rc+) and will not
34*4882a593Smuzhiyunbe generated by older kernels.
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun3. CHANGE
37*4882a593Smuzhiyun---------
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunThe CHANGE uevent is used in two places. One is when reporting the
40*4882a593Smuzhiyunsuccessful mount of the filesystem by the first node (FIRSTMOUNT=Done).
41*4882a593SmuzhiyunThis is used as a signal by gfs_controld that it is then ok for other
42*4882a593Smuzhiyunnodes in the cluster to mount the filesystem.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunThe other CHANGE uevent is used to inform of the completion
45*4882a593Smuzhiyunof journal recovery for one of the filesystems journals. It has
46*4882a593Smuzhiyuntwo environment variables, JID= which specifies the journal id which
47*4882a593Smuzhiyunhas just been recovered, and RECOVERY=[Done|Failed] to indicate the
48*4882a593Smuzhiyunsuccess (or otherwise) of the operation. These uevents are generated
49*4882a593Smuzhiyunfor every journal recovered, whether it is during the initial mount
50*4882a593Smuzhiyunprocess or as the result of gfs_controld requesting a specific journal
51*4882a593Smuzhiyunrecovery via the /sys/fs/gfs2/<fsname>/lock_module/recovery file.
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunBecause the CHANGE uevent was used (in early versions of gfs_controld)
54*4882a593Smuzhiyunwithout checking the environment variables to discover the state, we
55*4882a593Smuzhiyuncannot add any more functions to it without running the risk of
56*4882a593Smuzhiyunsomeone using an older version of the user tools and breaking their
57*4882a593Smuzhiyuncluster. For this reason the ONLINE uevent was used when adding a new
58*4882a593Smuzhiyunuevent for a successful mount or remount.
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun4. OFFLINE
61*4882a593Smuzhiyun----------
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunThe OFFLINE uevent is only generated due to filesystem errors and is used
64*4882a593Smuzhiyunas part of the "withdraw" mechanism. Currently this doesn't give any
65*4882a593Smuzhiyuninformation about what the error is, which is something that needs to
66*4882a593Smuzhiyunbe fixed.
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun5. REMOVE
69*4882a593Smuzhiyun---------
70*4882a593Smuzhiyun
71*4882a593SmuzhiyunThe REMOVE uevent is generated at the end of an unsuccessful mount
72*4882a593Smuzhiyunor at the end of a umount of the filesystem. All REMOVE uevents will
73*4882a593Smuzhiyunhave been preceded by at least an ADD uevent for the same filesystem,
74*4882a593Smuzhiyunand unlike the other uevents is generated automatically by the kernel's
75*4882a593Smuzhiyunkobject subsystem.
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunInformation common to all GFS2 uevents (uevent environment variables)
79*4882a593Smuzhiyun=====================================================================
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun1. LOCKTABLE=
82*4882a593Smuzhiyun--------------
83*4882a593Smuzhiyun
84*4882a593SmuzhiyunThe LOCKTABLE is a string, as supplied on the mount command
85*4882a593Smuzhiyunline (locktable=) or via fstab. It is used as a filesystem label
86*4882a593Smuzhiyunas well as providing the information for a lock_dlm mount to be
87*4882a593Smuzhiyunable to join the cluster.
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun2. LOCKPROTO=
90*4882a593Smuzhiyun-------------
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunThe LOCKPROTO is a string, and its value depends on what is set
93*4882a593Smuzhiyunon the mount command line, or via fstab. It will be either
94*4882a593Smuzhiyunlock_nolock or lock_dlm. In the future other lock managers
95*4882a593Smuzhiyunmay be supported.
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun3. JOURNALID=
98*4882a593Smuzhiyun-------------
99*4882a593Smuzhiyun
100*4882a593SmuzhiyunIf a journal is in use by the filesystem (journals are not
101*4882a593Smuzhiyunassigned for spectator mounts) then this will give the
102*4882a593Smuzhiyunnumeric journal id in all GFS2 uevents.
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun4. UUID=
105*4882a593Smuzhiyun--------
106*4882a593Smuzhiyun
107*4882a593SmuzhiyunWith recent versions of gfs2-utils, mkfs.gfs2 writes a UUID
108*4882a593Smuzhiyuninto the filesystem superblock. If it exists, this will
109*4882a593Smuzhiyunbe included in every uevent relating to the filesystem.
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun
112*4882a593Smuzhiyun
113