From: Alexander Aring <aahringo@redhat.com>
To: teigland@redhat.com
Cc: gfs2@lists.linux.dev, aahringo@redhat.com
Subject: [PATCH v6.13-rc1 4/5] dlm: make sense out of force values
Date: Mon, 2 Dec 2024 10:26:40 -0500 [thread overview]
Message-ID: <20241202152641.3395369-4-aahringo@redhat.com> (raw)
In-Reply-To: <20241202152641.3395369-1-aahringo@redhat.com>
Currently users e.g. gfs2 calling lockspace_busy() with 2 which seems
not to be specified but it is specified as the rest of force value
meanings besides 0 and 1 which means: do check nothing. That makes no
sense as we can never introduce any new force value to have a specific
new meaning for it.
We just switch now to have 2 as meaning as do check on nothing and the
other values will return -EINVAL if somebody calls
dlm_release_lockspace() with them. This might break API but it totally
makes no sense to not use the other values of the force parameter.
All kernel users, gfs2 and md-cluster uses 2 as force parameter which
has the meaning: do check on nothing and let recovery deal with it.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/dlm/lockspace.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 8afac6e2dff0..1a216a8b6ca2 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -691,8 +691,10 @@ static int lockspace_busy(struct dlm_ls *ls, int force)
break;
}
}
- } else {
+ } else if (force == 2) {
rv = 0;
+ } else {
+ rv = -EINVAL;
}
read_unlock_bh(&ls->ls_lkbxa_lock);
return rv;
@@ -703,6 +705,8 @@ static int release_lockspace(struct dlm_ls *ls, int force)
int busy, rv;
busy = lockspace_busy(ls, force);
+ if (busy < 0)
+ return busy;
spin_lock_bh(&lslist_lock);
if (ls->ls_create_count == 1) {
@@ -730,7 +734,7 @@ static int release_lockspace(struct dlm_ls *ls, int force)
dlm_device_deregister(ls);
- if (force < 3 && dlm_user_daemon_available())
+ if (dlm_user_daemon_available())
do_uevent(ls, 0);
dlm_recoverd_stop(ls);
--
2.43.0
next prev parent reply other threads:[~2024-12-02 15:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 15:26 [PATCH v6.13-rc1 1/5] dlm: fix srcu_read_lock() return type to int Alexander Aring
2024-12-02 15:26 ` [PATCH v6.13-rc1 2/5] dlm: fix missing rsb put on scan timer Alexander Aring
2024-12-02 15:26 ` [PATCH v6.13-rc1 3/5] dlm: add more sanity checks related " Alexander Aring
2024-12-02 15:26 ` Alexander Aring [this message]
2024-12-02 15:26 ` [PATCH v6.13-rc1 5/5] dlm: return -ENOENT if no comm was found 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=20241202152641.3395369-4-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