fs: dlm: allow lockspaces have zero lvblen
Subsystems (2)
Alexander Aring
maintainerPATCH 1/3 fs: dlm: allow lockspaces have zero lvblen
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.
--- fs/dlm/lockspace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dlm/lockspace.c +1 -1
@@ -416,7 +416,7 @@ static int new_lockspace(const char *name, const char *cluster,if (namelen >DLM_LOCKSPACE_LEN || namelen ==0 )return -EINVAL ; -if (!lvblen || (lvblen %8 )) +if (lvblen %8 )return -EINVAL ;if (!try_module_get (THIS_MODULE ))
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH 2/3 fs: dlm: const void resource name parameter
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.
--- fs/dlm/lock.c | 23 +++++++++++++---------- fs/dlm/lock.h | 2 +- include/linux/dlm.h | 2 +- include/trace/events/dlm.h | 4 ++-- 4 files changed, 17 insertions(+), 14 deletions(-)
fs/dlm/lock.c +13 -10
@@ -401,7 +401,7 @@ static int pre_rsb_struct(struct dlm_ls *ls)unlock any spinlocks, go back and call pre_rsb_struct again. Otherwise, take an rsb off the list and return it. */ -static int get_rsb_struct (struct dlm_ls *ls,char *name,int len, +static int get_rsb_struct (struct dlm_ls *ls,const void *name,int len,struct dlm_rsb **r_ret) {struct dlm_rsb *r;
@@ -412,7 +412,8 @@ static int get_rsb_struct(struct dlm_ls *ls, char *name, int len, count = ls->ls_new_rsb_count;spin_unlock (&ls->ls_new_rsb_spin);log_debug (ls,"find_rsb retry %d %d %s" , - count, dlm_config.ci_new_rsb_count, name); + count, dlm_config.ci_new_rsb_count, + (const char *)name);return -EAGAIN ; }
@@ -448,7 +449,7 @@ static int rsb_cmp(struct dlm_rsb *r, const char *name, int nlen)return memcmp (r->res_name, maxname,DLM_RESNAME_MAXLEN ); } -int dlm_search_rsb_tree (struct rb_root *tree,char *name,int len, +int dlm_search_rsb_tree (struct rb_root *tree,const void *name,int len,struct dlm_rsb **r_ret) {struct rb_node *node = tree->rb_node;
@@ -546,7 +547,7 @@ static int rsb_insert(struct dlm_rsb *rsb, struct rb_root *tree)* while that rsb has a potentially stale master.) */ -static int find_rsb_dir (struct dlm_ls *ls,char *name,int len, +static int find_rsb_dir (struct dlm_ls *ls,const void *name,int len,uint32_t hash,uint32_t b,int dir_nodeid,int from_nodeid,unsigned int flags,struct dlm_rsb **r_ret)
@@ -724,7 +725,7 @@ static int find_rsb_dir(struct dlm_ls *ls, char *name, int len,dlm_recover_locks) before we've made ourself master (in dlm_recover_masters). */ -static int find_rsb_nodir (struct dlm_ls *ls,char *name,int len, +static int find_rsb_nodir (struct dlm_ls *ls,const void *name,int len,uint32_t hash,uint32_t b,int dir_nodeid,int from_nodeid,unsigned int flags,struct dlm_rsb **r_ret)
@@ -818,8 +819,9 @@ static int find_rsb_nodir(struct dlm_ls *ls, char *name, int len,return error; } -static int find_rsb (struct dlm_ls *ls,char *name,int len,int from_nodeid, -unsigned int flags,struct dlm_rsb **r_ret) +static int find_rsb (struct dlm_ls *ls,const void *name,int len, +int from_nodeid,unsigned int flags, +struct dlm_rsb **r_ret) {uint32_t hash, b;int dir_nodeid;
@@ -3316,8 +3318,9 @@ static int _cancel_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)* request_lock(), convert_lock(), unlock_lock(), cancel_lock() */ -static int request_lock (struct dlm_ls *ls,struct dlm_lkb *lkb,char *name, -int len,struct dlm_args *args) +static int request_lock (struct dlm_ls *ls,struct dlm_lkb *lkb, +const void *name,int len, +struct dlm_args *args) {struct dlm_rsb *r;int error;
@@ -3416,7 +3419,7 @@ int dlm_lock(dlm_lockspace_t *lockspace,int mode, struct dlm_lksb *lksb, uint32_t flags, - void *name, + const void *name, unsigned int namelen, uint32_t parent_lkid, void (*ast) (void *astarg),
fs/dlm/lock.h +1 -1
@@ -36,7 +36,7 @@ static inline void dlm_adjust_timeouts(struct dlm_ls *ls) { }int dlm_master_lookup (struct dlm_ls *ls,int nodeid,char *name,int len,unsigned int flags,int *r_nodeid,int *result); -int dlm_search_rsb_tree (struct rb_root *tree,char *name,int len, +int dlm_search_rsb_tree (struct rb_root *tree,const void *name,int len,struct dlm_rsb **r_ret);void dlm_recover_purge (struct dlm_ls *ls);
include/linux/dlm.h +1 -1
@@ -131,7 +131,7 @@ int dlm_lock(dlm_lockspace_t *lockspace,int mode, struct dlm_lksb *lksb, uint32_t flags, - void *name, + const void *name, unsigned int namelen, uint32_t parent_lkid, void (*lockast) (void *astarg),
include/trace/events/dlm.h +2 -2
@@ -49,7 +49,7 @@/* note: we begin tracing dlm_lock_start() only if ls and lkb are found */ TRACE_EVENT(dlm_lock_start, - TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, void *name, + TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, const void *name, unsigned int namelen, int mode, __u32 flags), TP_ARGS(ls, lkb, name, namelen, mode, flags),
@@ -91,7 +91,7 @@ TRACE_EVENT(dlm_lock_start, TRACE_EVENT(dlm_lock_end, - TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, void *name, + TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, const void *name, unsigned int namelen, int mode, __u32 flags, int error, bool kernel_lock),
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH 3/3 fs: dlm: initial commit of locktorture
In reply to Alexander AringThis 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 equal hardware) other nodes will try to acquire those locks as well.
You can run it by "modprobe dlm_locktorture cluster=$CLUSTER_NAME", note that cluster is required to provide a cluster name for the cluster manager.
Currently there is only one simple lock operation which is to create a lock in NL state and switch to EX and NL with a little bit of delay in the middle to simulate lock contention. This locktorture module uses the locktorture API from the linux kernel to provide such functionality. However the lock ops are very different and currently handled as start/stop and a iteration of a "testing step" e.g. switch to EX and NL over some looping behaviour. In future we can add more test regarding different lock modes in dlm or pressure tests for functionality such as lock request cancellation functionality.
--- fs/dlm/Kconfig | 11 + fs/dlm/Makefile | 1 + fs/dlm/dlm_locktorture.c | 514 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 526 insertions(+) create mode 100644 fs/dlm/dlm_locktorture.c
fs/dlm/Kconfig +11 -0
@@ -25,3 +25,14 @@ config DLM_DEBUG Under the debugfs mount point, the name of each lockspace will appear as a file in the "dlm" directory. The output is the list of resource and locks the local node knows about. + +config DLM_LOCKTORTURE + tristate "DLM locktorture" + depends on DLM && m + select TORTURE_TEST + help + This options provides a kernel module that runs torture tests on + the DLM subsystem. If loaded on a homogeneous cluster setup (e.g. + all cluster nodes have the same architecture) it will run + concurrent lock and unlock procedures. The printed stats will show + how many lock acquire were possible.
fs/dlm/Makefile +1 -0
@@ -19,4 +19,5 @@ dlm-y := ast.o \ util.o dlm-$(CONFIG_DLM_DEPRECATED_API) += netlink.o dlm-$(CONFIG_DLM_DEBUG) += debug_fs.o +obj-$(CONFIG_DLM_LOCKTORTURE) += dlm_locktorture.o
fs/dlm/dlm_locktorture.c new file +514 -0
514 lines not on this page · raw message
Signature · 1 line
2.31.1