Commit 6fcef3f0 authored by Sunil Mushran's avatar Sunil Mushran Committed by Joel Becker

ocfs2/userdlm: Add tracing in userdlm

Make use of the newly added BASTS masklog to trace ASTs and BASTs in userdlm.
Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
parent 9b915181
...@@ -128,8 +128,9 @@ static void user_ast(struct ocfs2_dlm_lksb *lksb) ...@@ -128,8 +128,9 @@ static void user_ast(struct ocfs2_dlm_lksb *lksb)
struct user_lock_res *lockres = user_lksb_to_lock_res(lksb); struct user_lock_res *lockres = user_lksb_to_lock_res(lksb);
int status; int status;
mlog(0, "AST fired for lockres %.*s\n", lockres->l_namelen, mlog(ML_BASTS, "AST fired for lockres %.*s, level %d => %d\n",
lockres->l_name); lockres->l_namelen, lockres->l_name, lockres->l_level,
lockres->l_requested);
spin_lock(&lockres->l_lock); spin_lock(&lockres->l_lock);
...@@ -214,8 +215,8 @@ static void user_bast(struct ocfs2_dlm_lksb *lksb, int level) ...@@ -214,8 +215,8 @@ static void user_bast(struct ocfs2_dlm_lksb *lksb, int level)
{ {
struct user_lock_res *lockres = user_lksb_to_lock_res(lksb); struct user_lock_res *lockres = user_lksb_to_lock_res(lksb);
mlog(0, "Blocking AST fired for lockres %.*s. Blocking level %d\n", mlog(ML_BASTS, "BAST fired for lockres %.*s, blocking %d, level %d\n",
lockres->l_namelen, lockres->l_name, level); lockres->l_namelen, lockres->l_name, level, lockres->l_level);
spin_lock(&lockres->l_lock); spin_lock(&lockres->l_lock);
lockres->l_flags |= USER_LOCK_BLOCKED; lockres->l_flags |= USER_LOCK_BLOCKED;
...@@ -232,8 +233,8 @@ static void user_unlock_ast(struct ocfs2_dlm_lksb *lksb, int status) ...@@ -232,8 +233,8 @@ static void user_unlock_ast(struct ocfs2_dlm_lksb *lksb, int status)
{ {
struct user_lock_res *lockres = user_lksb_to_lock_res(lksb); struct user_lock_res *lockres = user_lksb_to_lock_res(lksb);
mlog(0, "UNLOCK AST called on lock %.*s\n", lockres->l_namelen, mlog(ML_BASTS, "UNLOCK AST fired for lockres %.*s, flags 0x%x\n",
lockres->l_name); lockres->l_namelen, lockres->l_name, lockres->l_flags);
if (status) if (status)
mlog(ML_ERROR, "dlm returns status %d\n", status); mlog(ML_ERROR, "dlm returns status %d\n", status);
...@@ -302,8 +303,7 @@ static void user_dlm_unblock_lock(struct work_struct *work) ...@@ -302,8 +303,7 @@ static void user_dlm_unblock_lock(struct work_struct *work)
struct ocfs2_cluster_connection *conn = struct ocfs2_cluster_connection *conn =
cluster_connection_from_user_lockres(lockres); cluster_connection_from_user_lockres(lockres);
mlog(0, "processing lockres %.*s\n", lockres->l_namelen, mlog(0, "lockres %.*s\n", lockres->l_namelen, lockres->l_name);
lockres->l_name);
spin_lock(&lockres->l_lock); spin_lock(&lockres->l_lock);
...@@ -321,17 +321,23 @@ static void user_dlm_unblock_lock(struct work_struct *work) ...@@ -321,17 +321,23 @@ static void user_dlm_unblock_lock(struct work_struct *work)
* flag, and finally we might get another bast which re-queues * flag, and finally we might get another bast which re-queues
* us before our ast for the downconvert is called. */ * us before our ast for the downconvert is called. */
if (!(lockres->l_flags & USER_LOCK_BLOCKED)) { if (!(lockres->l_flags & USER_LOCK_BLOCKED)) {
mlog(ML_BASTS, "lockres %.*s USER_LOCK_BLOCKED\n",
lockres->l_namelen, lockres->l_name);
spin_unlock(&lockres->l_lock); spin_unlock(&lockres->l_lock);
goto drop_ref; goto drop_ref;
} }
if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) { if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) {
mlog(ML_BASTS, "lockres %.*s USER_LOCK_IN_TEARDOWN\n",
lockres->l_namelen, lockres->l_name);
spin_unlock(&lockres->l_lock); spin_unlock(&lockres->l_lock);
goto drop_ref; goto drop_ref;
} }
if (lockres->l_flags & USER_LOCK_BUSY) { if (lockres->l_flags & USER_LOCK_BUSY) {
if (lockres->l_flags & USER_LOCK_IN_CANCEL) { if (lockres->l_flags & USER_LOCK_IN_CANCEL) {
mlog(ML_BASTS, "lockres %.*s USER_LOCK_IN_CANCEL\n",
lockres->l_namelen, lockres->l_name);
spin_unlock(&lockres->l_lock); spin_unlock(&lockres->l_lock);
goto drop_ref; goto drop_ref;
} }
...@@ -352,15 +358,17 @@ static void user_dlm_unblock_lock(struct work_struct *work) ...@@ -352,15 +358,17 @@ static void user_dlm_unblock_lock(struct work_struct *work)
if ((lockres->l_blocking == DLM_LOCK_EX) if ((lockres->l_blocking == DLM_LOCK_EX)
&& (lockres->l_ex_holders || lockres->l_ro_holders)) { && (lockres->l_ex_holders || lockres->l_ro_holders)) {
spin_unlock(&lockres->l_lock); spin_unlock(&lockres->l_lock);
mlog(0, "can't downconvert for ex: ro = %u, ex = %u\n", mlog(ML_BASTS, "lockres %.*s, EX/PR Holders %u,%u\n",
lockres->l_ro_holders, lockres->l_ex_holders); lockres->l_namelen, lockres->l_name,
lockres->l_ex_holders, lockres->l_ro_holders);
goto drop_ref; goto drop_ref;
} }
if ((lockres->l_blocking == DLM_LOCK_PR) if ((lockres->l_blocking == DLM_LOCK_PR)
&& lockres->l_ex_holders) { && lockres->l_ex_holders) {
spin_unlock(&lockres->l_lock); spin_unlock(&lockres->l_lock);
mlog(0, "can't downconvert for pr: ex = %u\n", mlog(ML_BASTS, "lockres %.*s, EX Holders %u\n",
lockres->l_namelen, lockres->l_name,
lockres->l_ex_holders); lockres->l_ex_holders);
goto drop_ref; goto drop_ref;
} }
...@@ -369,8 +377,8 @@ static void user_dlm_unblock_lock(struct work_struct *work) ...@@ -369,8 +377,8 @@ static void user_dlm_unblock_lock(struct work_struct *work)
new_level = user_highest_compat_lock_level(lockres->l_blocking); new_level = user_highest_compat_lock_level(lockres->l_blocking);
lockres->l_requested = new_level; lockres->l_requested = new_level;
lockres->l_flags |= USER_LOCK_BUSY; lockres->l_flags |= USER_LOCK_BUSY;
mlog(0, "Downconvert lock from %d to %d\n", mlog(ML_BASTS, "lockres %.*s, downconvert %d => %d\n",
lockres->l_level, new_level); lockres->l_namelen, lockres->l_name, lockres->l_level, new_level);
spin_unlock(&lockres->l_lock); spin_unlock(&lockres->l_lock);
/* need lock downconvert request now... */ /* need lock downconvert request now... */
...@@ -430,10 +438,8 @@ int user_dlm_cluster_lock(struct user_lock_res *lockres, ...@@ -430,10 +438,8 @@ int user_dlm_cluster_lock(struct user_lock_res *lockres,
goto bail; goto bail;
} }
mlog(0, "lockres %.*s: asking for %s lock, passed flags = 0x%x\n", mlog(ML_BASTS, "lockres %.*s, level %d, flags = 0x%x\n",
lockres->l_namelen, lockres->l_name, lockres->l_namelen, lockres->l_name, level, lkm_flags);
(level == DLM_LOCK_EX) ? "DLM_LOCK_EX" : "DLM_LOCK_PR",
lkm_flags);
again: again:
if (signal_pending(current)) { if (signal_pending(current)) {
...@@ -603,7 +609,7 @@ int user_dlm_destroy_lock(struct user_lock_res *lockres) ...@@ -603,7 +609,7 @@ int user_dlm_destroy_lock(struct user_lock_res *lockres)
struct ocfs2_cluster_connection *conn = struct ocfs2_cluster_connection *conn =
cluster_connection_from_user_lockres(lockres); cluster_connection_from_user_lockres(lockres);
mlog(0, "asked to destroy %.*s\n", lockres->l_namelen, lockres->l_name); mlog(ML_BASTS, "lockres %.*s\n", lockres->l_namelen, lockres->l_name);
spin_lock(&lockres->l_lock); spin_lock(&lockres->l_lock);
if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) { if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment