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

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>

authored by

Alexander Aring and committed by
David Teigland
5ce9ef30 d41a1a3d

+19 -18
-17
fs/dlm/ast.c
··· 36 36 *from = to; 37 37 } 38 38 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 - 56 39 int dlm_enqueue_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode, 57 40 int status, uint32_t sbflags) 58 41 {
-1
fs/dlm/ast.h
··· 26 26 struct dlm_callback *to); 27 27 28 28 void dlm_release_callback(struct kref *ref); 29 - void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb); 30 29 void dlm_callback_work(struct work_struct *work); 31 30 int dlm_callback_start(struct dlm_ls *ls); 32 31 void dlm_callback_stop(struct dlm_ls *ls);
+18
fs/dlm/user.c
··· 145 145 } 146 146 #endif 147 147 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 + 148 166 /* Figure out if this lock is at the end of its life and no longer 149 167 available for the application to use. The lkb still exists until 150 168 the final ast is read. A lock becomes EOL in three situations:
+1
fs/dlm/user.h
··· 6 6 #ifndef __USER_DOT_H__ 7 7 #define __USER_DOT_H__ 8 8 9 + void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb); 9 10 void dlm_user_add_ast(struct dlm_lkb *lkb, uint32_t flags, int mode, 10 11 int status, uint32_t sbflags); 11 12 int dlm_user_init(void);