Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74aa2585 authored by Kurt Hackel's avatar Kurt Hackel Committed by Mark Fasheh
Browse files

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: default avatarKurt Hackel <kurt.hackel@oracle.com>
Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent 90aaaf1c
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -311,8 +311,8 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data)
	    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\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);
		ret = DLM_IVLOCKID;
		ret = DLM_IVLOCKID;
		goto leave;
		goto leave;
@@ -323,8 +323,8 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data)
		mlog(0, "got %sast for unknown lockres! "
		mlog(0, "got %sast for unknown lockres! "
		     "cookie=%u:%llu, name=%.*s, namelen=%u\n",
		     "cookie=%u:%llu, name=%.*s, namelen=%u\n",
		     past->type == DLM_AST ? "" : "b",
		     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, locklen);
		ret = DLM_IVLOCKID;
		ret = DLM_IVLOCKID;
		goto leave;
		goto leave;
@@ -369,7 +369,8 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data)


	mlog(0, "got %sast for unknown lock!  cookie=%u:%llu, "
	mlog(0, "got %sast for unknown lock!  cookie=%u:%llu, "
	     "name=%.*s, namelen=%u\n", past->type == DLM_AST ? "" : "b", 
	     "name=%.*s, namelen=%u\n", past->type == DLM_AST ? "" : "b", 
	     dlm_get_lock_cookie_node(cookie), dlm_get_lock_cookie_seq(cookie),
	     dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
	     dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
	     locklen, name, locklen);
	     locklen, name, locklen);


	ret = DLM_NORMAL;
	ret = DLM_NORMAL;
+4 −4
Original line number Original line Diff line number Diff line
@@ -286,8 +286,8 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
		__dlm_print_one_lock_resource(res);
		__dlm_print_one_lock_resource(res);
		mlog(ML_ERROR, "converting a remote lock that is already "
		mlog(ML_ERROR, "converting a remote lock that is already "
		     "converting! (cookie=%u:%llu, conv=%d)\n",
		     "converting! (cookie=%u:%llu, conv=%d)\n",
		     dlm_get_lock_cookie_node(lock->ml.cookie),
		     dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
		     dlm_get_lock_cookie_seq(lock->ml.cookie),
		     dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
		     lock->ml.convert_type);
		     lock->ml.convert_type);
		status = DLM_DENIED;
		status = DLM_DENIED;
		goto bail;
		goto bail;
@@ -484,8 +484,8 @@ int dlm_convert_lock_handler(struct o2net_msg *msg, u32 len, void *data)
		status = DLM_IVLOCKID;
		status = DLM_IVLOCKID;
		mlog(ML_ERROR, "did not find lock to convert on grant queue! "
		mlog(ML_ERROR, "did not find lock to convert on grant queue! "
			       "cookie=%u:%llu\n",
			       "cookie=%u:%llu\n",
			       dlm_get_lock_cookie_node(cnv->cookie),
		     dlm_get_lock_cookie_node(be64_to_cpu(cnv->cookie)),
			       dlm_get_lock_cookie_seq(cnv->cookie));
		     dlm_get_lock_cookie_seq(be64_to_cpu(cnv->cookie)));
		__dlm_print_one_lock_resource(res);
		__dlm_print_one_lock_resource(res);
		goto leave;
		goto leave;
	}
	}
+6 −6
Original line number Original line Diff line number Diff line
@@ -90,8 +90,8 @@ void __dlm_print_one_lock_resource(struct dlm_lock_resource *res)
		mlog(ML_NOTICE, "    type=%d, conv=%d, node=%u, "
		mlog(ML_NOTICE, "    type=%d, conv=%d, node=%u, "
		       "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n", 
		       "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n", 
		       lock->ml.type, lock->ml.convert_type, lock->ml.node, 
		       lock->ml.type, lock->ml.convert_type, lock->ml.node, 
		       dlm_get_lock_cookie_node(lock->ml.cookie), 
		     dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
		       dlm_get_lock_cookie_seq(lock->ml.cookie), 
		     dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
		       list_empty(&lock->ast_list) ? 'y' : 'n',
		       list_empty(&lock->ast_list) ? 'y' : 'n',
		       lock->ast_pending ? 'y' : 'n',
		       lock->ast_pending ? 'y' : 'n',
		       list_empty(&lock->bast_list) ? 'y' : 'n',
		       list_empty(&lock->bast_list) ? 'y' : 'n',
@@ -105,8 +105,8 @@ void __dlm_print_one_lock_resource(struct dlm_lock_resource *res)
		mlog(ML_NOTICE, "    type=%d, conv=%d, node=%u, "
		mlog(ML_NOTICE, "    type=%d, conv=%d, node=%u, "
		       "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n", 
		       "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n", 
		       lock->ml.type, lock->ml.convert_type, lock->ml.node, 
		       lock->ml.type, lock->ml.convert_type, lock->ml.node, 
		       dlm_get_lock_cookie_node(lock->ml.cookie), 
		     dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
		       dlm_get_lock_cookie_seq(lock->ml.cookie), 
		     dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
		       list_empty(&lock->ast_list) ? 'y' : 'n',
		       list_empty(&lock->ast_list) ? 'y' : 'n',
		       lock->ast_pending ? 'y' : 'n',
		       lock->ast_pending ? 'y' : 'n',
		       list_empty(&lock->bast_list) ? 'y' : 'n',
		       list_empty(&lock->bast_list) ? 'y' : 'n',
@@ -120,8 +120,8 @@ void __dlm_print_one_lock_resource(struct dlm_lock_resource *res)
		mlog(ML_NOTICE, "    type=%d, conv=%d, node=%u, "
		mlog(ML_NOTICE, "    type=%d, conv=%d, node=%u, "
		       "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n", 
		       "cookie=%u:%llu, ast=(empty=%c,pend=%c), bast=(empty=%c,pend=%c)\n", 
		       lock->ml.type, lock->ml.convert_type, lock->ml.node, 
		       lock->ml.type, lock->ml.convert_type, lock->ml.node, 
		       dlm_get_lock_cookie_node(lock->ml.cookie), 
		     dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
		       dlm_get_lock_cookie_seq(lock->ml.cookie), 
		     dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
		       list_empty(&lock->ast_list) ? 'y' : 'n',
		       list_empty(&lock->ast_list) ? 'y' : 'n',
		       lock->ast_pending ? 'y' : 'n',
		       lock->ast_pending ? 'y' : 'n',
		       list_empty(&lock->bast_list) ? 'y' : 'n',
		       list_empty(&lock->bast_list) ? 'y' : 'n',
+6 −6
Original line number Original line Diff line number Diff line
@@ -1766,8 +1766,8 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
				u64 c = ml->cookie;
				u64 c = ml->cookie;
				mlog(ML_ERROR, "could not find local lock "
				mlog(ML_ERROR, "could not find local lock "
					       "with cookie %u:%llu!\n",
					       "with cookie %u:%llu!\n",
					       dlm_get_lock_cookie_node(c),
				     dlm_get_lock_cookie_node(be64_to_cpu(c)),
					       dlm_get_lock_cookie_seq(c));
				     dlm_get_lock_cookie_seq(be64_to_cpu(c)));
				__dlm_print_one_lock_resource(res);
				__dlm_print_one_lock_resource(res);
				BUG();
				BUG();
			}
			}
@@ -1876,14 +1876,14 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
				mlog(ML_ERROR, "%s:%.*s: %u:%llu: lock already "
				mlog(ML_ERROR, "%s:%.*s: %u:%llu: lock already "
				     "exists on this lockres!\n", dlm->name,
				     "exists on this lockres!\n", dlm->name,
				     res->lockname.len, res->lockname.name,
				     res->lockname.len, res->lockname.name,
				     dlm_get_lock_cookie_node(c),
				     dlm_get_lock_cookie_node(be64_to_cpu(c)),
				     dlm_get_lock_cookie_seq(c));
				     dlm_get_lock_cookie_seq(be64_to_cpu(c)));


				mlog(ML_NOTICE, "sent lock: type=%d, conv=%d, "
				mlog(ML_NOTICE, "sent lock: type=%d, conv=%d, "
				     "node=%u, cookie=%u:%llu, queue=%d\n",
				     "node=%u, cookie=%u:%llu, queue=%d\n",
	      			     ml->type, ml->convert_type, ml->node,
	      			     ml->type, ml->convert_type, ml->node,
				     dlm_get_lock_cookie_node(ml->cookie),
				     dlm_get_lock_cookie_node(be64_to_cpu(ml->cookie)),
				     dlm_get_lock_cookie_seq(ml->cookie),
				     dlm_get_lock_cookie_seq(be64_to_cpu(ml->cookie)),
				     ml->list);
				     ml->list);


				__dlm_print_one_lock_resource(res);
				__dlm_print_one_lock_resource(res);
+4 −4
Original line number Original line Diff line number Diff line
@@ -248,8 +248,8 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm,
		/* this should always be coupled with list removal */
		/* this should always be coupled with list removal */
		BUG_ON(!(actions & DLM_UNLOCK_REMOVE_LOCK));
		BUG_ON(!(actions & DLM_UNLOCK_REMOVE_LOCK));
		mlog(0, "lock %u:%llu should be gone now! refs=%d\n",
		mlog(0, "lock %u:%llu should be gone now! refs=%d\n",
		     dlm_get_lock_cookie_node(lock->ml.cookie),
		     dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
		     dlm_get_lock_cookie_seq(lock->ml.cookie),
		     dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
		     atomic_read(&lock->lock_refs.refcount)-1);
		     atomic_read(&lock->lock_refs.refcount)-1);
		dlm_lock_put(lock);
		dlm_lock_put(lock);
	}
	}
@@ -506,8 +506,8 @@ int dlm_unlock_lock_handler(struct o2net_msg *msg, u32 len, void *data)
	if (!found)
	if (!found)
		mlog(ML_ERROR, "failed to find lock to unlock! "
		mlog(ML_ERROR, "failed to find lock to unlock! "
			       "cookie=%u:%llu\n",
			       "cookie=%u:%llu\n",
			       dlm_get_lock_cookie_node(unlock->cookie),
		     dlm_get_lock_cookie_node(be64_to_cpu(unlock->cookie)),
			       dlm_get_lock_cookie_seq(unlock->cookie));
		     dlm_get_lock_cookie_seq(be64_to_cpu(unlock->cookie)));
	else
	else
		dlm_lock_put(lock);
		dlm_lock_put(lock);