public inbox for gfs2@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH vv6.19-rc6 1/7] dlm: fix recovery pending middle conversion
@ 2026-01-20 15:35 Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 2/7] dlm: validate length in dlm_search_rsb_tree Alexander Aring
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Alexander Aring @ 2026-01-20 15:35 UTC (permalink / raw)
  To: teigland; +Cc: aahringo, gfs2

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.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/lock.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index be938fdf17d96..c01a291db401b 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -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 */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH vv6.19-rc6 2/7] dlm: validate length in dlm_search_rsb_tree
  2026-01-20 15:35 [PATCH vv6.19-rc6 1/7] dlm: fix recovery pending middle conversion Alexander Aring
@ 2026-01-20 15:35 ` Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 3/7] fs/dlm: use list_add_tail() instead of open-coding list insertion Alexander Aring
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2026-01-20 15:35 UTC (permalink / raw)
  To: teigland; +Cc: aahringo, gfs2

From: Ezrak1e <ezrakiez@gmail.com>

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.

Signed-off-by: Ezrak1e <ezrakiez@gmail.com>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/lock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index c01a291db401b..a393ecaf3442a 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -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)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH vv6.19-rc6 3/7] fs/dlm: use list_add_tail() instead of open-coding list insertion
  2026-01-20 15:35 [PATCH vv6.19-rc6 1/7] dlm: fix recovery pending middle conversion Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 2/7] dlm: validate length in dlm_search_rsb_tree Alexander Aring
@ 2026-01-20 15:35 ` Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 4/7] dlm: Constify struct configfs_item_operations and configfs_group_operations Alexander Aring
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2026-01-20 15:35 UTC (permalink / raw)
  To: teigland; +Cc: aahringo, gfs2

From: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>

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.

Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/member.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index c0f557a80a754..c1b5598997b7f 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -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);
 	}
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH vv6.19-rc6 4/7] dlm: Constify struct configfs_item_operations and configfs_group_operations
  2026-01-20 15:35 [PATCH vv6.19-rc6 1/7] dlm: fix recovery pending middle conversion Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 2/7] dlm: validate length in dlm_search_rsb_tree Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 3/7] fs/dlm: use list_add_tail() instead of open-coding list insertion Alexander Aring
@ 2026-01-20 15:35 ` Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 5/7] fs/dlm/dir: remove unuse variable count_match Alexander Aring
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2026-01-20 15:35 UTC (permalink / raw)
  To: teigland; +Cc: aahringo, gfs2

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

'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

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/config.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index a0d75b5c83c63..82cc3215663f6 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -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,
 };
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH vv6.19-rc6 5/7] fs/dlm/dir: remove unuse variable count_match
  2026-01-20 15:35 [PATCH vv6.19-rc6 1/7] dlm: fix recovery pending middle conversion Alexander Aring
                   ` (2 preceding siblings ...)
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 4/7] dlm: Constify struct configfs_item_operations and configfs_group_operations Alexander Aring
@ 2026-01-20 15:35 ` Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 6/7] dlm: use bool for coniditonal expressions Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 7/7] dlm: use coniditon expression instead return scalars Alexander Aring
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2026-01-20 15:35 UTC (permalink / raw)
  To: teigland; +Cc: aahringo, gfs2

From: Alex Shi <alexs@kernel.org>

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.

Signed-off-by: Alex Shi <alexs@kernel.org>
Cc: gfs2@lists.linux.dev
Cc: Alexander Aring <aahringo@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Acked-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/dir.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c
index b1ab0adbd9d02..01c292379f5b2 100644
--- a/fs/dlm/dir.c
+++ b/fs/dlm/dir.c
@@ -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. */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH vv6.19-rc6 6/7] dlm: use bool for coniditonal expressions
  2026-01-20 15:35 [PATCH vv6.19-rc6 1/7] dlm: fix recovery pending middle conversion Alexander Aring
                   ` (3 preceding siblings ...)
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 5/7] fs/dlm/dir: remove unuse variable count_match Alexander Aring
@ 2026-01-20 15:35 ` Alexander Aring
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 7/7] dlm: use coniditon expression instead return scalars Alexander Aring
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2026-01-20 15:35 UTC (permalink / raw)
  To: teigland; +Cc: aahringo, gfs2

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.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 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(-)

diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index d534a4bc162bb..c9d924b03f14a 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -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);
 }
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index a393ecaf3442a..7ec30fbe33d92 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -216,72 +216,72 @@ int dlm_lock_recovery_try(struct dlm_ls *ls)
 	return down_read_trylock(&ls->ls_in_recovery);
 }
 
-static inline int can_be_queued(struct dlm_lkb *lkb)
+static inline bool can_be_queued(struct dlm_lkb *lkb)
 {
 	return !(lkb->lkb_exflags & DLM_LKF_NOQUEUE);
 }
 
-static inline int force_blocking_asts(struct dlm_lkb *lkb)
+static inline bool force_blocking_asts(struct dlm_lkb *lkb)
 {
 	return (lkb->lkb_exflags & DLM_LKF_NOQUEUEBAST);
 }
 
-static inline int is_demoted(struct dlm_lkb *lkb)
+static inline bool is_demoted(struct dlm_lkb *lkb)
 {
 	return test_bit(DLM_SBF_DEMOTED_BIT, &lkb->lkb_sbflags);
 }
 
-static inline int is_altmode(struct dlm_lkb *lkb)
+static inline bool is_altmode(struct dlm_lkb *lkb)
 {
 	return test_bit(DLM_SBF_ALTMODE_BIT, &lkb->lkb_sbflags);
 }
 
-static inline int is_granted(struct dlm_lkb *lkb)
+static inline bool is_granted(struct dlm_lkb *lkb)
 {
 	return (lkb->lkb_status == DLM_LKSTS_GRANTED);
 }
 
-static inline int is_remote(struct dlm_rsb *r)
+static inline bool is_remote(struct dlm_rsb *r)
 {
 	DLM_ASSERT(r->res_nodeid >= 0, dlm_print_rsb(r););
 	return !!r->res_nodeid;
 }
 
-static inline int is_process_copy(struct dlm_lkb *lkb)
+static inline bool is_process_copy(struct dlm_lkb *lkb)
 {
 	return lkb->lkb_nodeid &&
 	       !test_bit(DLM_IFL_MSTCPY_BIT, &lkb->lkb_iflags);
 }
 
-static inline int is_master_copy(struct dlm_lkb *lkb)
+static inline bool is_master_copy(struct dlm_lkb *lkb)
 {
 	return test_bit(DLM_IFL_MSTCPY_BIT, &lkb->lkb_iflags);
 }
 
-static inline int middle_conversion(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 1;
-	return 0;
+		return true;
+	return false;
 }
 
-static inline int down_conversion(struct dlm_lkb *lkb)
+static inline bool down_conversion(struct dlm_lkb *lkb)
 {
 	return (!middle_conversion(lkb) && lkb->lkb_rqmode < lkb->lkb_grmode);
 }
 
-static inline int is_overlap_unlock(struct dlm_lkb *lkb)
+static inline bool is_overlap_unlock(struct dlm_lkb *lkb)
 {
 	return test_bit(DLM_IFL_OVERLAP_UNLOCK_BIT, &lkb->lkb_iflags);
 }
 
-static inline int is_overlap_cancel(struct dlm_lkb *lkb)
+static inline bool is_overlap_cancel(struct dlm_lkb *lkb)
 {
 	return test_bit(DLM_IFL_OVERLAP_CANCEL_BIT, &lkb->lkb_iflags);
 }
 
-static inline int is_overlap(struct dlm_lkb *lkb)
+static inline bool is_overlap(struct dlm_lkb *lkb)
 {
 	return test_bit(DLM_IFL_OVERLAP_UNLOCK_BIT, &lkb->lkb_iflags) ||
 	       test_bit(DLM_IFL_OVERLAP_CANCEL_BIT, &lkb->lkb_iflags);
@@ -2136,19 +2136,19 @@ static void munge_altmode(struct dlm_lkb *lkb, const struct dlm_message *ms)
 	}
 }
 
-static inline int first_in_list(struct dlm_lkb *lkb, struct list_head *head)
+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 1;
+		return true;
 
-	return 0;
+	return false;
 }
 
 /* Check if the given lkb conflicts with another lkb on the queue. */
 
-static int queue_conflict(struct list_head *head, struct dlm_lkb *lkb)
+static bool queue_conflict(struct list_head *head, struct dlm_lkb *lkb)
 {
 	struct dlm_lkb *this;
 
@@ -2156,9 +2156,9 @@ static int queue_conflict(struct list_head *head, struct dlm_lkb *lkb)
 		if (this == lkb)
 			continue;
 		if (!modes_compat(this, lkb))
-			return 1;
+			return true;
 	}
-	return 0;
+	return false;
 }
 
 /*
@@ -2202,7 +2202,7 @@ static int queue_conflict(struct list_head *head, struct dlm_lkb *lkb)
  * both already on the convert queue.
  */
 
-static int conversion_deadlock_detect(struct dlm_rsb *r, struct dlm_lkb *lkb2)
+static bool conversion_deadlock_detect(struct dlm_rsb *r, struct dlm_lkb *lkb2)
 {
 	struct dlm_lkb *lkb1;
 	int lkb_is_ahead = 0;
@@ -2215,14 +2215,14 @@ static int conversion_deadlock_detect(struct dlm_rsb *r, struct dlm_lkb *lkb2)
 
 		if (!lkb_is_ahead) {
 			if (!modes_compat(lkb2, lkb1))
-				return 1;
+				return true;
 		} else {
 			if (!modes_compat(lkb2, lkb1) &&
 			    !modes_compat(lkb1, lkb2))
-				return 1;
+				return true;
 		}
 	}
-	return 0;
+	return false;
 }
 
 /*
@@ -2241,10 +2241,10 @@ static int conversion_deadlock_detect(struct dlm_rsb *r, struct dlm_lkb *lkb2)
  * References are from chapter 6 of "VAXcluster Principles" by Roy Davis
  */
 
-static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
-			   int recover)
+static bool _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, bool now,
+			    bool recover)
 {
-	int8_t conv = (lkb->lkb_grmode != DLM_LOCK_IV);
+	bool conv = (lkb->lkb_grmode != DLM_LOCK_IV);
 
 	/*
 	 * 6-10: Version 5.4 introduced an option to address the phenomenon of
@@ -2266,7 +2266,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 	 */
 
 	if (lkb->lkb_exflags & DLM_LKF_EXPEDITE)
-		return 1;
+		return true;
 
 	/*
 	 * A shortcut. Without this, !queue_conflict(grantqueue, lkb) would be
@@ -2274,7 +2274,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 	 */
 
 	if (queue_conflict(&r->res_grantqueue, lkb))
-		return 0;
+		return false;
 
 	/*
 	 * 6-3: By default, a conversion request is immediately granted if the
@@ -2283,7 +2283,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 	 */
 
 	if (queue_conflict(&r->res_convertqueue, lkb))
-		return 0;
+		return false;
 
 	/*
 	 * The RECOVER_GRANT flag means dlm_recover_grant() is granting
@@ -2300,7 +2300,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 	 */
 
 	if (conv && recover)
-		return 1;
+		return true;
 
 	/*
 	 * 6-5: But the default algorithm for deciding whether to grant or
@@ -2326,7 +2326,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 	 */
 
 	if (now && conv && !(lkb->lkb_exflags & DLM_LKF_QUECVT))
-		return 1;
+		return true;
 
 	/*
 	 * Even if the convert is compat with all granted locks,
@@ -2335,9 +2335,9 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 
 	if (now && conv && (lkb->lkb_exflags & DLM_LKF_QUECVT)) {
 		if (list_empty(&r->res_convertqueue))
-			return 1;
+			return true;
 		else
-			return 0;
+			return false;
 	}
 
 	/*
@@ -2346,7 +2346,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 	 */
 
 	if (lkb->lkb_exflags & DLM_LKF_NOORDER)
-		return 1;
+		return true;
 
 	/*
 	 * 6-3: Once in that queue [CONVERTING], a conversion request cannot be
@@ -2355,7 +2355,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 	 */
 
 	if (!now && conv && first_in_list(lkb, &r->res_convertqueue))
-		return 1;
+		return true;
 
 	/*
 	 * 6-4: By default, a new request is immediately granted only if all
@@ -2370,7 +2370,7 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 
 	if (now && !conv && list_empty(&r->res_convertqueue) &&
 	    list_empty(&r->res_waitqueue))
-		return 1;
+		return true;
 
 	/*
 	 * 6-4: Once a lock request is in the queue of ungranted new requests,
@@ -2382,17 +2382,16 @@ static int _can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 
 	if (!now && !conv && list_empty(&r->res_convertqueue) &&
 	    first_in_list(lkb, &r->res_waitqueue))
-		return 1;
+		return true;
 
-	return 0;
+	return false;
 }
 
-static int can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
-			  int recover, int *err)
+static bool can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, bool now,
+			   bool recover, int *err)
 {
-	int rv;
+	bool rv, is_convert = (lkb->lkb_grmode != DLM_LOCK_IV);
 	int8_t alt = 0, rqmode = lkb->lkb_rqmode;
-	int8_t is_convert = (lkb->lkb_grmode != DLM_LOCK_IV);
 
 	if (err)
 		*err = 0;
@@ -2449,27 +2448,27 @@ static int can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
 /* Returns the highest requested mode of all blocked conversions; sets
    cw if there's a blocked conversion to DLM_LOCK_CW. */
 
-static int grant_pending_convert(struct dlm_rsb *r, int high, int *cw,
+static int grant_pending_convert(struct dlm_rsb *r, int high, bool *cw,
 				 unsigned int *count)
 {
+	bool demoted, quit, grant_restart, demote_restart;
+	bool recover = rsb_flag(r, RSB_RECOVER_GRANT);
 	struct dlm_lkb *lkb, *s;
-	int recover = rsb_flag(r, RSB_RECOVER_GRANT);
-	int hi, demoted, quit, grant_restart, demote_restart;
-	int deadlk;
+	int hi, deadlk;
 
-	quit = 0;
+	quit = false;
  restart:
-	grant_restart = 0;
-	demote_restart = 0;
+	grant_restart = false;
+	demote_restart = false;
 	hi = DLM_LOCK_IV;
 
 	list_for_each_entry_safe(lkb, s, &r->res_convertqueue, lkb_statequeue) {
 		demoted = is_demoted(lkb);
 		deadlk = 0;
 
-		if (can_be_granted(r, lkb, 0, recover, &deadlk)) {
+		if (can_be_granted(r, lkb, false, recover, &deadlk)) {
 			grant_lock_pending(r, lkb);
-			grant_restart = 1;
+			grant_restart = true;
 			if (count)
 				(*count)++;
 			continue;
@@ -2478,7 +2477,7 @@ static int grant_pending_convert(struct dlm_rsb *r, int high, int *cw,
 		if (!demoted && is_demoted(lkb)) {
 			log_print("WARN: pending demoted %x node %d %s",
 				  lkb->lkb_id, lkb->lkb_nodeid, r->res_name);
-			demote_restart = 1;
+			demote_restart = true;
 			continue;
 		}
 
@@ -2505,33 +2504,33 @@ static int grant_pending_convert(struct dlm_rsb *r, int high, int *cw,
 		hi = max_t(int, lkb->lkb_rqmode, hi);
 
 		if (cw && lkb->lkb_rqmode == DLM_LOCK_CW)
-			*cw = 1;
+			*cw = true;
 	}
 
 	if (grant_restart)
 		goto restart;
 	if (demote_restart && !quit) {
-		quit = 1;
+		quit = true;
 		goto restart;
 	}
 
 	return max_t(int, high, hi);
 }
 
-static int grant_pending_wait(struct dlm_rsb *r, int high, int *cw,
+static int grant_pending_wait(struct dlm_rsb *r, int high, bool *cw,
 			      unsigned int *count)
 {
 	struct dlm_lkb *lkb, *s;
 
 	list_for_each_entry_safe(lkb, s, &r->res_waitqueue, lkb_statequeue) {
-		if (can_be_granted(r, lkb, 0, 0, NULL)) {
+		if (can_be_granted(r, lkb, false, false, NULL)) {
 			grant_lock_pending(r, lkb);
 			if (count)
 				(*count)++;
 		} else {
 			high = max_t(int, lkb->lkb_rqmode, high);
 			if (lkb->lkb_rqmode == DLM_LOCK_CW)
-				*cw = 1;
+				*cw = true;
 		}
 	}
 
@@ -2543,25 +2542,25 @@ static int grant_pending_wait(struct dlm_rsb *r, int high, int *cw,
    high is the largest rqmode of all locks blocked on the convert or
    waiting queue. */
 
-static int lock_requires_bast(struct dlm_lkb *gr, int high, int 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 1;
-		return 0;
+			return true;
+		return false;
 	}
 
 	if (gr->lkb_highbast < high &&
 	    !__dlm_compat_matrix[gr->lkb_grmode+1][high+1])
-		return 1;
-	return 0;
+		return true;
+	return false;
 }
 
 static void grant_pending_locks(struct dlm_rsb *r, unsigned int *count)
 {
 	struct dlm_lkb *lkb, *s;
 	int high = DLM_LOCK_IV;
-	int cw = 0;
+	bool cw = false;
 
 	if (!is_master(r)) {
 		log_print("grant_pending_locks r nodeid %d", r->res_nodeid);
@@ -2598,13 +2597,13 @@ 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 1;
-		return 0;
+			return true;
+		return false;
 	}
 
 	if (gr->lkb_highbast < rq->lkb_rqmode && !modes_compat(gr, rq))
-		return 1;
-	return 0;
+		return true;
+	return false;
 }
 
 static void send_bast_queue(struct dlm_rsb *r, struct list_head *head,
@@ -3039,7 +3038,7 @@ static int do_request(struct dlm_rsb *r, struct dlm_lkb *lkb)
 {
 	int error = 0;
 
-	if (can_be_granted(r, lkb, 1, 0, NULL)) {
+	if (can_be_granted(r, lkb, true, false, NULL)) {
 		grant_lock(r, lkb);
 		queue_cast(r, lkb, 0);
 		goto out;
@@ -3078,7 +3077,7 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
 
 	/* changing an existing lock may allow others to be granted */
 
-	if (can_be_granted(r, lkb, 1, 0, &deadlk)) {
+	if (can_be_granted(r, lkb, true, false, &deadlk)) {
 		grant_lock(r, lkb);
 		queue_cast(r, lkb, 0);
 		goto out;
@@ -5025,16 +5024,16 @@ static void recover_convert_waiter(struct dlm_ls *ls, struct dlm_lkb *lkb,
 /* A waiting lkb needs recovery if the master node has failed, or
    the master node is changing (only when no directory is used) */
 
-static int waiter_needs_recovery(struct dlm_ls *ls, struct dlm_lkb *lkb,
-				 int dir_nodeid)
+static bool waiter_needs_recovery(struct dlm_ls *ls, struct dlm_lkb *lkb,
+				  int dir_nodeid)
 {
 	if (dlm_no_directory(ls))
-		return 1;
+		return true;
 
 	if (dlm_is_removed(ls, lkb->lkb_wait_nodeid))
-		return 1;
+		return true;
 
-	return 0;
+	return false;
 }
 
 /* Recovery for locks that are waiting for replies from nodes that are now
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index b3958008ba3f7..3c4d4b837e474 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -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,
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index c1b5598997b7f..c34ddf726cb06 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -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,
diff --git a/fs/dlm/member.h b/fs/dlm/member.h
index f61cfde463140..c672009548f22 100644
--- a/fs/dlm/member.h
+++ b/fs/dlm/member.h
@@ -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);
diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c
index 719a5243a0693..daffc8df61e76 100644
--- a/fs/dlm/requestqueue.c
+++ b/fs/dlm/requestqueue.c
@@ -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)
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index 51daf4acbe318..988584c49953a 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -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)
diff --git a/fs/dlm/user.h b/fs/dlm/user.h
index 2caf8e6e24d51..f7e6d1054492d 100644
--- a/fs/dlm/user.h
+++ b/fs/dlm/user.h
@@ -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
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH vv6.19-rc6 7/7] dlm: use coniditon expression instead return scalars
  2026-01-20 15:35 [PATCH vv6.19-rc6 1/7] dlm: fix recovery pending middle conversion Alexander Aring
                   ` (4 preceding siblings ...)
  2026-01-20 15:35 ` [PATCH vv6.19-rc6 6/7] dlm: use bool for coniditonal expressions Alexander Aring
@ 2026-01-20 15:35 ` Alexander Aring
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2026-01-20 15:35 UTC (permalink / raw)
  To: teigland; +Cc: aahringo, gfs2

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

Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
 fs/dlm/lock.c         | 47 ++++++++++++-------------------------------
 fs/dlm/member.c       | 12 +++--------
 fs/dlm/requestqueue.c |  5 +----
 3 files changed, 17 insertions(+), 47 deletions(-)

diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 7ec30fbe33d92..d5bf194ae4f51 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -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
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index c34ddf726cb06..b670c4fc8f4c4 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -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,
diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c
index daffc8df61e76..ac18dd0c09df6 100644
--- a/fs/dlm/requestqueue.c
+++ b/fs/dlm/requestqueue.c
@@ -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)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-01-20 15:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20 15:35 [PATCH vv6.19-rc6 1/7] dlm: fix recovery pending middle conversion Alexander Aring
2026-01-20 15:35 ` [PATCH vv6.19-rc6 2/7] dlm: validate length in dlm_search_rsb_tree Alexander Aring
2026-01-20 15:35 ` [PATCH vv6.19-rc6 3/7] fs/dlm: use list_add_tail() instead of open-coding list insertion Alexander Aring
2026-01-20 15:35 ` [PATCH vv6.19-rc6 4/7] dlm: Constify struct configfs_item_operations and configfs_group_operations Alexander Aring
2026-01-20 15:35 ` [PATCH vv6.19-rc6 5/7] fs/dlm/dir: remove unuse variable count_match Alexander Aring
2026-01-20 15:35 ` [PATCH vv6.19-rc6 6/7] dlm: use bool for coniditonal expressions Alexander Aring
2026-01-20 15:35 ` [PATCH vv6.19-rc6 7/7] dlm: use coniditon expression instead return scalars Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox