Commit 57dff267 authored by Sunil Mushran's avatar Sunil Mushran Committed by Mark Fasheh

ocfs2/dlm: Clean up errors in dlm_proxy_ast_handler()

Patch cleans printed errors in dlm_proxy_ast_handler(). The errors now includes
the node number that sent the (b)ast. Also it reduces the number of endian swaps
of the cookie.
Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
parent 2b832564
...@@ -275,6 +275,7 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data, ...@@ -275,6 +275,7 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
struct list_head *iter, *head=NULL; struct list_head *iter, *head=NULL;
u64 cookie; u64 cookie;
u32 flags; u32 flags;
u8 node;
if (!dlm_grab(dlm)) { if (!dlm_grab(dlm)) {
dlm_error(DLM_REJECTED); dlm_error(DLM_REJECTED);
...@@ -286,18 +287,21 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data, ...@@ -286,18 +287,21 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
name = past->name; name = past->name;
locklen = past->namelen; locklen = past->namelen;
cookie = be64_to_cpu(past->cookie); cookie = past->cookie;
flags = be32_to_cpu(past->flags); flags = be32_to_cpu(past->flags);
node = past->node_idx;
if (locklen > DLM_LOCKID_NAME_MAX) { if (locklen > DLM_LOCKID_NAME_MAX) {
ret = DLM_IVBUFLEN; ret = DLM_IVBUFLEN;
mlog(ML_ERROR, "Invalid name length in proxy ast handler!\n"); mlog(ML_ERROR, "Invalid name length (%d) in proxy ast "
"handler!\n", locklen);
goto leave; goto leave;
} }
if ((flags & (LKM_PUT_LVB|LKM_GET_LVB)) == if ((flags & (LKM_PUT_LVB|LKM_GET_LVB)) ==
(LKM_PUT_LVB|LKM_GET_LVB)) { (LKM_PUT_LVB|LKM_GET_LVB)) {
mlog(ML_ERROR, "both PUT and GET lvb specified\n"); mlog(ML_ERROR, "Both PUT and GET lvb specified, (0x%x)\n",
flags);
ret = DLM_BADARGS; ret = DLM_BADARGS;
goto leave; goto leave;
} }
...@@ -310,22 +314,21 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data, ...@@ -310,22 +314,21 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
if (past->type != DLM_AST && if (past->type != DLM_AST &&
past->type != DLM_BAST) { past->type != DLM_BAST) {
mlog(ML_ERROR, "Unknown ast type! %d, cookie=%u:%llu" mlog(ML_ERROR, "Unknown ast type! %d, cookie=%u:%llu"
"name=%.*s\n", past->type, "name=%.*s, node=%u\n", past->type,
dlm_get_lock_cookie_node(cookie), dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
dlm_get_lock_cookie_seq(cookie), dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
locklen, name); locklen, name, node);
ret = DLM_IVLOCKID; ret = DLM_IVLOCKID;
goto leave; goto leave;
} }
res = dlm_lookup_lockres(dlm, name, locklen); res = dlm_lookup_lockres(dlm, name, locklen);
if (!res) { if (!res) {
mlog(0, "got %sast for unknown lockres! " mlog(0, "Got %sast for unknown lockres! cookie=%u:%llu, "
"cookie=%u:%llu, name=%.*s, namelen=%u\n", "name=%.*s, node=%u\n", (past->type == DLM_AST ? "" : "b"),
past->type == DLM_AST ? "" : "b", dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
dlm_get_lock_cookie_node(cookie), dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
dlm_get_lock_cookie_seq(cookie), locklen, name, node);
locklen, name, locklen);
ret = DLM_IVLOCKID; ret = DLM_IVLOCKID;
goto leave; goto leave;
} }
...@@ -337,12 +340,12 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data, ...@@ -337,12 +340,12 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
spin_lock(&res->spinlock); spin_lock(&res->spinlock);
if (res->state & DLM_LOCK_RES_RECOVERING) { if (res->state & DLM_LOCK_RES_RECOVERING) {
mlog(0, "responding with DLM_RECOVERING!\n"); mlog(0, "Responding with DLM_RECOVERING!\n");
ret = DLM_RECOVERING; ret = DLM_RECOVERING;
goto unlock_out; goto unlock_out;
} }
if (res->state & DLM_LOCK_RES_MIGRATING) { if (res->state & DLM_LOCK_RES_MIGRATING) {
mlog(0, "responding with DLM_MIGRATING!\n"); mlog(0, "Responding with DLM_MIGRATING!\n");
ret = DLM_MIGRATING; ret = DLM_MIGRATING;
goto unlock_out; goto unlock_out;
} }
...@@ -351,7 +354,7 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data, ...@@ -351,7 +354,7 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
lock = NULL; lock = NULL;
list_for_each(iter, head) { list_for_each(iter, head) {
lock = list_entry (iter, struct dlm_lock, list); lock = list_entry (iter, struct dlm_lock, list);
if (be64_to_cpu(lock->ml.cookie) == cookie) if (lock->ml.cookie == cookie)
goto do_ast; goto do_ast;
} }
...@@ -363,15 +366,15 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data, ...@@ -363,15 +366,15 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
list_for_each(iter, head) { list_for_each(iter, head) {
lock = list_entry (iter, struct dlm_lock, list); lock = list_entry (iter, struct dlm_lock, list);
if (be64_to_cpu(lock->ml.cookie) == cookie) if (lock->ml.cookie == cookie)
goto do_ast; goto do_ast;
} }
mlog(0, "got %sast for unknown lock! cookie=%u:%llu, " mlog(0, "Got %sast for unknown lock! cookie=%u:%llu, name=%.*s, "
"name=%.*s, namelen=%u\n", past->type == DLM_AST ? "" : "b", "node=%u\n", past->type == DLM_AST ? "" : "b",
dlm_get_lock_cookie_node(cookie), dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
dlm_get_lock_cookie_seq(cookie), dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
locklen, name, locklen); locklen, name, node);
ret = DLM_NORMAL; ret = DLM_NORMAL;
unlock_out: unlock_out:
...@@ -383,8 +386,8 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data, ...@@ -383,8 +386,8 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
if (past->type == DLM_AST) { if (past->type == DLM_AST) {
/* do not alter lock refcount. switching lists. */ /* do not alter lock refcount. switching lists. */
list_move_tail(&lock->list, &res->granted); list_move_tail(&lock->list, &res->granted);
mlog(0, "ast: adding to granted list... type=%d, " mlog(0, "ast: Adding to granted list... type=%d, "
"convert_type=%d\n", lock->ml.type, lock->ml.convert_type); "convert_type=%d\n", lock->ml.type, lock->ml.convert_type);
if (lock->ml.convert_type != LKM_IVMODE) { if (lock->ml.convert_type != LKM_IVMODE) {
lock->ml.type = lock->ml.convert_type; lock->ml.type = lock->ml.convert_type;
lock->ml.convert_type = LKM_IVMODE; lock->ml.convert_type = LKM_IVMODE;
...@@ -408,7 +411,6 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data, ...@@ -408,7 +411,6 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
dlm_do_local_bast(dlm, res, lock, past->blocked_type); dlm_do_local_bast(dlm, res, lock, past->blocked_type);
leave: leave:
if (res) if (res)
dlm_lockres_put(res); dlm_lockres_put(res);
......
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