@@ -139,8 +139,45 @@ struct gfs2_bufdata {
139139#define GDLM_STRNAME_BYTES 25
140140#define GDLM_LVB_SIZE 32
141141
142+ /*
143+ * ls_recover_flags:
144+ *
145+ * DFL_BLOCK_LOCKS: dlm is in recovery and will grant locks that had been
146+ * held by failed nodes whose journals need recovery. Those locks should
147+ * only be used for journal recovery until the journal recovery is done.
148+ * This is set by the dlm recover_prep callback and cleared by the
149+ * gfs2_control thread when journal recovery is complete. To avoid
150+ * races between recover_prep setting and gfs2_control clearing, recover_spin
151+ * is held while changing this bit and reading/writing recover_block
152+ * and recover_start.
153+ *
154+ * DFL_NO_DLM_OPS: dlm lockspace ops/callbacks are not being used.
155+ *
156+ * DFL_FIRST_MOUNT: this node is the first to mount this fs and is doing
157+ * recovery of all journals before allowing other nodes to mount the fs.
158+ * This is cleared when FIRST_MOUNT_DONE is set.
159+ *
160+ * DFL_FIRST_MOUNT_DONE: this node was the first mounter, and has finished
161+ * recovery of all journals, and now allows other nodes to mount the fs.
162+ *
163+ * DFL_MOUNT_DONE: gdlm_mount has completed successfully and cleared
164+ * BLOCK_LOCKS for the first time. The gfs2_control thread should now
165+ * control clearing BLOCK_LOCKS for further recoveries.
166+ *
167+ * DFL_UNMOUNT: gdlm_unmount sets to keep sdp off gfs2_control_wq.
168+ *
169+ * DFL_DLM_RECOVERY: set while dlm is in recovery, between recover_prep()
170+ * and recover_done(), i.e. set while recover_block == recover_start.
171+ */
172+
142173enum {
143174 DFL_BLOCK_LOCKS = 0 ,
175+ DFL_NO_DLM_OPS = 1 ,
176+ DFL_FIRST_MOUNT = 2 ,
177+ DFL_FIRST_MOUNT_DONE = 3 ,
178+ DFL_MOUNT_DONE = 4 ,
179+ DFL_UNMOUNT = 5 ,
180+ DFL_DLM_RECOVERY = 6 ,
144181};
145182
146183struct lm_lockname {
@@ -499,14 +536,26 @@ struct gfs2_sb_host {
499536struct lm_lockstruct {
500537 int ls_jid ;
501538 unsigned int ls_first ;
502- unsigned int ls_first_done ;
503539 unsigned int ls_nodir ;
504540 const struct lm_lockops * ls_ops ;
505- unsigned long ls_flags ;
506541 dlm_lockspace_t * ls_dlm ;
507542
508- int ls_recover_jid_done ;
509- int ls_recover_jid_status ;
543+ int ls_recover_jid_done ; /* These two are deprecated, */
544+ int ls_recover_jid_status ; /* used previously by gfs_controld */
545+
546+ struct dlm_lksb ls_mounted_lksb ; /* mounted_lock */
547+ struct dlm_lksb ls_control_lksb ; /* control_lock */
548+ char ls_control_lvb [GDLM_LVB_SIZE ]; /* control_lock lvb */
549+ struct completion ls_sync_wait ; /* {control,mounted}_{lock,unlock} */
550+
551+ spinlock_t ls_recover_spin ; /* protects following fields */
552+ unsigned long ls_recover_flags ; /* DFL_ */
553+ uint32_t ls_recover_mount ; /* gen in first recover_done cb */
554+ uint32_t ls_recover_start ; /* gen in last recover_done cb */
555+ uint32_t ls_recover_block ; /* copy recover_start in last recover_prep */
556+ uint32_t ls_recover_size ; /* size of recover_submit, recover_result */
557+ uint32_t * ls_recover_submit ; /* gen in last recover_slot cb per jid */
558+ uint32_t * ls_recover_result ; /* result of last jid recovery */
510559};
511560
512561struct gfs2_sbd {
@@ -544,6 +593,7 @@ struct gfs2_sbd {
544593 wait_queue_head_t sd_glock_wait ;
545594 atomic_t sd_glock_disposal ;
546595 struct completion sd_locking_init ;
596+ struct delayed_work sd_control_work ;
547597
548598 /* Inode Stuff */
549599
0 commit comments