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