From: Alexander Aring <aahringo@redhat.com>
To: teigland@redhat.com
Cc: gfs2@lists.linux.dev, aahringo@redhat.com
Subject: [PATCH dlm/next 2/3] dlm: add grmode sanity checks and debug info
Date: Mon, 4 Nov 2024 17:04:16 -0500 [thread overview]
Message-ID: <20241104220417.3883898-2-aahringo@redhat.com> (raw)
In-Reply-To: <20241104220417.3883898-1-aahringo@redhat.com>
We had earlier issues regarding to look for invalid cases when DLM
conversions were called in a invalid lkb state or if recovery handling
set lkb states. Cover those cases and let the user warn them about that
we were running into those. While on it add more debugging information
for the kernel logger when we run into those cases if rqmode or grmode
is in some invalid state.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/dlm/lock.c | 15 +++++++++++----
fs/dlm/recover.c | 2 ++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 966a926c301b..b883bb94e3e8 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -2830,6 +2830,11 @@ static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb,
if (test_bit(DLM_IFL_MSTCPY_BIT, &lkb->lkb_iflags))
goto out;
+ /* sanity check to do a conversion on a invalid lkb state */
+ if (lkb->lkb_grmode == DLM_LOCK_IV ||
+ lkb->lkb_status != DLM_LKSTS_GRANTED)
+ goto out;
+
if (args->flags & DLM_LKF_QUECVT &&
!__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1])
goto out;
@@ -2852,14 +2857,16 @@ static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb,
case -EINVAL:
/* annoy the user because dlm usage is wrong */
WARN_ON(1);
- log_error(ls, "%s %d %x %x %x %d %d", __func__,
+ log_error(ls, "%s %d %x %x %x %d %d %d %d", __func__,
rv, lkb->lkb_id, dlm_iflags_val(lkb), args->flags,
- lkb->lkb_status, lkb->lkb_wait_type);
+ lkb->lkb_status, lkb->lkb_wait_type,
+ lkb->lkb_rqmode, lkb->lkb_grmode);
break;
default:
- log_debug(ls, "%s %d %x %x %x %d %d", __func__,
+ log_debug(ls, "%s %d %x %x %x %d %d %d %d", __func__,
rv, lkb->lkb_id, dlm_iflags_val(lkb), args->flags,
- lkb->lkb_status, lkb->lkb_wait_type);
+ lkb->lkb_status, lkb->lkb_wait_type,
+ lkb->lkb_rqmode, lkb->lkb_grmode);
break;
}
diff --git a/fs/dlm/recover.c b/fs/dlm/recover.c
index 7f748b21f1fb..011153fcb84f 100644
--- a/fs/dlm/recover.c
+++ b/fs/dlm/recover.c
@@ -855,6 +855,8 @@ static void recover_conversion(struct dlm_rsb *r)
log_debug(ls, "%s %x set gr to rq %d", __func__,
lkb->lkb_id, lkb->lkb_rqmode);
} else {
+ WARN_ON(grmode == lkb->lkb_rqmode);
+
log_debug(ls, "%s %x set gr %d", __func__,
lkb->lkb_id, grmode);
lkb->lkb_grmode = grmode;
--
2.43.0
next prev parent reply other threads:[~2024-11-04 22:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 22:04 [PATCH dlm/next 1/3] dlm: fix recover_conversion() if grmode is unknown Alexander Aring
2024-11-04 22:04 ` Alexander Aring [this message]
2024-11-04 22:04 ` [PATCH dlm/next 3/3] dlm: log_limit() recover_conversion() handling Alexander Aring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241104220417.3883898-2-aahringo@redhat.com \
--to=aahringo@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=teigland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox