Skip to contentSkip to conversation

ocfs2/dlm: clean up deadcode in dlm_master_request_handler()

PATCH Applied piaojun 3 participants 3 messages Oct 31, 2016 – Sep 4, 2019 OCFS2

lore
Share & tools
lore

piaojun

author
#0 lore raw

PATCH 1/1 ocfs2/dlm: clean up deadcode in dlm_master_request_handler()

when 'dispatch_assert' is set, 'response' must be DLM_MASTER_RESP_YES, and 'res' won't be null, so execution can't reach these two branch.

---
 fs/ocfs2/dlm/dlmmaster.c | 6 ------
 1 file changed, 6 deletions(-)
fs/ocfs2/dlm/dlmmaster.c +0 -6
index 3f828a1..9a72dd8 100644
@@ -1644,12 +1644,6 @@ int dlm_master_request_handler(struct o2net_msg *msg, u32 len, void *data,
 	 * dlm_assert_master_worker() isn't called, we drop it here.
 	 */
 	if (dispatch_assert) {
-		if (response != DLM_MASTER_RESP_YES)
-			mlog(ML_ERROR, "invalid response %d\n", response);
-		if (!res) {
-			mlog(ML_ERROR, "bad lockres while trying to assert!\n");
-			BUG();
-		}
 		mlog(0, "%u is the owner of %.*s, cleaning everyone else\n",
 			     dlm->node_num, res->lockname.len, res->lockname.name);
 		spin_lock(&res->spinlock);
Signature · 1 line
1.9.5.msysgit.1
#1 lore raw

PATCH 1/1 ocfs2/dlm: clean up deadcode in dlm_master_request_handler()

Quoted 4 lines · piaojun

when 'dispatch_assert' is set, 'response' must be DLM_MASTER_RESP_YES, and 'res' won't be null, so execution can't reach these two branch.

Looks good to me.

Quoted 22 lines
---
 fs/ocfs2/dlm/dlmmaster.c | 6 ------
 1 file changed, 6 deletions(-)
fs/ocfs2/dlm/dlmmaster.c +0 -6
index 3f828a1..9a72dd8 100644
@@ -1644,12 +1644,6 @@ int dlm_master_request_handler(struct o2net_msg *msg, u32 len, void *data,
 	 * dlm_assert_master_worker() isn't called, we drop it here.
 	 */
 	if (dispatch_assert) {
-		if (response != DLM_MASTER_RESP_YES)
-			mlog(ML_ERROR, "invalid response %d\n", response);
-		if (!res) {
-			mlog(ML_ERROR, "bad lockres while trying to assert!\n");
-			BUG();
-		}
 		mlog(0, "%u is the owner of %.*s, cleaning everyone else\n",
 			     dlm->node_num, res->lockname.len, res->lockname.name);
 		spin_lock(&res->spinlock);
#2 lore raw

PATCH 1/1 ocfs2/dlm: clean up deadcode in dlm_master_request_handler()

In reply to piaojun
Quoted 10 lines · On Mon, 31 Oct 2016 21:52:17 +0800 piaojun <[email protected]> wrote:

when 'dispatch_assert' is set, 'response' must be DLM_MASTER_RESP_YES, and 'res' won't be null, so execution can't reach these two branch.

...

fs/ocfs2/dlm/dlmmaster.c +0 -0
@@ -1644,12 +1644,6 @@ int dlm_master_request_handler(struct o2net_msg *msg, u32 len, void *data,
 	 * dlm_assert_master_worker() isn't called, we drop it here.
 	 */

fs/ocfs2/dlm/dlmmaster.c int dlm_master_request_handler(struct o2net_msg *msg, u32 len, void *data, · line 1649

Quoted 10 lines
fs/ocfs2/dlm/dlmmaster.c +0 -6
 	if (dispatch_assert) {
-		if (response != DLM_MASTER_RESP_YES)
-			mlog(ML_ERROR, "invalid response %d\n", response);
-		if (!res) {
-			mlog(ML_ERROR, "bad lockres while trying to assert!\n");
-			BUG();
-		}
 		mlog(0, "%u is the owner of %.*s, cleaning everyone else\n",
 			     dlm->node_num, res->lockname.len, res->lockname.name);
 		spin_lock(&res->spinlock);

This code is quite different in Linus's current tree.