aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt Hackel <kurt.hackel@oracle.com>2007-01-17 18:11:36 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2007-02-07 15:06:24 -0500
commit74aa25856c693d20a886cdb31a004aaca411d135 (patch)
treeea833f164771279a3141668e537e316c21027387
parent90aaaf1c235a70daee04e897e9501415b766de69 (diff)
ocfs2_dlm: Cookies in locks not being printed correctly in error messages
The dlm encodes the node number and a sequence number in the lock cookie. It also stores the cookie in the lockres in the big endian format to avoid swapping 8 bytes on each lock request. The bug here was that it was assuming the cookie to be in the cpu format when decoding it for printing the error message. This patch swaps the bytes before the print. Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
-rw-r--r--fs/ocfs2/dlm/dlmast.c11
-rw-r--r--fs/ocfs2/dlm/dlmconvert.c8
-rw-r--r--fs/ocfs2/dlm/dlmdebug.c12
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c12
-rw-r--r--fs/ocfs2/dlm/dlmunlock.c8
5 files changed, 26 insertions, 25 deletions
diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c
index 681046d51393..ad5e7e1fa1ff 100644
--- a/fs/ocfs2/dlm/dlmast.c
+++ b/fs/ocfs2/dlm/dlmast.c
@@ -311,8 +311,8 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data)
311 past->type != DLM_BAST) { 311 past->type != DLM_BAST) {
312 mlog(ML_ERROR, "Unknown ast type! %d, cookie=%u:%llu" 312 mlog(ML_ERROR, "Unknown ast type! %d, cookie=%u:%llu"
313 "name=%.*s\n", past->type, 313 "name=%.*s\n", past->type,
314 dlm_get_lock_cookie_node(cookie), 314 dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
315 dlm_get_lock_cookie_seq(cookie), 315 dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
316 locklen, name); 316 locklen, name);
317 ret = DLM_IVLOCKID; 317 ret = DLM_IVLOCKID;
318 goto leave; 318 goto leave;
@@ -323,8 +323,8 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data)
323 mlog(0, "got %sast for unknown lockres! " 323 mlog(0, "got %sast for unknown lockres! "
324 "cookie=%u:%llu, name=%.*s, namelen=%u\n", 324 "cookie=%u:%llu, name=%.*s, namelen=%u\n",
325 past->type == DLM_AST ? "" : "b", 325 past->type == DLM_AST ? "" : "b",
326 dlm_get_lock_cookie_node(cookie), 326 dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
327 dlm_get_lock_cookie_seq(cookie), 327 dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
328 locklen, name, locklen); 328 locklen, name, locklen);
329 ret = DLM_IVLOCKID; 329 ret = DLM_IVLOCKID;
330 goto leave; 330 goto leave;
@@ -369,7 +369,8 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data)
369 369
370 mlog(0, "got %sast for unknown lock! cookie=%u:%llu, " 370 mlog(0, "got %sast for unknown lock! cookie=%u:%llu, "
371 "name=%.*s, namelen=%u\n", past->type == DLM_AST ? "" : "b", 371 "name=%.*s, namelen=%u\n", past->type == DLM_AST ? "" : "b",
372 dlm_get_lock_cookie_node(cookie), dlm_get_lock_cookie_seq(cookie), 372 dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
373 dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
373 locklen, name, locklen); 374 locklen, name, locklen);
374 375
375 ret = DLM_NORMAL; 376 ret = DLM_NORMAL;
diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c
index 370f23c385f1..59fb63da8b65 100644
--- a/fs/ocfs2/dlm/dlmconvert.c
+++ b/fs/ocfs2/dlm/dlmconvert.c
@@ -286,8 +286,8 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
286 __dlm_print_one_lock_resource(res); 286 __dlm_print_one_lock_resource(res);
287 mlog(ML_ERROR, "converting a remote lock that is already " 287 mlog(ML_ERROR, "converting a remote lock that is already "
288 "converting! (cookie=%u:%llu, conv=%d)\n", 288 "converting! (cookie=%u:%llu, conv=%d)\n",
289 dlm_get_lock_cookie_node(lock->ml.cookie), 289 dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
290 dlm_get_lock_cookie_seq(lock->ml.cookie), 290 dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
291 lock->ml.convert_type); 291 lock->ml.convert_type);
292 status = DLM_DENIED; 292 status = DLM_DENIED;
293 goto bail; 293 goto bail;
@@ -484,8 +484,8 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data)
484 status = DLM_IVLOCKID; 484 status = DLM_IVLOCKID;
485 mlog(ML_ERROR, "did not find lock to convert on grant queue! " 485 mlog(ML_ERROR, "did not find lock to convert on grant queue! "
486 "cookie=%u:%llu\n", 486 "cookie=%u:%llu\n",
487 dlm_get_lock_cookie_node(cnv->cookie), 487 dlm_get_lock_cookie_node(be64_to_cpu(cnv->cookie)),
488 dlm_get_lock_cookie_seq(cnv->cookie)); 488 dlm_get_lock_cookie_seq(be64_to_cpu(cnv->cookie)));
489 __dlm_print_one_lock_resource(res); 489 __dlm_print_one_lock_resource(res);
490 goto leave; 490 goto leave;
491 } 491 }
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
index 1015cc7bf9cb..64239b37e5d4 100644
--- a/fs/ocfs2/dlm/dlmdebug.c
+++ b/fs/ocfs2/dlm/dlmdebug.c
@@ -90,8 +90,8 @@ void __dlm_print_one_lock_resource(struct dlm_lock_resource *res)
90 mlog(ML_NOTICE, " type=%d, conv=%d, node=%u, " 90 mlog(ML_NOTICE, " type=%d, conv=%d, node=%u, "
91 "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n", 91 "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n",
92 lock->ml.type, lock->ml.convert_type, lock->ml.node, 92 lock->ml.type, lock->ml.convert_type, lock->ml.node,
93 dlm_get_lock_cookie_node(lock->ml.cookie), 93 dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
94 dlm_get_lock_cookie_seq(lock->ml.cookie), 94 dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
95 list_empty(&lock->ast_list) ? 'y' : 'n', 95 list_empty(&lock->ast_list) ? 'y' : 'n',
96 lock->ast_pending ? 'y' : 'n', 96 lock->ast_pending ? 'y' : 'n',
97 list_empty(&lock->bast_list) ? 'y' : 'n', 97 list_empty(&lock->bast_list) ? 'y' : 'n',
@@ -105,8 +105,8 @@ void __dlm_print_one_lock_resource(struct dlm_lock_resource *res)
105 mlog(ML_NOTICE, " type=%d, conv=%d, node=%u, " 105 mlog(ML_NOTICE, " type=%d, conv=%d, node=%u, "
106 "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n", 106 "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n",
107 lock->ml.type, lock->ml.convert_type, lock->ml.node, 107 lock->ml.type, lock->ml.convert_type, lock->ml.node,
108 dlm_get_lock_cookie_node(lock->ml.cookie), 108 dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
109 dlm_get_lock_cookie_seq(lock->ml.cookie), 109 dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
110 list_empty(&lock->ast_list) ? 'y' : 'n', 110 list_empty(&lock->ast_list) ? 'y' : 'n',
111 lock->ast_pending ? 'y' : 'n', 111 lock->ast_pending ? 'y' : 'n',
112 list_empty(&lock->bast_list) ? 'y' : 'n', 112 list_empty(&lock->bast_list) ? 'y' : 'n',
@@ -120,8 +120,8 @@ void __dlm_print_one_lock_resource(struct dlm_lock_resource *res)
120 mlog(ML_NOTICE, " type=%d, conv=%d, node=%u, " 120 mlog(ML_NOTICE, " type=%d, conv=%d, node=%u, "
121 "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n", 121 "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n",
122 lock->ml.type, lock->ml.convert_type, lock->ml.node, 122 lock->ml.type, lock->ml.convert_type, lock->ml.node,
123 dlm_get_lock_cookie_node(lock->ml.cookie), 123 dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
124 dlm_get_lock_cookie_seq(lock->ml.cookie), 124 dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
125 list_empty(&lock->ast_list) ? 'y' : 'n', 125 list_empty(&lock->ast_list) ? 'y' : 'n',
126 lock->ast_pending ? 'y' : 'n', 126 lock->ast_pending ? 'y' : 'n',
127 list_empty(&lock->bast_list) ? 'y' : 'n', 127 list_empty(&lock->bast_list) ? 'y' : 'n',
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index e57636c399f4..38d714645309 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1766,8 +1766,8 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
1766 u64 c = ml->cookie; 1766 u64 c = ml->cookie;
1767 mlog(ML_ERROR, "could not find local lock " 1767 mlog(ML_ERROR, "could not find local lock "
1768 "with cookie %u:%llu!\n", 1768 "with cookie %u:%llu!\n",
1769 dlm_get_lock_cookie_node(c), 1769 dlm_get_lock_cookie_node(be64_to_cpu(c)),
1770 dlm_get_lock_cookie_seq(c)); 1770 dlm_get_lock_cookie_seq(be64_to_cpu(c)));
1771 __dlm_print_one_lock_resource(res); 1771 __dlm_print_one_lock_resource(res);
1772 BUG(); 1772 BUG();
1773 } 1773 }
@@ -1876,14 +1876,14 @@ skip_lvb:
1876 mlog(ML_ERROR, "%s:%.*s: %u:%llu: lock already " 1876 mlog(ML_ERROR, "%s:%.*s: %u:%llu: lock already "
1877 "exists on this lockres!\n", dlm->name, 1877 "exists on this lockres!\n", dlm->name,
1878 res->lockname.len, res->lockname.name, 1878 res->lockname.len, res->lockname.name,
1879 dlm_get_lock_cookie_node(c), 1879 dlm_get_lock_cookie_node(be64_to_cpu(c)),
1880 dlm_get_lock_cookie_seq(c)); 1880 dlm_get_lock_cookie_seq(be64_to_cpu(c)));
1881 1881
1882 mlog(ML_NOTICE, "sent lock: type=%d, conv=%d, " 1882 mlog(ML_NOTICE, "sent lock: type=%d, conv=%d, "
1883 "node=%u, cookie=%u:%llu, queue=%d\n", 1883 "node=%u, cookie=%u:%llu, queue=%d\n",
1884 ml->type, ml->convert_type, ml->node, 1884 ml->type, ml->convert_type, ml->node,
1885 dlm_get_lock_cookie_node(ml->cookie), 1885 dlm_get_lock_cookie_node(be64_to_cpu(ml->cookie)),
1886 dlm_get_lock_cookie_seq(ml->cookie), 1886 dlm_get_lock_cookie_seq(be64_to_cpu(ml->cookie)),
1887 ml->list); 1887 ml->list);
1888 1888
1889 __dlm_print_one_lock_resource(res); 1889 __dlm_print_one_lock_resource(res);
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c
index 3c8a250fcfec..fc8baa3e9539 100644
--- a/fs/ocfs2/dlm/dlmunlock.c
+++ b/fs/ocfs2/dlm/dlmunlock.c
@@ -248,8 +248,8 @@ leave:
248 /* this should always be coupled with list removal */ 248 /* this should always be coupled with list removal */
249 BUG_ON(!(actions & DLM_UNLOCK_REMOVE_LOCK)); 249 BUG_ON(!(actions & DLM_UNLOCK_REMOVE_LOCK));
250 mlog(0, "lock %u:%llu should be gone now! refs=%d\n", 250 mlog(0, "lock %u:%llu should be gone now! refs=%d\n",
251 dlm_get_lock_cookie_node(lock->ml.cookie), 251 dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
252 dlm_get_lock_cookie_seq(lock->ml.cookie), 252 dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
253 atomic_read(&lock->lock_refs.refcount)-1); 253 atomic_read(&lock->lock_refs.refcount)-1);
254 dlm_lock_put(lock); 254 dlm_lock_put(lock);
255 } 255 }
@@ -506,8 +506,8 @@ not_found:
506 if (!found) 506 if (!found)
507 mlog(ML_ERROR, "failed to find lock to unlock! " 507 mlog(ML_ERROR, "failed to find lock to unlock! "
508 "cookie=%u:%llu\n", 508 "cookie=%u:%llu\n",
509 dlm_get_lock_cookie_node(unlock->cookie), 509 dlm_get_lock_cookie_node(be64_to_cpu(unlock->cookie)),
510 dlm_get_lock_cookie_seq(unlock->cookie)); 510 dlm_get_lock_cookie_seq(be64_to_cpu(unlock->cookie)));
511 else 511 else
512 dlm_lock_put(lock); 512 dlm_lock_put(lock);
513 513