Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dlm: use LSFL_FS to check for kernel lockspace

The existing external lockspace flag DLM_LSFL_FS is now also
saved as an internal flag LSFL_FS, so it can be checked from
other code locations which want to know if a lockspace is
used from the kernel or user space.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>

authored by

Alexander Aring and committed by
David Teigland
d3d85e9a 01fdeca1

+19 -12
+11 -6
fs/dlm/ast.c
··· 161 161 162 162 int dlm_callback_start(struct dlm_ls *ls) 163 163 { 164 + if (!test_bit(LSFL_FS, &ls->ls_flags)) 165 + return 0; 166 + 164 167 ls->ls_callback_wq = alloc_ordered_workqueue("dlm_callback", 165 168 WQ_HIGHPRI | WQ_MEM_RECLAIM); 166 169 if (!ls->ls_callback_wq) { ··· 181 178 182 179 void dlm_callback_suspend(struct dlm_ls *ls) 183 180 { 184 - if (ls->ls_callback_wq) { 185 - spin_lock_bh(&ls->ls_cb_lock); 186 - set_bit(LSFL_CB_DELAY, &ls->ls_flags); 187 - spin_unlock_bh(&ls->ls_cb_lock); 181 + if (!test_bit(LSFL_FS, &ls->ls_flags)) 182 + return; 188 183 184 + spin_lock_bh(&ls->ls_cb_lock); 185 + set_bit(LSFL_CB_DELAY, &ls->ls_flags); 186 + spin_unlock_bh(&ls->ls_cb_lock); 187 + 188 + if (ls->ls_callback_wq) 189 189 flush_workqueue(ls->ls_callback_wq); 190 - } 191 190 } 192 191 193 192 #define MAX_CB_QUEUE 25 ··· 200 195 int count = 0, sum = 0; 201 196 bool empty; 202 197 203 - if (!ls->ls_callback_wq) 198 + if (!test_bit(LSFL_FS, &ls->ls_flags)) 204 199 return; 205 200 206 201 more:
+1
fs/dlm/dlm_internal.h
··· 698 698 #define LSFL_CB_DELAY 9 699 699 #define LSFL_NODIR 10 700 700 #define LSFL_RECV_MSG_BLOCKED 11 701 + #define LSFL_FS 12 701 702 702 703 #define DLM_PROC_FLAGS_CLOSING 1 703 704 #define DLM_PROC_FLAGS_COMPAT 2
+7 -6
fs/dlm/lockspace.c
··· 499 499 list_add(&ls->ls_list, &lslist); 500 500 spin_unlock_bh(&lslist_lock); 501 501 502 - if (flags & DLM_LSFL_FS) { 503 - error = dlm_callback_start(ls); 504 - if (error) { 505 - log_error(ls, "can't start dlm_callback %d", error); 506 - goto out_delist; 507 - } 502 + if (flags & DLM_LSFL_FS) 503 + set_bit(LSFL_FS, &ls->ls_flags); 504 + 505 + error = dlm_callback_start(ls); 506 + if (error) { 507 + log_error(ls, "can't start dlm_callback %d", error); 508 + goto out_delist; 508 509 } 509 510 510 511 init_waitqueue_head(&ls->ls_recover_lock_wait);