From: Alexander Aring <aahringo@redhat.com>
To: teigland@redhat.com
Cc: gfs2@lists.linux.dev, aahringo@redhat.com
Subject: [PATCH v6.10-rc1 05/11] dlm: rename dlm_find_lockspace_local to dlm_get_lockspace
Date: Tue, 28 May 2024 17:12:35 -0400 [thread overview]
Message-ID: <20240528211241.2140441-5-aahringo@redhat.com> (raw)
In-Reply-To: <20240528211241.2140441-1-aahringo@redhat.com>
Previous patch got rid of the unnecessary loop to lookup the lockspace
pointer but the pointer to lookup was already the pointer that was
looking for. The purpose of dlm_find_lockspace_local() is more a
dlm_get_lockspace() to avoid lockspace releases. There is another
question if dlm_get_lockspace() is really necessary to call as it is
called in a lockspace resource itself and during this time the lockspace
cannot be freed as it is used by e.g. udev. Another questionable current
handling is refcounting when calling dlm api that might be an DLM user
problem because calling dlm_lockspace_release() when there are still
pending API calls around. However this might need more of a full code
review in future to remove some of them.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
---
fs/dlm/lock.c | 4 ++--
fs/dlm/lockspace.c | 8 ++++----
fs/dlm/lockspace.h | 2 +-
fs/dlm/plock.c | 8 ++++----
fs/dlm/recoverd.c | 4 ++--
fs/dlm/user.c | 12 ++++++------
6 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index e66972ed97b1..205d6a20fcee 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -3391,7 +3391,7 @@ int dlm_lock(dlm_lockspace_t *lockspace,
struct dlm_args args;
int error, convert = flags & DLM_LKF_CONVERT;
- ls = dlm_find_lockspace_local(lockspace);
+ ls = dlm_get_lockspace(lockspace);
if (!ls)
return -EINVAL;
@@ -3443,7 +3443,7 @@ int dlm_unlock(dlm_lockspace_t *lockspace,
struct dlm_args args;
int error;
- ls = dlm_find_lockspace_local(lockspace);
+ ls = dlm_get_lockspace(lockspace);
if (!ls)
return -EINVAL;
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 8155d7475c79..d25a09d6c710 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -38,7 +38,7 @@ static ssize_t dlm_control_store(struct dlm_ls *ls, const char *buf, size_t len)
if (rc)
return rc;
- ls = dlm_find_lockspace_local(ls);
+ ls = dlm_get_lockspace(ls);
if (!ls)
return -EINVAL;
@@ -263,7 +263,7 @@ struct dlm_ls *dlm_find_lockspace_global(uint32_t id)
return ls;
}
-struct dlm_ls *dlm_find_lockspace_local(dlm_lockspace_t *lockspace)
+struct dlm_ls *dlm_get_lockspace(dlm_lockspace_t *lockspace)
{
struct dlm_ls *ls = lockspace;
@@ -794,12 +794,12 @@ static int release_lockspace(struct dlm_ls *ls, int force)
* 3 - destroy lockspace as part of a forced shutdown
*/
-int dlm_release_lockspace(void *lockspace, int force)
+int dlm_release_lockspace(dlm_lockspace_t *lockspace, int force)
{
struct dlm_ls *ls;
int error;
- ls = dlm_find_lockspace_local(lockspace);
+ ls = dlm_get_lockspace(lockspace);
if (!ls)
return -EINVAL;
dlm_put_lockspace(ls);
diff --git a/fs/dlm/lockspace.h b/fs/dlm/lockspace.h
index 47ebd4411926..d59ce3fea03b 100644
--- a/fs/dlm/lockspace.h
+++ b/fs/dlm/lockspace.h
@@ -23,7 +23,7 @@
int dlm_lockspace_init(void);
void dlm_lockspace_exit(void);
struct dlm_ls *dlm_find_lockspace_global(uint32_t id);
-struct dlm_ls *dlm_find_lockspace_local(void *id);
+struct dlm_ls *dlm_get_lockspace(dlm_lockspace_t *lockspace);
struct dlm_ls *dlm_find_lockspace_device(int minor);
void dlm_put_lockspace(struct dlm_ls *ls);
void dlm_stop_lockspaces(void);
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index 9ca83ef70ed1..1ff172718d59 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -127,7 +127,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
struct plock_op *op;
int rv;
- ls = dlm_find_lockspace_local(lockspace);
+ ls = dlm_get_lockspace(lockspace);
if (!ls)
return -EINVAL;
@@ -293,7 +293,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
int rv;
unsigned char saved_flags = fl->c.flc_flags;
- ls = dlm_find_lockspace_local(lockspace);
+ ls = dlm_get_lockspace(lockspace);
if (!ls)
return -EINVAL;
@@ -370,7 +370,7 @@ int dlm_posix_cancel(dlm_lockspace_t *lockspace, u64 number, struct file *file,
if (WARN_ON_ONCE(!fl->fl_lmops || !fl->fl_lmops->lm_grant))
return -EOPNOTSUPP;
- ls = dlm_find_lockspace_local(lockspace);
+ ls = dlm_get_lockspace(lockspace);
if (!ls)
return -EINVAL;
@@ -426,7 +426,7 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
struct plock_op *op;
int rv;
- ls = dlm_find_lockspace_local(lockspace);
+ ls = dlm_get_lockspace(lockspace);
if (!ls)
return -EINVAL;
diff --git a/fs/dlm/recoverd.c b/fs/dlm/recoverd.c
index 17a40d1e6036..7e6c2c27d815 100644
--- a/fs/dlm/recoverd.c
+++ b/fs/dlm/recoverd.c
@@ -389,9 +389,9 @@ static void do_ls_recovery(struct dlm_ls *ls)
static int dlm_recoverd(void *arg)
{
- struct dlm_ls *ls;
+ struct dlm_ls *ls = arg;
- ls = dlm_find_lockspace_local(arg);
+ ls = dlm_get_lockspace(arg);
if (!ls) {
log_print("dlm_recoverd: no lockspace %p", arg);
return -1;
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index f6635a5314f4..73d7fa768f73 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -259,7 +259,7 @@ static int device_user_lock(struct dlm_user_proc *proc,
uint32_t lkid;
int error = -ENOMEM;
- ls = dlm_find_lockspace_local(proc->lockspace);
+ ls = dlm_get_lockspace(proc->lockspace);
if (!ls)
return -ENOENT;
@@ -309,7 +309,7 @@ static int device_user_unlock(struct dlm_user_proc *proc,
struct dlm_user_args *ua;
int error = -ENOMEM;
- ls = dlm_find_lockspace_local(proc->lockspace);
+ ls = dlm_get_lockspace(proc->lockspace);
if (!ls)
return -ENOENT;
@@ -337,7 +337,7 @@ static int device_user_deadlock(struct dlm_user_proc *proc,
struct dlm_ls *ls;
int error;
- ls = dlm_find_lockspace_local(proc->lockspace);
+ ls = dlm_get_lockspace(proc->lockspace);
if (!ls)
return -ENOENT;
@@ -398,7 +398,7 @@ static int device_user_purge(struct dlm_user_proc *proc,
struct dlm_ls *ls;
int error;
- ls = dlm_find_lockspace_local(proc->lockspace);
+ ls = dlm_get_lockspace(proc->lockspace);
if (!ls)
return -ENOENT;
@@ -423,7 +423,7 @@ static int device_create_lockspace(struct dlm_lspace_params *params)
if (error)
return error;
- ls = dlm_find_lockspace_local(lockspace);
+ ls = dlm_get_lockspace(lockspace);
if (!ls)
return -ENOENT;
@@ -674,7 +674,7 @@ static int device_close(struct inode *inode, struct file *file)
struct dlm_user_proc *proc = file->private_data;
struct dlm_ls *ls;
- ls = dlm_find_lockspace_local(proc->lockspace);
+ ls = dlm_get_lockspace(proc->lockspace);
if (!ls)
return -ENOENT;
--
2.43.0
next prev parent reply other threads:[~2024-05-28 21:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 21:12 [PATCH v6.10-rc1 01/11] dlm: remove scand leftovers Alexander Aring
2024-05-28 21:12 ` [PATCH v6.10-rc1 02/11] dlm: don't kref_init rsbs created for toss list Alexander Aring
2024-05-28 21:12 ` [PATCH v6.10-rc1 03/11] dlm: remove unused parameter in dlm_midcomms_addr Alexander Aring
2024-05-28 21:12 ` [PATCH v6.10-rc1 04/11] dlm: remove ls_local_handle from struct dlm_ls Alexander Aring
2024-05-28 21:12 ` Alexander Aring [this message]
2024-05-28 21:12 ` [PATCH v6.10-rc1 06/11] dlm: drop own rsb pre allocation mechanism Alexander Aring
2024-05-28 21:12 ` [PATCH v6.10-rc1 07/11] dlm: using rcu to avoid rsb lookup again Alexander Aring
2024-05-28 21:12 ` [PATCH v6.10-rc1 08/11] dlm: move lkb idr to xarray datastructure Alexander Aring
2024-05-28 21:12 ` [PATCH v6.10-rc1 09/11] dlm: move recover " Alexander Aring
2024-05-28 21:12 ` [PATCH v6.10-rc1 10/11] dlm: merge nodeid field to master_nodeid Alexander Aring
2024-05-28 21:12 ` [PATCH v6.10-rc1 11/11] dlm: use is_master() where it's prossible 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=20240528211241.2140441-5-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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).