Skip to content

Commit 5ce9ef3

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: move dlm_purge_lkb_callbacks to user module
This patch moves the dlm_purge_lkb_callbacks() function from ast to user dlm module as it is only a function being used by dlm user implementation. I got be hinted to hold specific locks regarding the callback handling for dlm_purge_lkb_callbacks() but it was false positive. It is confusing because ast dlm implementation uses a different locking behaviour as user locks uses as DLM handles kernel and user dlm locks differently. To avoid the confusing we move this function to dlm user implementation. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent d41a1a3 commit 5ce9ef3

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

fs/dlm/ast.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,6 @@ void dlm_callback_set_last_ptr(struct dlm_callback **from,
3636
*from = to;
3737
}
3838

39-
void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb)
40-
{
41-
struct dlm_callback *cb, *safe;
42-
43-
list_for_each_entry_safe(cb, safe, &lkb->lkb_callbacks, list) {
44-
list_del(&cb->list);
45-
kref_put(&cb->ref, dlm_release_callback);
46-
}
47-
48-
clear_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags);
49-
50-
/* invalidate */
51-
dlm_callback_set_last_ptr(&lkb->lkb_last_cast, NULL);
52-
dlm_callback_set_last_ptr(&lkb->lkb_last_cb, NULL);
53-
lkb->lkb_last_bast_mode = -1;
54-
}
55-
5639
int dlm_enqueue_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode,
5740
int status, uint32_t sbflags)
5841
{

fs/dlm/ast.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ void dlm_callback_set_last_ptr(struct dlm_callback **from,
2626
struct dlm_callback *to);
2727

2828
void dlm_release_callback(struct kref *ref);
29-
void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb);
3029
void dlm_callback_work(struct work_struct *work);
3130
int dlm_callback_start(struct dlm_ls *ls);
3231
void dlm_callback_stop(struct dlm_ls *ls);

fs/dlm/user.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,24 @@ static void compat_output(struct dlm_lock_result *res,
145145
}
146146
#endif
147147

148+
/* should held proc->asts_spin lock */
149+
void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb)
150+
{
151+
struct dlm_callback *cb, *safe;
152+
153+
list_for_each_entry_safe(cb, safe, &lkb->lkb_callbacks, list) {
154+
list_del(&cb->list);
155+
kref_put(&cb->ref, dlm_release_callback);
156+
}
157+
158+
clear_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags);
159+
160+
/* invalidate */
161+
dlm_callback_set_last_ptr(&lkb->lkb_last_cast, NULL);
162+
dlm_callback_set_last_ptr(&lkb->lkb_last_cb, NULL);
163+
lkb->lkb_last_bast_mode = -1;
164+
}
165+
148166
/* Figure out if this lock is at the end of its life and no longer
149167
available for the application to use. The lkb still exists until
150168
the final ast is read. A lock becomes EOL in three situations:

fs/dlm/user.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#ifndef __USER_DOT_H__
77
#define __USER_DOT_H__
88

9+
void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb);
910
void dlm_user_add_ast(struct dlm_lkb *lkb, uint32_t flags, int mode,
1011
int status, uint32_t sbflags);
1112
int dlm_user_init(void);

0 commit comments

Comments
 (0)