This patch adds the lkb_rv_mode to the ast tracepoint. The lkb_rv_mode is the requested mode by dlm_lock() requests. We cannot use lkb_mode as dlm internally sometimes changes this value and for cases like the dlm kernel verifier we want to check on DLM correctness from what the user is seeing. This new tracepoint events tells us what the requested mode was.
Signed-off-by: Alexander Aring <aahri...@redhat.com> --- fs/dlm/ast.c | 9 +++++---- fs/dlm/dlm_internal.h | 2 ++ fs/dlm/lock.c | 1 + fs/dlm/user.c | 2 +- include/trace/events/dlm.h | 11 +++++++---- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c index 01de0d4b9450..fc2ca37011d8 100644 --- a/fs/dlm/ast.c +++ b/fs/dlm/ast.c @@ -24,7 +24,7 @@ static void dlm_run_callback(int our_nodeid, uint32_t ls_id, uint32_t lkb_id, void (*astfn)(void *astparam), void (*bastfn)(void *astparam, int mode), void *astparam, const char *res_name, - size_t res_length) + size_t res_length, int rv_mode) { if (flags & DLM_CB_BAST) { trace_dlm_bast(our_nodeid, ls_id, lkb_id, mode, res_name, @@ -32,7 +32,7 @@ static void dlm_run_callback(int our_nodeid, uint32_t ls_id, uint32_t lkb_id, bastfn(astparam, mode); } else if (flags & DLM_CB_CAST) { trace_dlm_ast(our_nodeid, ls_id, lkb_id, sb_flags, sb_status, - res_name, res_length); + res_name, res_length, rv_mode); lksb->sb_status = sb_status; lksb->sb_flags = sb_flags; astfn(astparam); @@ -44,7 +44,7 @@ static void dlm_do_callback(struct dlm_callback *cb) dlm_run_callback(cb->our_nodeid, cb->ls_id, cb->lkb_id, cb->mode, cb->flags, cb->sb_flags, cb->sb_status, cb->lkb_lksb, cb->astfn, cb->bastfn, cb->astparam, - cb->res_name, cb->res_length); + cb->res_name, cb->res_length, cb->rv_mode); dlm_free_cb(cb); } @@ -134,6 +134,7 @@ int dlm_get_cb(struct dlm_lkb *lkb, uint32_t flags, int mode, (*cb)->our_nodeid = ls->ls_dn->our_node->id; (*cb)->lkb_id = lkb->lkb_id; (*cb)->ls_id = ls->ls_global_id; + (*cb)->rv_mode = lkb->lkb_rv_mode; memcpy((*cb)->res_name, rsb->res_name, rsb->res_length); (*cb)->res_length = rsb->res_length; @@ -192,7 +193,7 @@ void dlm_add_cb(struct dlm_lkb *lkb, uint32_t flags, int mode, int status, flags, sbflags, status, lkb->lkb_lksb, lkb->lkb_astfn, lkb->lkb_bastfn, lkb->lkb_astparam, rsb->res_name, - rsb->res_length); + rsb->res_length, lkb->lkb_rv_mode); } else { rv = dlm_get_queue_cb(lkb, flags, mode, status, sbflags, &cb); if (!rv) diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h index bc3ff1b64e0c..3f630696f7ab 100644 --- a/fs/dlm/dlm_internal.h +++ b/fs/dlm/dlm_internal.h @@ -247,6 +247,7 @@ struct dlm_callback { size_t res_length; uint32_t ls_id; uint32_t lkb_id; + int rv_mode; struct list_head list; }; @@ -296,6 +297,7 @@ struct dlm_lkb { void *lkb_astparam; /* caller's ast arg */ struct dlm_user_args *lkb_ua; }; + int lkb_rv_mode; struct rcu_head rcu; }; diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 8cb5a537bfd3..21bb9603a0df 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -2844,6 +2844,7 @@ static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, lkb->lkb_lksb = args->lksb; lkb->lkb_lvbptr = args->lksb->sb_lvbptr; lkb->lkb_ownpid = (int) current->pid; + lkb->lkb_rv_mode = args->mode; rv = 0; out: switch (rv) { diff --git a/fs/dlm/user.c b/fs/dlm/user.c index c4d6e67ff63e..75fb85676e90 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c @@ -875,7 +875,7 @@ static ssize_t device_read(struct file *file, char __user *buf, size_t count, cb->lkb_lksb->sb_flags = cb->sb_flags; trace_dlm_ast(cb->our_nodeid, cb->ls_id, cb->lkb_id, cb->sb_status, cb->sb_flags, cb->res_name, - cb->res_length); + cb->res_length, cb->rv_mode); } ret = copy_result_to_user(&cb->ua, diff --git a/include/trace/events/dlm.h b/include/trace/events/dlm.h index 2621bb7ac3a8..f8d7ca451760 100644 --- a/include/trace/events/dlm.h +++ b/include/trace/events/dlm.h @@ -228,10 +228,10 @@ TRACE_EVENT(dlm_ast, TP_PROTO(unsigned int our_nodeid, __u32 ls_id, __u32 lkb_id, __u8 sb_flags, int sb_status, const char *res_name, - size_t res_length), + size_t res_length, int rv_mode), TP_ARGS(our_nodeid, ls_id, lkb_id, sb_flags, sb_status, res_name, - res_length), + res_length, rv_mode), TP_STRUCT__entry( __field(unsigned int, our_nodeid) @@ -239,6 +239,7 @@ TRACE_EVENT(dlm_ast, __field(__u32, lkb_id) __field(__u8, sb_flags) __field(int, sb_status) + __field(int, rv_mode) __dynamic_array(unsigned char, res_name, res_length) ), @@ -248,16 +249,18 @@ TRACE_EVENT(dlm_ast, __entry->lkb_id = lkb_id; __entry->sb_flags = sb_flags; __entry->sb_status = sb_status; + __entry->rv_mode = rv_mode; memcpy(__get_dynamic_array(res_name), res_name, __get_dynamic_array_len(res_name)); ), - TP_printk("our_nodeid=%u ls_id=%u lkb_id=%x sb_flags=%s sb_status=%d res_name=%s", + TP_printk("our_nodeid=%u ls_id=%u lkb_id=%x sb_flags=%s sb_status=%d res_name=%s rv_mode=%d", __entry->our_nodeid, __entry->ls_id, __entry->lkb_id, show_dlm_sb_flags(__entry->sb_flags), __entry->sb_status, __print_hex_str(__get_dynamic_array(res_name), - __get_dynamic_array_len(res_name))) + __get_dynamic_array_len(res_name)), + __entry->rv_mode) ); -- 2.43.0