From ee96b650f0edb18ab5a0345632bba01c14e8067a Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Mon, 11 Dec 2017 16:51:33 -0600 Subject: [PATCH] scoutfs: log dlm errors We had disabled ocfs2_log_dlm_error() during the initial import. Re-enable it so the kernel can log dlm errors. One problem is that our binary lock names don't lend themselves legible prints. Add a buffer to the lockres to hold a pretty-printed version of the lock name. We fill it from the ->print callback. Signed-off-by: Mark Fasheh --- kmod/src/dlmglue.c | 17 ++++------------- kmod/src/dlmglue.h | 2 ++ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/kmod/src/dlmglue.c b/kmod/src/dlmglue.c index 82611482..c48ba5be 100644 --- a/kmod/src/dlmglue.c +++ b/kmod/src/dlmglue.c @@ -120,20 +120,9 @@ static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres); static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, int convert); -#if 0 #define ocfs2_log_dlm_error(_func, _err, _lockres) do { \ - if ((_lockres)->l_type != OCFS2_LOCK_TYPE_DENTRY) \ - mlog(ML_ERROR, "DLM error %d while calling %s on resource %s\n", \ - _err, _func, _lockres->l_name); \ - else \ - mlog(ML_ERROR, "DLM error %d while calling %s on resource %.*s%08x\n", \ - _err, _func, OCFS2_DENTRY_LOCK_INO_START - 1, (_lockres)->l_name, \ - (unsigned int)ocfs2_get_dentry_lock_ino(_lockres)); \ -} while (0) -#endif -#define ocfs2_log_dlm_error(_func, _err, _lockres) do { \ - mlog(ML_ERROR, "DLM error %d while calling %s on resource %s\n", \ - _err, _func, (_lockres)->l_name); \ + printk(KERN_ERR "DLM error %d while calling %s on resource %s\n", \ + _err, _func, (_lockres)->l_pretty_name); \ } while (0) static int ocfs2_downconvert_thread(void *arg); @@ -255,6 +244,8 @@ void ocfs2_lock_res_init_common(struct ocfs2_super *osb, res->l_flags = OCFS2_LOCK_INITIALIZED; + lockres_name(res, res->l_pretty_name, OCFS2_LOCK_ID_PRETTY_LEN); + ocfs2_add_lockres_tracking(res, osb->osb_dlm_debug); ocfs2_init_lock_stats(res); diff --git a/kmod/src/dlmglue.h b/kmod/src/dlmglue.h index af138f80..afbe8cfc 100644 --- a/kmod/src/dlmglue.h +++ b/kmod/src/dlmglue.h @@ -31,6 +31,7 @@ /* Max length of lockid name */ #define OCFS2_LOCK_ID_MAX_LEN 32 +#define OCFS2_LOCK_ID_PRETTY_LEN 64 enum ocfs2_ast_action { OCFS2_AST_INVALID = 0, @@ -106,6 +107,7 @@ struct ocfs2_lock_res { u64 l_refresh_gen; unsigned long l_flags; char l_name[OCFS2_LOCK_ID_MAX_LEN]; + char l_pretty_name[OCFS2_LOCK_ID_PRETTY_LEN]; unsigned int l_ro_holders; unsigned int l_cw_holders; unsigned int l_ex_holders;