diff options
author | Alexander Aring <aahringo@redhat.com> | 2024-06-03 17:55:54 -0400 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2024-06-11 12:50:30 -0500 |
commit | d3d85e9ad55b973eff3641dd3a61990a2c810785 (patch) | |
tree | 712afc890bf3a88343c0961ede72ad9aa4a12f2c /fs/dlm | |
parent | 01fdeca1cc2dd705b1391f31a2594214c8bd7886 (diff) | |
download | linux-d3d85e9ad55b973eff3641dd3a61990a2c810785.tar.gz linux-d3d85e9ad55b973eff3641dd3a61990a2c810785.tar.bz2 linux-d3d85e9ad55b973eff3641dd3a61990a2c810785.zip |
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>
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/ast.c | 17 | ||||
-rw-r--r-- | fs/dlm/dlm_internal.h | 1 | ||||
-rw-r--r-- | fs/dlm/lockspace.c | 13 |
3 files changed, 19 insertions, 12 deletions
diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c index 59711486d801..52ce27031314 100644 --- a/fs/dlm/ast.c +++ b/fs/dlm/ast.c @@ -161,6 +161,9 @@ void dlm_add_cb(struct dlm_lkb *lkb, uint32_t flags, int mode, int status, int dlm_callback_start(struct dlm_ls *ls) { + if (!test_bit(LSFL_FS, &ls->ls_flags)) + return 0; + ls->ls_callback_wq = alloc_ordered_workqueue("dlm_callback", WQ_HIGHPRI | WQ_MEM_RECLAIM); if (!ls->ls_callback_wq) { @@ -178,13 +181,15 @@ void dlm_callback_stop(struct dlm_ls *ls) void dlm_callback_suspend(struct dlm_ls *ls) { - if (ls->ls_callback_wq) { - spin_lock_bh(&ls->ls_cb_lock); - set_bit(LSFL_CB_DELAY, &ls->ls_flags); - spin_unlock_bh(&ls->ls_cb_lock); + if (!test_bit(LSFL_FS, &ls->ls_flags)) + return; + spin_lock_bh(&ls->ls_cb_lock); + set_bit(LSFL_CB_DELAY, &ls->ls_flags); + spin_unlock_bh(&ls->ls_cb_lock); + + if (ls->ls_callback_wq) flush_workqueue(ls->ls_callback_wq); - } } #define MAX_CB_QUEUE 25 @@ -195,7 +200,7 @@ void dlm_callback_resume(struct dlm_ls *ls) int count = 0, sum = 0; bool empty; - if (!ls->ls_callback_wq) + if (!test_bit(LSFL_FS, &ls->ls_flags)) return; more: diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index e06fa17c5603..c6baf25b9cae 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h @@ -698,6 +698,7 @@ struct dlm_ls { #define LSFL_CB_DELAY 9 #define LSFL_NODIR 10 #define LSFL_RECV_MSG_BLOCKED 11 +#define LSFL_FS 12 #define DLM_PROC_FLAGS_CLOSING 1 #define DLM_PROC_FLAGS_COMPAT 2 diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 3990880faea7..8a4351ee9a42 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c @@ -499,12 +499,13 @@ static int new_lockspace(const char *name, const char *cluster, list_add(&ls->ls_list, &lslist); spin_unlock_bh(&lslist_lock); - if (flags & DLM_LSFL_FS) { - error = dlm_callback_start(ls); - if (error) { - log_error(ls, "can't start dlm_callback %d", error); - goto out_delist; - } + if (flags & DLM_LSFL_FS) + set_bit(LSFL_FS, &ls->ls_flags); + + error = dlm_callback_start(ls); + if (error) { + log_error(ls, "can't start dlm_callback %d", error); + goto out_delist; } init_waitqueue_head(&ls->ls_recover_lock_wait); |