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 <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
Alexander Aring 2023-05-29 17:44:35 -04:00 коммит произвёл David Teigland
Родитель d41a1a3db4
Коммит 5ce9ef30f2
4 изменённых файлов: 19 добавлений и 18 удалений

Просмотреть файл

@ -36,23 +36,6 @@ void dlm_callback_set_last_ptr(struct dlm_callback **from,
*from = to; *from = to;
} }
void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb)
{
struct dlm_callback *cb, *safe;
list_for_each_entry_safe(cb, safe, &lkb->lkb_callbacks, list) {
list_del(&cb->list);
kref_put(&cb->ref, dlm_release_callback);
}
clear_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags);
/* invalidate */
dlm_callback_set_last_ptr(&lkb->lkb_last_cast, NULL);
dlm_callback_set_last_ptr(&lkb->lkb_last_cb, NULL);
lkb->lkb_last_bast_mode = -1;
}
int dlm_enqueue_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode, int dlm_enqueue_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode,
int status, uint32_t sbflags) int status, uint32_t sbflags)
{ {

Просмотреть файл

@ -26,7 +26,6 @@ void dlm_callback_set_last_ptr(struct dlm_callback **from,
struct dlm_callback *to); struct dlm_callback *to);
void dlm_release_callback(struct kref *ref); void dlm_release_callback(struct kref *ref);
void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb);
void dlm_callback_work(struct work_struct *work); void dlm_callback_work(struct work_struct *work);
int dlm_callback_start(struct dlm_ls *ls); int dlm_callback_start(struct dlm_ls *ls);
void dlm_callback_stop(struct dlm_ls *ls); void dlm_callback_stop(struct dlm_ls *ls);

Просмотреть файл

@ -145,6 +145,24 @@ static void compat_output(struct dlm_lock_result *res,
} }
#endif #endif
/* should held proc->asts_spin lock */
void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb)
{
struct dlm_callback *cb, *safe;
list_for_each_entry_safe(cb, safe, &lkb->lkb_callbacks, list) {
list_del(&cb->list);
kref_put(&cb->ref, dlm_release_callback);
}
clear_bit(DLM_IFL_CB_PENDING_BIT, &lkb->lkb_iflags);
/* invalidate */
dlm_callback_set_last_ptr(&lkb->lkb_last_cast, NULL);
dlm_callback_set_last_ptr(&lkb->lkb_last_cb, NULL);
lkb->lkb_last_bast_mode = -1;
}
/* Figure out if this lock is at the end of its life and no longer /* Figure out if this lock is at the end of its life and no longer
available for the application to use. The lkb still exists until available for the application to use. The lkb still exists until
the final ast is read. A lock becomes EOL in three situations: the final ast is read. A lock becomes EOL in three situations:

Просмотреть файл

@ -6,6 +6,7 @@
#ifndef __USER_DOT_H__ #ifndef __USER_DOT_H__
#define __USER_DOT_H__ #define __USER_DOT_H__
void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb);
void dlm_user_add_ast(struct dlm_lkb *lkb, uint32_t flags, int mode, void dlm_user_add_ast(struct dlm_lkb *lkb, uint32_t flags, int mode,
int status, uint32_t sbflags); int status, uint32_t sbflags);
int dlm_user_init(void); int dlm_user_init(void);