Skip to content

Commit d3d85e9

Browse files
Alexander Aringteigland
authored andcommitted
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 <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 01fdeca commit d3d85e9

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

fs/dlm/ast.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ void dlm_add_cb(struct dlm_lkb *lkb, uint32_t flags, int mode, int status,
161161

162162
int dlm_callback_start(struct dlm_ls *ls)
163163
{
164+
if (!test_bit(LSFL_FS, &ls->ls_flags))
165+
return 0;
166+
164167
ls->ls_callback_wq = alloc_ordered_workqueue("dlm_callback",
165168
WQ_HIGHPRI | WQ_MEM_RECLAIM);
166169
if (!ls->ls_callback_wq) {
@@ -178,13 +181,15 @@ void dlm_callback_stop(struct dlm_ls *ls)
178181

179182
void dlm_callback_suspend(struct dlm_ls *ls)
180183
{
181-
if (ls->ls_callback_wq) {
182-
spin_lock_bh(&ls->ls_cb_lock);
183-
set_bit(LSFL_CB_DELAY, &ls->ls_flags);
184-
spin_unlock_bh(&ls->ls_cb_lock);
184+
if (!test_bit(LSFL_FS, &ls->ls_flags))
185+
return;
185186

187+
spin_lock_bh(&ls->ls_cb_lock);
188+
set_bit(LSFL_CB_DELAY, &ls->ls_flags);
189+
spin_unlock_bh(&ls->ls_cb_lock);
190+
191+
if (ls->ls_callback_wq)
186192
flush_workqueue(ls->ls_callback_wq);
187-
}
188193
}
189194

190195
#define MAX_CB_QUEUE 25
@@ -195,7 +200,7 @@ void dlm_callback_resume(struct dlm_ls *ls)
195200
int count = 0, sum = 0;
196201
bool empty;
197202

198-
if (!ls->ls_callback_wq)
203+
if (!test_bit(LSFL_FS, &ls->ls_flags))
199204
return;
200205

201206
more:

fs/dlm/dlm_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ struct dlm_ls {
698698
#define LSFL_CB_DELAY 9
699699
#define LSFL_NODIR 10
700700
#define LSFL_RECV_MSG_BLOCKED 11
701+
#define LSFL_FS 12
701702

702703
#define DLM_PROC_FLAGS_CLOSING 1
703704
#define DLM_PROC_FLAGS_COMPAT 2

fs/dlm/lockspace.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,13 @@ static int new_lockspace(const char *name, const char *cluster,
499499
list_add(&ls->ls_list, &lslist);
500500
spin_unlock_bh(&lslist_lock);
501501

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;
508509
}
509510

510511
init_waitqueue_head(&ls->ls_recover_lock_wait);

0 commit comments

Comments
 (0)