Skip to contentSkip to conversation

dlm: fix recovery pending middle conversion

PATCH New Alexander Aring 1 participant 7 messages Jan 20 Distributed lock manager (DLM)

lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

PATCH 1/7 dlm: fix recovery pending middle conversion

A workload involving PR <-> CW conversions and triggering recovery can end in a so named "conversion deadlock" situation that is signaled by "dlm: WARN: pending deadlock 1e node 0 2 1bf21" in the kernel log.

Under normal circumstances such conversion deadlocks are solved immediately, in this case recovery created such scenario that was not solved immediately. This scenario that two locks ending up on the convertqueue with the conversion PR -> CW. In normal circumstances one of the conversion will be rejected with -DEADLK as CW cannot be granted when one lock is helding still PR. Usually one of those conversion will immediately rejected and the rejected conversion need to convert to a compatible lock mode. If such situation is created on the convertqueue we don't solve such conversion in the expected way by the user.

The situation is created by recovery when a pending middle conversion will be recovered and signaled by:

receive_rcom_lock_args 2e middle convert gr 3 rq 2 remote 2 1e

In this case recovery will remove waiting for the pending message and force the lock being on the convertqueue without checking if there is another incompatible conversion going on like PR -> CW which was the case as the mentioned above "WARN pending deadlock ..." occurs.

This state is difficult to reproduce as it is requires a pending PR -> CW conversion, however we automated a test scenario that fences randomly on PR -> CW conversion and we was able to hit it.

The proposed change in this patch changes to not "force" putting the pending middle conversion on the convertqueue and just handle it like every other message to resend it later to the new lock master. To using the existing convert functionality we will immediately reject such conversion if a incompatible mode on the convertqueue is detected.

Long run with the automated randomly middle conversion test showed so far we don't run into a "WARN: pending deadlock ..." situation again.

---
 fs/dlm/lock.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
fs/dlm/lock.c +1 -18
index be938fdf17d96..c01a291db401b 100644
@@ -5014,25 +5014,8 @@ void dlm_receive_buffer(const union dlm_packet *p, int nodeid)
 static void recover_convert_waiter(struct dlm_ls *ls, struct dlm_lkb *lkb,
 				   struct dlm_message *ms_local)
 {
-	if (middle_conversion(lkb)) {
-		log_rinfo(ls, "%s %x middle convert in progress", __func__,
-			 lkb->lkb_id);
-
-		/* We sent this lock to the new master. The new master will
-		 * tell us when it's granted.  We no longer need a reply, so
-		 * use a fake reply to put the lkb into the right state.
-		 */
-		hold_lkb(lkb);
-		memset(ms_local, 0, sizeof(struct dlm_message));
-		ms_local->m_type = cpu_to_le32(DLM_MSG_CONVERT_REPLY);
-		ms_local->m_result = cpu_to_le32(to_dlm_errno(-EINPROGRESS));
-		ms_local->m_header.h_nodeid = cpu_to_le32(lkb->lkb_nodeid);
-		_receive_convert_reply(lkb, ms_local, true);
-		unhold_lkb(lkb);
-
-	} else if (lkb->lkb_rqmode >= lkb->lkb_grmode) {
+	if (middle_conversion(lkb) || lkb->lkb_rqmode >= lkb->lkb_grmode)
 		set_bit(DLM_IFL_RESEND_BIT, &lkb->lkb_iflags);
-	}
 
 	/* lkb->lkb_rqmode < lkb->lkb_grmode shouldn't happen since down
 	   conversions are async; there's no reply from the remote master */
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 2/7 dlm: validate length in dlm_search_rsb_tree

From: Ezrak1e <[email protected]>

The len parameter in dlm_dump_rsb_name() is not validated and comes from network messages. When it exceeds DLM_RESNAME_MAXLEN, it can cause out-of-bounds write in dlm_search_rsb_tree().

Add length validation to prevent potential buffer overflow.

---
 fs/dlm/lock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/dlm/lock.c +2 -1
index c01a291db401b..a393ecaf3442a 100644
@@ -626,7 +626,8 @@ int dlm_search_rsb_tree(struct rhashtable *rhash, const void *name, int len,
 			struct dlm_rsb **r_ret)
 {
 	char key[DLM_RESNAME_MAXLEN] = {};
-
+	if (len > DLM_RESNAME_MAXLEN)
+		return -EINVAL;
 	memcpy(key, name, len);
 	*r_ret = rhashtable_lookup_fast(rhash, &key, dlm_rhash_rsb_params);
 	if (*r_ret)
Signature · 1 line
2.43.0
author maintainer
#2 lore raw

PATCH 3/7 fs/dlm: use list_add_tail() instead of open-coding list insertion

In reply to Alexander Aring

From: Shaurya Rane <[email protected]>

Replace the manual list pointer manipulation in add_ordered_member() with the standard list_add_tail() helper. The original code explicitly updated ->prev and ->next pointers to insert @newlist before @tmp, which is exactly what list_add_tail(newlist, tmp) provides.

Using the list macro improves readability, removes a source of potential pointer bugs, and satisfies the existing FIXME requesting conversion to the list helpers. No functional change in the ordering logic for DLM members.

---
 fs/dlm/member.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
fs/dlm/member.c +1 -5
index c0f557a80a754..c1b5598997b7f 100644
@@ -299,11 +299,7 @@ static void add_ordered_member(struct dlm_ls *ls, struct dlm_member *new)
 	if (!memb)
 		list_add_tail(newlist, head);
 	else {
-		/* FIXME: can use list macro here */
-		newlist->prev = tmp->prev;
-		newlist->next = tmp;
-		tmp->prev->next = newlist;
-		tmp->prev = newlist;
+		list_add_tail(newlist, tmp);
 	}
 }
 
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH 4/7 dlm: Constify struct configfs_item_operations and configfs_group_operations

In reply to Alexander Aring

From: Christophe JAILLET <[email protected]>

'struct configfs_item_operations' and 'configfs_group_operations' are not modified in this driver.

Constifying these structures moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers.

On a x86_64, with allmodconfig, as an example:
Before:
======
text data bss dec hex filename
29436 12952 384 42772 a714 fs/dlm/config.o

After:
=====
text data bss dec hex filename
30076 12312 384 42772 a714 fs/dlm/config.o

---
 fs/dlm/config.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
fs/dlm/config.c +8 -8
index a0d75b5c83c63..82cc3215663f6 100644
@@ -324,39 +324,39 @@ struct dlm_member_gone {
 	struct list_head list; /* space->members_gone */
 };
 
-static struct configfs_group_operations clusters_ops = {
+static const struct configfs_group_operations clusters_ops = {
 	.make_group = make_cluster,
 	.drop_item = drop_cluster,
 };
 
-static struct configfs_item_operations cluster_ops = {
+static const struct configfs_item_operations cluster_ops = {
 	.release = release_cluster,
 };
 
-static struct configfs_group_operations spaces_ops = {
+static const struct configfs_group_operations spaces_ops = {
 	.make_group = make_space,
 	.drop_item = drop_space,
 };
 
-static struct configfs_item_operations space_ops = {
+static const struct configfs_item_operations space_ops = {
 	.release = release_space,
 };
 
-static struct configfs_group_operations comms_ops = {
+static const struct configfs_group_operations comms_ops = {
 	.make_item = make_comm,
 	.drop_item = drop_comm,
 };
 
-static struct configfs_item_operations comm_ops = {
+static const struct configfs_item_operations comm_ops = {
 	.release = release_comm,
 };
 
-static struct configfs_group_operations nodes_ops = {
+static const struct configfs_group_operations nodes_ops = {
 	.make_item = make_node,
 	.drop_item = drop_node,
 };
 
-static struct configfs_item_operations node_ops = {
+static const struct configfs_item_operations node_ops = {
 	.release = release_node,
 };
 
Signature · 1 line
2.43.0
author maintainer
#4 lore raw

PATCH 5/7 fs/dlm/dir: remove unuse variable count_match

In reply to Alexander Aring

From: Alex Shi <[email protected]>

The variable was never used after introduced. Better to comment it if we want to keep the info.

fs/dlm/dir.c:65:26: error: variable 'count_match' set but not used [-Werror,-Wunused-but-set-variable]
65 | unsigned int count = 0, count_match = 0, count_bad = 0, count_add = 0;
| ^
1 error generated.

---
 fs/dlm/dir.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/dlm/dir.c +3 -3
index b1ab0adbd9d02..01c292379f5b2 100644
@@ -62,7 +62,7 @@ int dlm_recover_directory(struct dlm_ls *ls, uint64_t seq)
 	char *b, *last_name = NULL;
 	int error = -ENOMEM, last_len, nodeid, result;
 	uint16_t namelen;
-	unsigned int count = 0, count_match = 0, count_bad = 0, count_add = 0;
+	unsigned int count = 0, count_bad = 0, count_add = 0;
 
 	log_rinfo(ls, "dlm_recover_directory");
 
@@ -157,12 +157,12 @@ int dlm_recover_directory(struct dlm_ls *ls, uint64_t seq)
 				}
 
 				/* The name was found in rsbtbl, and the
-				 * master nodeid matches memb->nodeid. */
+				 * master nodeid matches memb->nodeid.
 
 				if (result == DLM_LU_MATCH &&
 				    nodeid == memb->nodeid) {
 					count_match++;
-				}
+				}*/
 
 				/* The name was not found in rsbtbl and was
 				 * added with memb->nodeid as the master. */
Signature · 1 line
2.43.0
author maintainer
#5 lore raw

PATCH 6/7 dlm: use bool for coniditonal expressions

In reply to Alexander Aring

This patch changes the return value of functions instead of using int and their corresponding value 1/0 for true/false. Instead we use the predefined true/false definitions.

---
 fs/dlm/dlm_internal.h |   2 +-
 fs/dlm/lock.c         | 151 +++++++++++++++++++++---------------------
 fs/dlm/lowcomms.c     |  16 ++---
 fs/dlm/member.c       |  18 ++---
 fs/dlm/member.h       |   6 +-
 fs/dlm/requestqueue.c |  12 ++--
 fs/dlm/user.c         |  16 ++---
 fs/dlm/user.h         |   2 +-
 8 files changed, 111 insertions(+), 112 deletions(-)
fs/dlm/dlm_internal.h +1 -1
index d534a4bc162bb..c9d924b03f14a 100644
@@ -381,7 +381,7 @@ static inline void rsb_clear_flag(struct dlm_rsb *r, enum rsb_flags flag)
 	__clear_bit(flag, &r->res_flags);
 }
 
-static inline int rsb_flag(struct dlm_rsb *r, enum rsb_flags flag)
+static inline bool rsb_flag(struct dlm_rsb *r, enum rsb_flags flag)
 {
 	return test_bit(flag, &r->res_flags);
 }
fs/dlm/lock.c +75 -76

423 lines not on this page · raw message

fs/dlm/lowcomms.c +8 -8
index b3958008ba3f7..3c4d4b837e474 100644
@@ -331,32 +331,32 @@ static struct connection *nodeid2con(int nodeid, gfp_t alloc)
 	return con;
 }
 
-static int addr_compare(const struct sockaddr_storage *x,
-			const struct sockaddr_storage *y)
+static bool addr_compare(const struct sockaddr_storage *x,
+			 const struct sockaddr_storage *y)
 {
 	switch (x->ss_family) {
 	case AF_INET: {
 		struct sockaddr_in *sinx = (struct sockaddr_in *)x;
 		struct sockaddr_in *siny = (struct sockaddr_in *)y;
 		if (sinx->sin_addr.s_addr != siny->sin_addr.s_addr)
-			return 0;
+			return false;
 		if (sinx->sin_port != siny->sin_port)
-			return 0;
+			return false;
 		break;
 	}
 	case AF_INET6: {
 		struct sockaddr_in6 *sinx = (struct sockaddr_in6 *)x;
 		struct sockaddr_in6 *siny = (struct sockaddr_in6 *)y;
 		if (!ipv6_addr_equal(&sinx->sin6_addr, &siny->sin6_addr))
-			return 0;
+			return false;
 		if (sinx->sin6_port != siny->sin6_port)
-			return 0;
+			return false;
 		break;
 	}
 	default:
-		return 0;
+		return false;
 	}
-	return 1;
+	return true;
 }
 
 static int nodeid_to_addr(int nodeid, struct sockaddr_storage *sas_out,
fs/dlm/member.c +9 -9
index c1b5598997b7f..c34ddf726cb06 100644
@@ -18,11 +18,11 @@
 #include "midcomms.h"
 #include "lowcomms.h"
 
-int dlm_slots_version(const struct dlm_header *h)
+bool dlm_slots_version(const struct dlm_header *h)
 {
 	if ((le32_to_cpu(h->h_version) & 0x0000FFFF) < DLM_HEADER_SLOTS)
-		return 0;
-	return 1;
+		return false;
+	return true;
 }
 
 void dlm_slot_save(struct dlm_ls *ls, struct dlm_rcom *rc,
@@ -353,20 +353,20 @@ static struct dlm_member *find_memb(struct list_head *head, int nodeid)
 	return NULL;
 }
 
-int dlm_is_member(struct dlm_ls *ls, int nodeid)
+bool dlm_is_member(struct dlm_ls *ls, int nodeid)
 {
 	if (find_memb(&ls->ls_nodes, nodeid))
-		return 1;
-	return 0;
+		return true;
+	return false;
 }
 
-int dlm_is_removed(struct dlm_ls *ls, int nodeid)
+bool dlm_is_removed(struct dlm_ls *ls, int nodeid)
 {
 	WARN_ON_ONCE(!nodeid || nodeid == -1);
 
 	if (find_memb(&ls->ls_nodes_gone, nodeid))
-		return 1;
-	return 0;
+		return true;
+	return false;
 }
 
 static void clear_memb_list(struct list_head *head,
fs/dlm/member.h +3 -3
index f61cfde463140..c672009548f22 100644
@@ -16,9 +16,9 @@ int dlm_ls_start(struct dlm_ls *ls);
 void dlm_clear_members(struct dlm_ls *ls);
 void dlm_clear_members_gone(struct dlm_ls *ls);
 int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv,int *neg_out);
-int dlm_is_removed(struct dlm_ls *ls, int nodeid);
-int dlm_is_member(struct dlm_ls *ls, int nodeid);
-int dlm_slots_version(const struct dlm_header *h);
+bool dlm_is_removed(struct dlm_ls *ls, int nodeid);
+bool dlm_is_member(struct dlm_ls *ls, int nodeid);
+bool dlm_slots_version(const struct dlm_header *h);
 void dlm_slot_save(struct dlm_ls *ls, struct dlm_rcom *rc,
 		   struct dlm_member *memb);
 void dlm_slots_copy_out(struct dlm_ls *ls, struct dlm_rcom *rc);
fs/dlm/requestqueue.c +6 -6
index 719a5243a0693..daffc8df61e76 100644
@@ -105,16 +105,16 @@ int dlm_process_requestqueue(struct dlm_ls *ls)
 	return error;
 }
 
-static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid)
+static bool purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid)
 {
 	__le32 type = ms->m_type;
 
 	/* the ls is being cleaned up and freed by release_lockspace */
 	if (!atomic_read(&ls->ls_count))
-		return 1;
+		return true;
 
 	if (dlm_is_removed(ls, nodeid))
-		return 1;
+		return true;
 
 	/* directory operations are always purged because the directory is
 	   always rebuilt during recovery and the lookups resent */
@@ -122,12 +122,12 @@ static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid)
 	if (type == cpu_to_le32(DLM_MSG_REMOVE) ||
 	    type == cpu_to_le32(DLM_MSG_LOOKUP) ||
 	    type == cpu_to_le32(DLM_MSG_LOOKUP_REPLY))
-		return 1;
+		return true;
 
 	if (!dlm_no_directory(ls))
-		return 0;
+		return false;
 
-	return 1;
+	return true;
 }
 
 void dlm_purge_requestqueue(struct dlm_ls *ls)
fs/dlm/user.c +8 -8
index 51daf4acbe318..988584c49953a 100644
@@ -156,20 +156,20 @@ static void compat_output(struct dlm_lock_result *res,
    not related to the lifetime of the lkb struct which is managed
    entirely by refcount. */
 
-static int lkb_is_endoflife(int mode, int status)
+static bool lkb_is_endoflife(int mode, int status)
 {
 	switch (status) {
 	case -DLM_EUNLOCK:
-		return 1;
+		return true;
 	case -DLM_ECANCEL:
 	case -ETIMEDOUT:
 	case -EDEADLK:
 	case -EAGAIN:
 		if (mode == DLM_LOCK_IV)
-			return 1;
+			return true;
 		break;
 	}
-	return 0;
+	return false;
 }
 
 /* we could possibly check if the cancel of an orphan has resulted in the lkb
@@ -877,13 +877,13 @@ static __poll_t device_poll(struct file *file, poll_table *wait)
 	return 0;
 }
 
-int dlm_user_daemon_available(void)
+bool dlm_user_daemon_available(void)
 {
 	/* dlm_controld hasn't started (or, has started, but not
 	   properly populated configfs) */
 
 	if (!dlm_our_nodeid())
-		return 0;
+		return false;
 
 	/* This is to deal with versions of dlm_controld that don't
 	   know about the monitor device.  We assume that if the
@@ -892,9 +892,9 @@ int dlm_user_daemon_available(void)
 	   should open the monitor device before populating configfs. */
 
 	if (dlm_monitor_unused)
-		return 1;
+		return true;
 
-	return atomic_read(&dlm_monitor_opened) ? 1 : 0;
+	return !!atomic_read(&dlm_monitor_opened);
 }
 
 static int ctl_device_open(struct inode *inode, struct file *file)
fs/dlm/user.h +1 -1
index 2caf8e6e24d51..f7e6d1054492d 100644
@@ -12,6 +12,6 @@ void dlm_user_add_ast(struct dlm_lkb *lkb, uint32_t flags, int mode,
 int dlm_user_init(void);
 void dlm_user_exit(void);
 int dlm_device_deregister(struct dlm_ls *ls);
-int dlm_user_daemon_available(void);
+bool dlm_user_daemon_available(void);
 
 #endif
Signature · 1 line
2.43.0
author maintainer
#6 lore raw

PATCH 7/7 dlm: use coniditon expression instead return scalars

In reply to Alexander Aring

Removes the condition and the scalar returns, instead we return directly the boolean expression.

---
 fs/dlm/lock.c         | 47 ++++++++++++-------------------------------
 fs/dlm/member.c       | 12 +++--------
 fs/dlm/requestqueue.c |  5 +----
 3 files changed, 17 insertions(+), 47 deletions(-)
fs/dlm/lock.c +13 -34
index 7ec30fbe33d92..d5bf194ae4f51 100644
@@ -260,10 +260,8 @@ static inline bool is_master_copy(struct dlm_lkb *lkb)
 
 static inline bool middle_conversion(struct dlm_lkb *lkb)
 {
-	if ((lkb->lkb_grmode==DLM_LOCK_PR && lkb->lkb_rqmode==DLM_LOCK_CW) ||
-	    (lkb->lkb_rqmode==DLM_LOCK_PR && lkb->lkb_grmode==DLM_LOCK_CW))
-		return true;
-	return false;
+	return ((lkb->lkb_grmode == DLM_LOCK_PR && lkb->lkb_rqmode == DLM_LOCK_CW) ||
+		(lkb->lkb_rqmode == DLM_LOCK_PR && lkb->lkb_grmode == DLM_LOCK_CW));
 }
 
 static inline bool down_conversion(struct dlm_lkb *lkb)
@@ -2140,10 +2138,7 @@ static inline bool first_in_list(struct dlm_lkb *lkb, struct list_head *head)
 {
 	struct dlm_lkb *first = list_entry(head->next, struct dlm_lkb,
 					   lkb_statequeue);
-	if (lkb->lkb_id == first->lkb_id)
-		return true;
-
-	return false;
+	return (lkb->lkb_id == first->lkb_id);
 }
 
 /* Check if the given lkb conflicts with another lkb on the queue. */
@@ -2380,11 +2375,8 @@ static bool _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, bool now,
 	 * of the most restrictive lock granted on the resource.
 	 */
 
-	if (!now && !conv && list_empty(&r->res_convertqueue) &&
-	    first_in_list(lkb, &r->res_waitqueue))
-		return true;
-
-	return false;
+	return (!now && !conv && list_empty(&r->res_convertqueue) &&
+		first_in_list(lkb, &r->res_waitqueue));
 }
 
 static bool can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, bool now,
@@ -2544,16 +2536,11 @@ static int grant_pending_wait(struct dlm_rsb *r, int high, bool *cw,
 
 static bool lock_requires_bast(struct dlm_lkb *gr, int high, bool cw)
 {
-	if (gr->lkb_grmode == DLM_LOCK_PR && cw) {
-		if (gr->lkb_highbast < DLM_LOCK_EX)
-			return true;
-		return false;
-	}
+	if (gr->lkb_grmode == DLM_LOCK_PR && cw)
+		return (gr->lkb_highbast < DLM_LOCK_EX);
 
-	if (gr->lkb_highbast < high &&
-	    !__dlm_compat_matrix[gr->lkb_grmode+1][high+1])
-		return true;
-	return false;
+	return (gr->lkb_highbast < high &&
+		!__dlm_compat_matrix[gr->lkb_grmode+1][high+1]);
 }
 
 static void grant_pending_locks(struct dlm_rsb *r, unsigned int *count)
@@ -2595,15 +2582,10 @@ static void grant_pending_locks(struct dlm_rsb *r, unsigned int *count)
 static int modes_require_bast(struct dlm_lkb *gr, struct dlm_lkb *rq)
 {
 	if ((gr->lkb_grmode == DLM_LOCK_PR && rq->lkb_rqmode == DLM_LOCK_CW) ||
-	    (gr->lkb_grmode == DLM_LOCK_CW && rq->lkb_rqmode == DLM_LOCK_PR)) {
-		if (gr->lkb_highbast < DLM_LOCK_EX)
-			return true;
-		return false;
-	}
+	    (gr->lkb_grmode == DLM_LOCK_CW && rq->lkb_rqmode == DLM_LOCK_PR))
+		return (gr->lkb_highbast < DLM_LOCK_EX);
 
-	if (gr->lkb_highbast < rq->lkb_rqmode && !modes_compat(gr, rq))
-		return true;
-	return false;
+	return (gr->lkb_highbast < rq->lkb_rqmode && !modes_compat(gr, rq));
 }
 
 static void send_bast_queue(struct dlm_rsb *r, struct list_head *head,
@@ -5030,10 +5012,7 @@ static bool waiter_needs_recovery(struct dlm_ls *ls, struct dlm_lkb *lkb,
 	if (dlm_no_directory(ls))
 		return true;
 
-	if (dlm_is_removed(ls, lkb->lkb_wait_nodeid))
-		return true;
-
-	return false;
+	return dlm_is_removed(ls, lkb->lkb_wait_nodeid);
 }
 
 /* Recovery for locks that are waiting for replies from nodes that are now
fs/dlm/member.c +3 -9
index c34ddf726cb06..b670c4fc8f4c4 100644
@@ -20,9 +20,7 @@
 
 bool dlm_slots_version(const struct dlm_header *h)
 {
-	if ((le32_to_cpu(h->h_version) & 0x0000FFFF) < DLM_HEADER_SLOTS)
-		return false;
-	return true;
+	return !((le32_to_cpu(h->h_version) & 0x0000FFFF) < DLM_HEADER_SLOTS);
 }
 
 void dlm_slot_save(struct dlm_ls *ls, struct dlm_rcom *rc,
@@ -355,18 +353,14 @@ static struct dlm_member *find_memb(struct list_head *head, int nodeid)
 
 bool dlm_is_member(struct dlm_ls *ls, int nodeid)
 {
-	if (find_memb(&ls->ls_nodes, nodeid))
-		return true;
-	return false;
+	return !!find_memb(&ls->ls_nodes, nodeid);
 }
 
 bool dlm_is_removed(struct dlm_ls *ls, int nodeid)
 {
 	WARN_ON_ONCE(!nodeid || nodeid == -1);
 
-	if (find_memb(&ls->ls_nodes_gone, nodeid))
-		return true;
-	return false;
+	return !!find_memb(&ls->ls_nodes_gone, nodeid);
 }
 
 static void clear_memb_list(struct list_head *head,
fs/dlm/requestqueue.c +1 -4
index daffc8df61e76..ac18dd0c09df6 100644
@@ -124,10 +124,7 @@ static bool purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid)
 	    type == cpu_to_le32(DLM_MSG_LOOKUP_REPLY))
 		return true;
 
-	if (!dlm_no_directory(ls))
-		return false;
-
-	return true;
+	return dlm_no_directory(ls);
 }
 
 void dlm_purge_requestqueue(struct dlm_ls *ls)
Signature · 1 line
2.43.0