Lines Matching +full:first +full:- +full:generation
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
4 * Copyright 2004-2011 Red Hat, Inc.
26 * gfs2_update_stats - Update time based stats
52 s64 delta = sample - s->stats[index]; in gfs2_update_stats()
53 s->stats[index] += (delta >> 3); in gfs2_update_stats()
55 s->stats[index] += (s64)(abs(delta) - s->stats[index]) >> 2; in gfs2_update_stats()
59 * gfs2_update_reply_times - Update locking statistics
62 * This assumes that gl->gl_dstamp has been set earlier.
72 * TRY_1CB flags are set are classified as non-blocking. All
78 const unsigned gltype = gl->gl_name.ln_type; in gfs2_update_reply_times()
79 unsigned index = test_bit(GLF_BLOCKING, &gl->gl_flags) ? in gfs2_update_reply_times()
84 rtt = ktime_to_ns(ktime_sub(ktime_get_real(), gl->gl_dstamp)); in gfs2_update_reply_times()
85 lks = this_cpu_ptr(gl->gl_name.ln_sbd->sd_lkstats); in gfs2_update_reply_times()
86 gfs2_update_stats(&gl->gl_stats, index, rtt); /* Local */ in gfs2_update_reply_times()
87 gfs2_update_stats(&lks->lkstats[gltype], index, rtt); /* Global */ in gfs2_update_reply_times()
94 * gfs2_update_request_times - Update locking statistics
97 * The irt (lock inter-request times) measures the average time
105 const unsigned gltype = gl->gl_name.ln_type; in gfs2_update_request_times()
110 dstamp = gl->gl_dstamp; in gfs2_update_request_times()
111 gl->gl_dstamp = ktime_get_real(); in gfs2_update_request_times()
112 irt = ktime_to_ns(ktime_sub(gl->gl_dstamp, dstamp)); in gfs2_update_request_times()
113 lks = this_cpu_ptr(gl->gl_name.ln_sbd->sd_lkstats); in gfs2_update_request_times()
114 gfs2_update_stats(&gl->gl_stats, GFS2_LKS_SIRT, irt); /* Local */ in gfs2_update_request_times()
115 gfs2_update_stats(&lks->lkstats[gltype], GFS2_LKS_SIRT, irt); /* Global */ in gfs2_update_request_times()
122 unsigned ret = gl->gl_state; in gdlm_ast()
125 BUG_ON(gl->gl_lksb.sb_flags & DLM_SBF_DEMOTED); in gdlm_ast()
127 if ((gl->gl_lksb.sb_flags & DLM_SBF_VALNOTVALID) && gl->gl_lksb.sb_lvbptr) in gdlm_ast()
128 memset(gl->gl_lksb.sb_lvbptr, 0, GDLM_LVB_SIZE); in gdlm_ast()
130 switch (gl->gl_lksb.sb_status) { in gdlm_ast()
131 case -DLM_EUNLOCK: /* Unlocked, so glock can be freed */ in gdlm_ast()
132 if (gl->gl_ops->go_free) in gdlm_ast()
133 gl->gl_ops->go_free(gl); in gdlm_ast()
136 case -DLM_ECANCEL: /* Cancel while getting lock */ in gdlm_ast()
139 case -EAGAIN: /* Try lock fails */ in gdlm_ast()
140 case -EDEADLK: /* Deadlock detected */ in gdlm_ast()
142 case -ETIMEDOUT: /* Canceled due to timeout */ in gdlm_ast()
151 ret = gl->gl_req; in gdlm_ast()
152 if (gl->gl_lksb.sb_flags & DLM_SBF_ALTMODE) { in gdlm_ast()
153 if (gl->gl_req == LM_ST_SHARED) in gdlm_ast()
155 else if (gl->gl_req == LM_ST_DEFERRED) in gdlm_ast()
161 set_bit(GLF_INITIAL, &gl->gl_flags); in gdlm_ast()
165 if (!test_bit(GLF_INITIAL, &gl->gl_flags)) in gdlm_ast()
166 gl->gl_lksb.sb_lkid = 0; in gdlm_ast()
185 fs_err(gl->gl_name.ln_sbd, "unknown bast mode %d\n", mode); in gdlm_bast()
190 /* convert gfs lock-state to dlm lock-mode */
206 return -1; in make_mode()
214 if (gl->gl_lksb.sb_lvbptr) in make_flags()
239 if (gl->gl_lksb.sb_lkid != 0) { in make_flags()
241 if (test_bit(GLF_BLOCKING, &gl->gl_flags)) in make_flags()
252 *c-- = hex_asc[value & 0x0f]; in gfs2_reverse_hex()
260 struct lm_lockstruct *ls = &gl->gl_name.ln_sbd->sd_lockstruct; in gdlm_lock()
266 req = make_mode(gl->gl_name.ln_sbd, req_state); in gdlm_lock()
270 if (gl->gl_lksb.sb_lkid) { in gdlm_lock()
273 memset(strname, ' ', GDLM_STRNAME_BYTES - 1); in gdlm_lock()
274 strname[GDLM_STRNAME_BYTES - 1] = '\0'; in gdlm_lock()
275 gfs2_reverse_hex(strname + 7, gl->gl_name.ln_type); in gdlm_lock()
276 gfs2_reverse_hex(strname + 23, gl->gl_name.ln_number); in gdlm_lock()
277 gl->gl_dstamp = ktime_get_real(); in gdlm_lock()
284 error = dlm_lock(ls->ls_dlm, req, &gl->gl_lksb, lkf, strname, in gdlm_lock()
285 GDLM_STRNAME_BYTES - 1, 0, gdlm_ast, gl, gdlm_bast); in gdlm_lock()
286 if (error == -EBUSY) { in gdlm_lock()
295 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; in gdlm_put_lock()
296 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_put_lock()
299 if (gl->gl_lksb.sb_lkid == 0) { in gdlm_put_lock()
304 clear_bit(GLF_BLOCKING, &gl->gl_flags); in gdlm_put_lock()
310 if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) { in gdlm_put_lock()
316 if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) && in gdlm_put_lock()
317 !gl->gl_lksb.sb_lvbptr) { in gdlm_put_lock()
323 error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK, in gdlm_put_lock()
325 if (error == -EBUSY) { in gdlm_put_lock()
332 gl->gl_name.ln_type, in gdlm_put_lock()
333 (unsigned long long)gl->gl_name.ln_number, error); in gdlm_put_lock()
340 struct lm_lockstruct *ls = &gl->gl_name.ln_sbd->sd_lockstruct; in gdlm_cancel()
341 dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_CANCEL, NULL, gl); in gdlm_cancel()
349 * 2. dlm_controld blocks dlm-kernel locking activity
350 * 3. dlm_controld within dlm-kernel notifies gfs2 (recover_prep)
352 * 5. dlm_controld starts dlm-kernel dlm_recoverd to do kernel recovery
355 * 8. dlm_recoverd unblocks dlm-kernel locking activity
356 * 9. dlm_recoverd notifies gfs2 when done (recover_done with new generation)
357 * 10. gfs2_control updates control_lock lvb with new generation and jid bits
364 * - failures during recovery
372 * recover_done() provides a new lockspace generation number each time it
373 * is called (step 9). This generation number is saved as recover_start.
379 * - more specific gfs2 steps in sequence above
383 * 9. recover_done sets recover_start = new generation number
391 * - parallel recovery steps across all nodes
393 * All nodes attempt to update the control_lock lvb with the new generation
394 * number and jid bits, but only the first to get the control_lock EX will
396 * generation number.)
400 * . One node gets control_lock first and writes the lvb, others see it's done
405 * - is there a problem with clearing an lvb bit that should be set
420 * for the latest lockspace generation before ever unblocking locks
424 * - special case of first mounter: first node to mount the fs
426 * The first node to mount a gfs2 fs needs to check all the journals
429 * for the first mounter to be done before taking locks on the fs
432 * 1. The mounted_lock tells a node it's the first to mount the fs.
436 * other mounted nodes (no PR locks exist), and it is the first mounter.
437 * The mounted_lock is demoted to PR when first recovery is done, so
440 * 2. The control_lock blocks others in control_mount() while the first
441 * mounter is doing first mount recovery of all journals.
443 * it can proceed. The first mounter holds control_lock in EX while doing
444 * the first mount recovery, blocking mounts from other nodes, then demotes
448 * first mounter:
451 * set first=1
452 * do first mounter recovery
453 * mounted_lock EX->PR
454 * control_lock EX->NL, write lvb generation
457 * control_lock EX/NOQUEUE success (if fail -EAGAIN, retry)
458 * mounted_lock EX/NOQUEUE fail -EAGAIN (expected due to other mounters PR)
460 * read lvb generation
461 * control_lock EX->NL
462 * set first=0
464 * - mount during recovery
466 * If a node mounts while others are doing recovery (not first mounter),
472 * steps above until the lvb generation number is >= its mount generation
475 * - control_lock lvb format
477 * 4 bytes generation number: the latest dlm lockspace generation number
479 * to reflect all slot failures through that generation.
481 * GDLM_LVB_SIZE-8 bytes of jid bit map. If bit N is set, it indicates
485 #define JID_BITMAP_OFFSET 8 /* 4 byte generation number + 4 byte unused */
491 memcpy(lvb_bits, ls->ls_control_lvb, GDLM_LVB_SIZE); in control_lvb_read()
500 memcpy(ls->ls_control_lvb, lvb_bits, GDLM_LVB_SIZE); in control_lvb_write()
502 memcpy(ls->ls_control_lvb, &gen, sizeof(__le32)); in control_lvb_write()
508 GDLM_LVB_SIZE - JID_BITMAP_OFFSET); in all_jid_bits_clear()
514 complete(&ls->ls_sync_wait); in sync_wait_cb()
519 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in sync_unlock()
522 error = dlm_unlock(ls->ls_dlm, lksb->sb_lkid, 0, lksb, ls); in sync_unlock()
525 name, lksb->sb_lkid, error); in sync_unlock()
529 wait_for_completion(&ls->ls_sync_wait); in sync_unlock()
531 if (lksb->sb_status != -DLM_EUNLOCK) { in sync_unlock()
533 name, lksb->sb_lkid, lksb->sb_status); in sync_unlock()
534 return -1; in sync_unlock()
542 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in sync_lock()
549 error = dlm_lock(ls->ls_dlm, mode, lksb, flags, in sync_lock()
550 strname, GDLM_STRNAME_BYTES - 1, in sync_lock()
554 name, lksb->sb_lkid, flags, mode, error); in sync_lock()
558 wait_for_completion(&ls->ls_sync_wait); in sync_lock()
560 status = lksb->sb_status; in sync_lock()
562 if (status && status != -EAGAIN) { in sync_lock()
564 name, lksb->sb_lkid, flags, mode, status); in sync_lock()
572 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in mounted_unlock()
573 return sync_unlock(sdp, &ls->ls_mounted_lksb, "mounted_lock"); in mounted_unlock()
578 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in mounted_lock()
580 &ls->ls_mounted_lksb, "mounted_lock"); in mounted_lock()
585 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in control_unlock()
586 return sync_unlock(sdp, &ls->ls_control_lksb, "control_lock"); in control_unlock()
591 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in control_lock()
593 &ls->ls_control_lksb, "control_lock"); in control_lock()
597 * remote_withdraw - react to a node withdrawing from the file system
605 list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) { in remote_withdraw()
606 if (jd->jd_jid == sdp->sd_lockstruct.ls_jid) in remote_withdraw()
621 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gfs2_control_func()
628 /* First check for other nodes that may have done a withdraw. */ in gfs2_control_func()
629 if (test_bit(SDF_REMOTE_WITHDRAW, &sdp->sd_flags)) { in gfs2_control_func()
631 clear_bit(SDF_REMOTE_WITHDRAW, &sdp->sd_flags); in gfs2_control_func()
635 spin_lock(&ls->ls_recover_spin); in gfs2_control_func()
641 * FIRST_MOUNT means this node is doing first mounter recovery, in gfs2_control_func()
645 if (!test_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags) || in gfs2_control_func()
646 test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags)) { in gfs2_control_func()
647 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
650 block_gen = ls->ls_recover_block; in gfs2_control_func()
651 start_gen = ls->ls_recover_start; in gfs2_control_func()
652 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
670 * yet been updated for the generation of the failure in gfs2_control_func()
682 control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits); in gfs2_control_func()
684 spin_lock(&ls->ls_recover_spin); in gfs2_control_func()
685 if (block_gen != ls->ls_recover_block || in gfs2_control_func()
686 start_gen != ls->ls_recover_start) { in gfs2_control_func()
687 fs_info(sdp, "recover generation %u block1 %u %u\n", in gfs2_control_func()
688 start_gen, block_gen, ls->ls_recover_block); in gfs2_control_func()
689 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
694 recover_size = ls->ls_recover_size; in gfs2_control_func()
701 * in succession. Only the first will really do recovery, in gfs2_control_func()
707 if (ls->ls_recover_result[i] != LM_RD_SUCCESS) in gfs2_control_func()
710 ls->ls_recover_result[i] = 0; in gfs2_control_func()
712 if (!test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET)) in gfs2_control_func()
715 __clear_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET); in gfs2_control_func()
725 if (!ls->ls_recover_submit[i]) in gfs2_control_func()
727 if (ls->ls_recover_submit[i] < lvb_gen) in gfs2_control_func()
728 ls->ls_recover_submit[i] = 0; in gfs2_control_func()
735 if (!ls->ls_recover_submit[i]) in gfs2_control_func()
737 if (ls->ls_recover_submit[i] < start_gen) { in gfs2_control_func()
738 ls->ls_recover_submit[i] = 0; in gfs2_control_func()
739 __set_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET); in gfs2_control_func()
743 latest generation to the lvb */ in gfs2_control_func()
750 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
753 control_lvb_write(ls, start_gen, ls->ls_lvb_bits); in gfs2_control_func()
773 if (test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET)) { in gfs2_control_func()
774 fs_info(sdp, "recover generation %u jid %d\n", in gfs2_control_func()
789 spin_lock(&ls->ls_recover_spin); in gfs2_control_func()
790 if (ls->ls_recover_block == block_gen && in gfs2_control_func()
791 ls->ls_recover_start == start_gen) { in gfs2_control_func()
792 clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in gfs2_control_func()
793 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
794 fs_info(sdp, "recover generation %u done\n", start_gen); in gfs2_control_func()
797 fs_info(sdp, "recover generation %u block2 %u %u\n", in gfs2_control_func()
798 start_gen, block_gen, ls->ls_recover_block); in gfs2_control_func()
799 spin_unlock(&ls->ls_recover_spin); in gfs2_control_func()
805 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in control_mount()
811 memset(&ls->ls_mounted_lksb, 0, sizeof(struct dlm_lksb)); in control_mount()
812 memset(&ls->ls_control_lksb, 0, sizeof(struct dlm_lksb)); in control_mount()
813 memset(&ls->ls_control_lvb, 0, GDLM_LVB_SIZE); in control_mount()
814 ls->ls_control_lksb.sb_lvbptr = ls->ls_control_lvb; in control_mount()
815 init_completion(&ls->ls_sync_wait); in control_mount()
817 set_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in control_mount()
835 error = -EINTR; in control_mount()
866 if (error == -EAGAIN) { in control_mount()
875 * we cannot do the first-mount responsibility it implies: recovery. in control_mount()
877 if (sdp->sd_args.ar_spectator) in control_mount()
884 } else if (error != -EAGAIN) { in control_mount()
894 /* not even -EAGAIN should happen here */ in control_mount()
901 * If we got both locks above in EX, then we're the first mounter. in control_mount()
903 * updated by other mounted nodes to reflect our mount generation. in control_mount()
905 * In simple first mounter cases, first mounter will see zero lvb_gen, in control_mount()
908 * lvb_gen will be non-zero. in control_mount()
911 control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits); in control_mount()
916 error = -EINVAL; in control_mount()
921 /* first mounter, keep both EX while doing first recovery */ in control_mount()
922 spin_lock(&ls->ls_recover_spin); in control_mount()
923 clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in control_mount()
924 set_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags); in control_mount()
925 set_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags); in control_mount()
926 spin_unlock(&ls->ls_recover_spin); in control_mount()
927 fs_info(sdp, "first mounter control generation %u\n", lvb_gen); in control_mount()
936 * We are not first mounter, now we need to wait for the control_lock in control_mount()
937 * lvb generation to be >= the generation from our first recover_done in control_mount()
941 if (!all_jid_bits_clear(ls->ls_lvb_bits)) { in control_mount()
947 spin_lock(&ls->ls_recover_spin); in control_mount()
948 block_gen = ls->ls_recover_block; in control_mount()
949 start_gen = ls->ls_recover_start; in control_mount()
950 mount_gen = ls->ls_recover_mount; in control_mount()
954 generation, which might include new recovery bits set */ in control_mount()
955 if (sdp->sd_args.ar_spectator) { in control_mount()
957 "non-spectator to mount.\n"); in control_mount()
963 ls->ls_recover_flags); in control_mount()
965 spin_unlock(&ls->ls_recover_spin); in control_mount()
971 latest recovery generation */ in control_mount()
974 lvb_gen, ls->ls_recover_flags); in control_mount()
975 spin_unlock(&ls->ls_recover_spin); in control_mount()
983 lvb_gen, ls->ls_recover_flags); in control_mount()
984 spin_unlock(&ls->ls_recover_spin); in control_mount()
988 clear_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in control_mount()
989 set_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags); in control_mount()
990 memset(ls->ls_recover_submit, 0, ls->ls_recover_size*sizeof(uint32_t)); in control_mount()
991 memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t)); in control_mount()
992 spin_unlock(&ls->ls_recover_spin); in control_mount()
1003 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in control_first_done()
1008 spin_lock(&ls->ls_recover_spin); in control_first_done()
1009 start_gen = ls->ls_recover_start; in control_first_done()
1010 block_gen = ls->ls_recover_block; in control_first_done()
1012 if (test_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags) || in control_first_done()
1013 !test_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags) || in control_first_done()
1014 !test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags)) { in control_first_done()
1017 start_gen, block_gen, ls->ls_recover_flags); in control_first_done()
1018 spin_unlock(&ls->ls_recover_spin); in control_first_done()
1020 return -1; in control_first_done()
1026 * first mounter recovery. We can ignore any recover_slot in control_first_done()
1028 * because we are still the first mounter and any failed nodes in control_first_done()
1031 spin_unlock(&ls->ls_recover_spin); in control_first_done()
1034 wait_on_bit(&ls->ls_recover_flags, DFL_DLM_RECOVERY, in control_first_done()
1039 clear_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags); in control_first_done()
1040 set_bit(DFL_FIRST_MOUNT_DONE, &ls->ls_recover_flags); in control_first_done()
1041 memset(ls->ls_recover_submit, 0, ls->ls_recover_size*sizeof(uint32_t)); in control_first_done()
1042 memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t)); in control_first_done()
1043 spin_unlock(&ls->ls_recover_spin); in control_first_done()
1045 memset(ls->ls_lvb_bits, 0, GDLM_LVB_SIZE); in control_first_done()
1046 control_lvb_write(ls, start_gen, ls->ls_lvb_bits); in control_first_done()
1062 * gfs2 jids start at 0, so jid = slot - 1)
1070 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in set_recover_size()
1076 if (!ls->ls_lvb_bits) { in set_recover_size()
1077 ls->ls_lvb_bits = kzalloc(GDLM_LVB_SIZE, GFP_NOFS); in set_recover_size()
1078 if (!ls->ls_lvb_bits) in set_recover_size()
1079 return -ENOMEM; in set_recover_size()
1084 if (max_jid < slots[i].slot - 1) in set_recover_size()
1085 max_jid = slots[i].slot - 1; in set_recover_size()
1088 old_size = ls->ls_recover_size; in set_recover_size()
1100 return -ENOMEM; in set_recover_size()
1103 spin_lock(&ls->ls_recover_spin); in set_recover_size()
1104 memcpy(submit, ls->ls_recover_submit, old_size * sizeof(uint32_t)); in set_recover_size()
1105 memcpy(result, ls->ls_recover_result, old_size * sizeof(uint32_t)); in set_recover_size()
1106 kfree(ls->ls_recover_submit); in set_recover_size()
1107 kfree(ls->ls_recover_result); in set_recover_size()
1108 ls->ls_recover_submit = submit; in set_recover_size()
1109 ls->ls_recover_result = result; in set_recover_size()
1110 ls->ls_recover_size = new_size; in set_recover_size()
1111 spin_unlock(&ls->ls_recover_spin); in set_recover_size()
1117 kfree(ls->ls_lvb_bits); in free_recover_size()
1118 kfree(ls->ls_recover_submit); in free_recover_size()
1119 kfree(ls->ls_recover_result); in free_recover_size()
1120 ls->ls_recover_submit = NULL; in free_recover_size()
1121 ls->ls_recover_result = NULL; in free_recover_size()
1122 ls->ls_recover_size = 0; in free_recover_size()
1123 ls->ls_lvb_bits = NULL; in free_recover_size()
1131 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_recover_prep()
1137 spin_lock(&ls->ls_recover_spin); in gdlm_recover_prep()
1138 ls->ls_recover_block = ls->ls_recover_start; in gdlm_recover_prep()
1139 set_bit(DFL_DLM_RECOVERY, &ls->ls_recover_flags); in gdlm_recover_prep()
1141 if (!test_bit(DFL_MOUNT_DONE, &ls->ls_recover_flags) || in gdlm_recover_prep()
1142 test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags)) { in gdlm_recover_prep()
1143 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_prep()
1146 set_bit(DFL_BLOCK_LOCKS, &ls->ls_recover_flags); in gdlm_recover_prep()
1147 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_prep()
1156 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_recover_slot()
1157 int jid = slot->slot - 1; in gdlm_recover_slot()
1164 spin_lock(&ls->ls_recover_spin); in gdlm_recover_slot()
1165 if (ls->ls_recover_size < jid + 1) { in gdlm_recover_slot()
1167 jid, ls->ls_recover_block, ls->ls_recover_size); in gdlm_recover_slot()
1168 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_slot()
1172 if (ls->ls_recover_submit[jid]) { in gdlm_recover_slot()
1174 jid, ls->ls_recover_block, ls->ls_recover_submit[jid]); in gdlm_recover_slot()
1176 ls->ls_recover_submit[jid] = ls->ls_recover_block; in gdlm_recover_slot()
1177 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_slot()
1183 int our_slot, uint32_t generation) in gdlm_recover_done() argument
1186 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_recover_done()
1195 spin_lock(&ls->ls_recover_spin); in gdlm_recover_done()
1196 ls->ls_recover_start = generation; in gdlm_recover_done()
1198 if (!ls->ls_recover_mount) { in gdlm_recover_done()
1199 ls->ls_recover_mount = generation; in gdlm_recover_done()
1200 ls->ls_jid = our_slot - 1; in gdlm_recover_done()
1203 if (!test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) in gdlm_recover_done()
1204 queue_delayed_work(gfs2_control_wq, &sdp->sd_control_work, 0); in gdlm_recover_done()
1206 clear_bit(DFL_DLM_RECOVERY, &ls->ls_recover_flags); in gdlm_recover_done()
1208 wake_up_bit(&ls->ls_recover_flags, DFL_DLM_RECOVERY); in gdlm_recover_done()
1209 spin_unlock(&ls->ls_recover_spin); in gdlm_recover_done()
1217 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_recovery_result()
1224 if (test_bit(DFL_NO_DLM_OPS, &ls->ls_recover_flags)) in gdlm_recovery_result()
1228 if (jid == ls->ls_jid) in gdlm_recovery_result()
1231 spin_lock(&ls->ls_recover_spin); in gdlm_recovery_result()
1232 if (test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags)) { in gdlm_recovery_result()
1233 spin_unlock(&ls->ls_recover_spin); in gdlm_recovery_result()
1236 if (ls->ls_recover_size < jid + 1) { in gdlm_recovery_result()
1238 jid, ls->ls_recover_size); in gdlm_recovery_result()
1239 spin_unlock(&ls->ls_recover_spin); in gdlm_recovery_result()
1246 ls->ls_recover_result[jid] = result; in gdlm_recovery_result()
1252 if (!test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) in gdlm_recovery_result()
1253 queue_delayed_work(gfs2_control_wq, &sdp->sd_control_work, in gdlm_recovery_result()
1255 spin_unlock(&ls->ls_recover_spin); in gdlm_recovery_result()
1266 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_mount()
1276 INIT_DELAYED_WORK(&sdp->sd_control_work, gfs2_control_func); in gdlm_mount()
1277 spin_lock_init(&ls->ls_recover_spin); in gdlm_mount()
1278 ls->ls_recover_flags = 0; in gdlm_mount()
1279 ls->ls_recover_mount = 0; in gdlm_mount()
1280 ls->ls_recover_start = 0; in gdlm_mount()
1281 ls->ls_recover_block = 0; in gdlm_mount()
1282 ls->ls_recover_size = 0; in gdlm_mount()
1283 ls->ls_recover_submit = NULL; in gdlm_mount()
1284 ls->ls_recover_result = NULL; in gdlm_mount()
1285 ls->ls_lvb_bits = NULL; in gdlm_mount()
1298 error = -EINVAL; in gdlm_mount()
1302 memcpy(cluster, table, strlen(table) - strlen(fsname)); in gdlm_mount()
1313 &ls->ls_dlm); in gdlm_mount()
1326 set_bit(DFL_NO_DLM_OPS, &ls->ls_recover_flags); in gdlm_mount()
1330 if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags)) { in gdlm_mount()
1332 error = -EINVAL; in gdlm_mount()
1337 * control_mount() uses control_lock to determine first mounter, in gdlm_mount()
1347 ls->ls_first = !!test_bit(DFL_FIRST_MOUNT, &ls->ls_recover_flags); in gdlm_mount()
1348 clear_bit(SDF_NOJOURNALID, &sdp->sd_flags); in gdlm_mount()
1350 wake_up_bit(&sdp->sd_flags, SDF_NOJOURNALID); in gdlm_mount()
1354 dlm_release_lockspace(ls->ls_dlm, 2); in gdlm_mount()
1363 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_first_done()
1366 if (test_bit(DFL_NO_DLM_OPS, &ls->ls_recover_flags)) in gdlm_first_done()
1376 struct lm_lockstruct *ls = &sdp->sd_lockstruct; in gdlm_unmount()
1378 if (test_bit(DFL_NO_DLM_OPS, &ls->ls_recover_flags)) in gdlm_unmount()
1383 spin_lock(&ls->ls_recover_spin); in gdlm_unmount()
1384 set_bit(DFL_UNMOUNT, &ls->ls_recover_flags); in gdlm_unmount()
1385 spin_unlock(&ls->ls_recover_spin); in gdlm_unmount()
1386 flush_delayed_work(&sdp->sd_control_work); in gdlm_unmount()
1390 if (ls->ls_dlm) { in gdlm_unmount()
1391 dlm_release_lockspace(ls->ls_dlm, 2); in gdlm_unmount()
1392 ls->ls_dlm = NULL; in gdlm_unmount()
1401 { Opt_first, "first=%d"},