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 <mfasheh@versity.com>
This commit is contained in:
Mark Fasheh
2017-12-11 16:51:33 -06:00
committed by Zach Brown
parent 3e18cbdb10
commit ee96b650f0
2 changed files with 6 additions and 13 deletions

View File

@@ -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);

View File

@@ -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;