[Cluster-devel] [RESEND dlm/next 02/16] fs: dlm: fix race between test_bit() and queue_work()

2022-08-15 Thread Alexander Aring
This patch will fix a race by surround ls_cb_mutex in set_bit() and the test_bit() and it's conditional code blocks for LSFL_CB_DELAY. The function dlm_callback_stop() has the idea to stop all callbacks and flush all currently queued onces. The set_bit() is not enough because there can be still qu

[Cluster-devel] [RESEND dlm/next 00/16] fs: dlm: fixes, cleanups and locktorture

2022-08-15 Thread Alexander Aring
Hi, this patch series contains fixes for lowcomms and -EBUSY handling. In lowcomms we have a race which could end in a use after free. The current validation of DLM API and between -EBUSY cases vs -EINVAL cases has a issue because -EINVAL is checked on first but reading variables which are only va

[Cluster-devel] [RESEND dlm/next 01/16] fs: dlm: fix race in lowcomms

2022-08-15 Thread Alexander Aring
This patch fixes a race between queue_work() in _dlm_lowcomms_commit_msg() and srcu_read_unlock(). The queue_work() can take the final reference of a dlm_msg and so msg->idx can contain garbage which is signaled by the following warning: [ 676.237050] [ cut here ] [ 676.2

[Cluster-devel] [RESEND dlm/next 13/16] fs: dlm: move DLM_LSFL_FS out of uapi

2022-08-15 Thread Alexander Aring
The DLM_LSFL_FS should be never part of the dlm lockspace uapi headers. If a user space dlm user is using this flag it's doing something wrong for user space flags. If their program doesn't compile anymore because this flag is missing we do a favour for them by signaling them there is a bug. Even t

[Cluster-devel] [RESEND dlm/next 09/16] fs: dlm: handle rcom in else if branch

2022-08-15 Thread Alexander Aring
Currently we handle in dlm_receive_buffer() everything else than a DLM_MSG type as DLM_RCOM message. Although a different message than DLM_MSG should be a DLM_RCOM we should explicit check on DLM_RCOM and drop a log_error() if we see something unexpected. Signed-off-by: Alexander Aring --- fs/dl

[Cluster-devel] [RESEND dlm/next 05/16] fs: dlm: use __func__ for function name

2022-08-15 Thread Alexander Aring
There are several times of using hard-coded function names inside the format string. When changing code checkpatch will drop a warning about this. This patch prepares to not dropping a checkpatch warning when introduce the same log message for a different loglevel by using __func__ instead of a har

[Cluster-devel] [RESEND dlm/next 11/16] fs: dlm: change ls_clear_proc_locks to spinlock

2022-08-15 Thread Alexander Aring
This patch changes the ls_clear_proc_locks to a spinlock because there is no need to handle it as a mutex as there is no sleepable context when ls_clear_proc_locks is held. This allows us to call those functionality in non-sleepable contexts. Signed-off-by: Alexander Aring --- fs/dlm/dlm_interna

[Cluster-devel] [RESEND dlm/next 06/16] fs: dlm: handle -EINVAL as log_error()

2022-08-15 Thread Alexander Aring
If the user generates a -EINVAL it's probably because the user using DLM wrong. To give the user notice about that wrong behaviour we should always print -EINVAL errors on the proper loglevel. In case of other errors like -EBUSY it will be still printed on debug loglevel as the current API handles

[Cluster-devel] [RESEND dlm/next 07/16] fs: dlm: fix invalid derefence of sb_lvbptr

2022-08-15 Thread Alexander Aring
I experience issues when putting a lkbsb on the stack and have sb_lvbptr field to a dangled pointer while not using DLM_LKF_VALBLK. It will crash with the following kernel message, the dangled pointer is here 0xdeadbeef as example: [ 102.749317] BUG: unable to handle page fault for address: 0

[Cluster-devel] [RESEND dlm/next 16/16] fs: dlm: initial commit of locktorture

2022-08-15 Thread Alexander Aring
This patch will introduce a locktorture test for DLM subsystem. The idea is to have a torture test to proof some performance indication for DLM. This torture test will allocate for each lock task a DLM lock and try to acquire the lock as much as it can. In a homogeneous cluster (all nodes have equa

[Cluster-devel] [RESEND dlm/next 08/16] fs: dlm: allow lockspaces have zero lvblen

2022-08-15 Thread Alexander Aring
A dlm user can never use DLM_LKF_VALBLK flag with DLM API calls so a zero lvblen should be allowed as per lockspace parameter. Signed-off-by: Alexander Aring --- fs/dlm/lockspace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 3

[Cluster-devel] [RESEND dlm/next 12/16] fs: dlm: trace user space callbacks

2022-08-15 Thread Alexander Aring
This patch adds trace callbacks for user locks. Unfortenately user locks are handled in a different way than kernel locks in some cases. User locks never call the dlm_lock()/dlm_unlock() kernel API and use the next step internal API of dlm. Adding those traces from user API callers should make it p

[Cluster-devel] [RESEND dlm/next 10/16] fs: dlm: remove dlm_del_ast prototype

2022-08-15 Thread Alexander Aring
This patch removes dlm_del_ast() prototype which is not being used in the dlm subsystem because there is not implementation for it. Signed-off-by: Alexander Aring --- fs/dlm/ast.h | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/dlm/ast.h b/fs/dlm/ast.h index 181ad7d20c4d..e5e05fcc5813 1006

[Cluster-devel] [RESEND dlm/next 14/16] fs: dlm: LSFL_CB_DELAY only for kernel lockspaces

2022-08-15 Thread Alexander Aring
This patch only set/clear the LSFL_CB_DELAY bit when it's actually a kernel lockspace signaled by if ls->ls_callback_wq is set or not set in this case. User lockspaces will never evaluate this flag. Signed-off-by: Alexander Aring --- fs/dlm/ast.c | 13 +++-- 1 file changed, 7 insertions(

[Cluster-devel] [RESEND dlm/next 15/16] fs: dlm: const void resource name parameter

2022-08-15 Thread Alexander Aring
The resource name parameter should never be changed by DLM so we declare it as const. At some point it is handled as a char pointer, a resource name can be a non printable ascii string as well. This patch change it to handle it as void pointer as it is offered by DLM API. Signed-off-by: Alexander

[Cluster-devel] [RESEND dlm/next 04/16] fs: dlm: handle -EBUSY as first for unlock validation

2022-08-15 Thread Alexander Aring
This patch checks on -EBUSY for dlm_unlock() for non CANCEL or FORCEUNLOCK case validation at first. Similar like it's done for dlm_lock(). Although the current way looks okay we should anyway moving the -EBUSY check at first after doing a check on -EINVAL regarding to the lkb state. If new -EINVAL

[Cluster-devel] [RESEND dlm/next 03/16] fs: dlm: handle -EBUSY as first for lock validation

2022-08-15 Thread Alexander Aring
In case of lock args validation we should at first check on -EBUSY then on -EINVAL. The -EINVAL conditions checks against lkb state variables which are not stable in case something is in -EBUSY lkb condition state e.g. lkb->lkb_grmode. This patch checks at first if -EBUSY condition is not met, then

[Cluster-devel] [PATCH dlm-tool 4/4] controld: remove timewarn handling

2022-08-15 Thread Alexander Aring
The netlink implementation is actually not build and the timewarn setting in controld would only activate some debugging warning if some lock requests got stucked without any other notification mechanism e.g. netlink. We remove this handling now because the dlm kernel implementation deprecates this

[Cluster-devel] [PATCH dlm-tool 1/4] python: use force=2 as default

2022-08-15 Thread Alexander Aring
To avoid -EBUSY cases we should use 2 as default for force when releasing the lockspace. --- python/bindings/dlm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/bindings/dlm.py b/python/bindings/dlm.py index b77d374c..b592a3e4 100644 --- a/python/bindings/dlm.py +++ b

[Cluster-devel] [PATCH dlm-tool 2/4] libdlm: force timeout parameter to zero

2022-08-15 Thread Alexander Aring
This patch forces to disable the timeout parameter for libdlm users as this feature is now deprecated and we will just unset it even if the user sets it to a value. --- libdlm/libdlm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libdlm/libdlm.c b/libdlm/libdlm.c index ebfba457..fbdf9a09 1

[Cluster-devel] [PATCH dlm-tool 3/4] libdlm: force unset the DLM_LSFL_TIMEWARN flag

2022-08-15 Thread Alexander Aring
This patch forces to disable the DLM_LSFL_TIMEWARN flag for libdlm users as this feature is now deprecated and we will just unset it even if the user sets it. --- libdlm/libdlm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libdlm/libdlm.c b/libdlm/libdlm.c index fbdf9a09..c5e78616 100644 -