fs: dlm: prepare for deprecate DLM API
Alexander Aring
maintainercover fs: dlm: prepare for deprecate DLM API
Hi,
This patch series deprecates some dlm API which will be removed in later Linux kernel releases (aim v5.22). Distribution should switch to CONFIG_DLM_DEPRECATED_API to N. Upcoming patches for libdlm will disable to use any of the deprecated API even if user sets it.
The reason to deprecate some API is that it's either not useful anymore or it makes probably some problems if it's getting used.
It's a little bit an ifdef-hell right now but it marks certain areas which will be removed in v5.22 (except the additional changes in the UAPI header).
- Alex
Alexander Aring (5):
fs: dlm: add comment about lkb IFL flags
fs: dlm: remove warn waiter handling
fs: dlm: remove timeout from dlm_user_adopt_orphan
fs: dlm: add API deprecation warning
fs: dlm: don't use deprecated API by default
fs/dlm/Kconfig | 9 +++ fs/dlm/Makefile | 2 +- fs/dlm/config.c | 21 ++++--- fs/dlm/config.h | 3 +- fs/dlm/dlm_internal.h | 27 ++++++++- fs/dlm/lock.c | 131 ++++++++++++++++-------------------------- fs/dlm/lock.h | 9 ++- fs/dlm/lockspace.c | 22 ++++++- fs/dlm/netlink.c | 8 +++ fs/dlm/user.c | 21 ++++++- 10 files changed, 156 insertions(+), 97 deletions(-)
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH 1/5 fs: dlm: add comment about lkb IFL flags
This patch adds comments about the difference between the lower 2 bytes of lkb flags and the 2 upper bytes of the lkb IFL flags. In short the upper 2 bytes will be handled as internal flags whereas the lower 2 bytes are part of the DLM protocol and are used to exchange messages.
--- fs/dlm/dlm_internal.h | 7 +++++++ 1 file changed, 7 insertions(+)
fs/dlm/dlm_internal.h +7 -0
@@ -207,6 +207,13 @@ struct dlm_args {#define DLM_IFL_TIMEOUT_CANCEL 0x00800000#define DLM_IFL_DEADLOCK_CANCEL 0x01000000#define DLM_IFL_STUB_MS 0x02000000/* magic number for m_flags */ +/* least significant 2 bytes are message changed, they are full transmitted +* but at receive side only the 2 bytes LSB will be set. +* +* Even wireshark dlm dissector does only evaluate the lower bytes and note +* that they may not be used on transceiver side, we assume the higher bytes +* are for internal use or reserved so long they are parsed on receiver side. +*/ #define DLM_IFL_USER 0x00000001#define DLM_IFL_ORPHAN 0x00000002
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH 1/5 fs: dlm: add comment about lkb IFL flags
Hi,
Quoted 16 lines · Alexander Aring
This patch adds comments about the difference between the lower 2 bytes of lkb flags and the 2 upper bytes of the lkb IFL flags. In short the upper 2 bytes will be handled as internal flags whereas the lower 2 bytes are part of the DLM protocol and are used to exchange messages.
Signed-off-by Alexander Aring <[email protected]>--- fs/dlm/dlm_internal.h | 7 +++++++ 1 file changed, 7 insertions(+)fs/dlm/dlm_internal.h +0
-0
fs/dlm/dlm_internal.h struct dlm_args { · line 215
Quoted 9 lines
fs/dlm/dlm_internal.h +6
-0@@ -207,6 +207,13 @@ struct dlm_args {#define DLM_IFL_TIMEOUT_CANCEL 0x00800000#define DLM_IFL_DEADLOCK_CANCEL 0x01000000#define DLM_IFL_STUB_MS 0x02000000/* magic number for m_flags */ +/* least significant 2 bytes are message changed, they are full transmitted +* but at receive side only the 2 bytes LSB will be set. +* +* Even wireshark dlm dissector does only evaluate the lower bytes and note +* that they may not be used on transceiver side, we assume the higher bytes +* are for internal use or reserved so long they are parsed on receiver side.
not parsed*
- Alex
Alexander Aring
maintainerPATCH 2/5 fs: dlm: remove warn waiter handling
In reply to Alexander AringThis patch removes a feature in DLM to warn about if we don't get an answer back if we send a DLM message out and we wait for a reply message. There are in my opinion two reasons to add such warning, first is to know there might be a communication error and a message drop due communication errors. Second the other side dropped the message on stack because some reason.
However the first reason the midcomms layer will notify us if a message was received otherwise midcomms debugfs can tell us if there are still pending messages around.
For the second reason we can check the other nodes debug messages to see if there was a drop on application layer. However I think the initial idea of this feature was to check for the first reason.
This patch also removes the configfs entry waitwarn_us which is not being set by official dlm user space software, we assume fail to setting this configfs entry will not end in an critical error.
--- fs/dlm/config.c | 7 ---- fs/dlm/config.h | 1 - fs/dlm/dlm_internal.h | 1 - fs/dlm/lock.c | 80 ------------------------------------------- fs/dlm/lockspace.c | 1 - 5 files changed, 90 deletions(-)
fs/dlm/config.c +0 -7
@@ -76,7 +76,6 @@ struct dlm_cluster {unsigned int cl_protocol;unsigned int cl_mark;unsigned int cl_timewarn_cs; -unsigned int cl_waitwarn_us;unsigned int cl_new_rsb_count;unsigned int cl_recover_callbacks;char cl_cluster_name[DLM_LOCKSPACE_LEN ];
@@ -103,7 +102,6 @@ enum {CLUSTER_ATTR_PROTOCOL ,CLUSTER_ATTR_MARK ,CLUSTER_ATTR_TIMEWARN_CS , -CLUSTER_ATTR_WAITWARN_US ,CLUSTER_ATTR_NEW_RSB_COUNT ,CLUSTER_ATTR_RECOVER_CALLBACKS , CLUSTER_ATTR_CLUSTER_NAME,
@@ -225,7 +223,6 @@ CLUSTER_ATTR(log_info, NULL);CLUSTER_ATTR (protocol, dlm_check_protocol_and_dlm_running);CLUSTER_ATTR (mark,NULL );CLUSTER_ATTR (timewarn_cs, dlm_check_zero); -CLUSTER_ATTR (waitwarn_us,NULL );CLUSTER_ATTR (new_rsb_count,NULL );CLUSTER_ATTR (recover_callbacks,NULL );
@@ -241,7 +238,6 @@ static struct configfs_attribute *cluster_attrs[] = { [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol, [CLUSTER_ATTR_MARK] = &cluster_attr_mark, [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs, - [CLUSTER_ATTR_WAITWARN_US] = &cluster_attr_waitwarn_us, [CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count, [CLUSTER_ATTR_RECOVER_CALLBACKS] = &cluster_attr_recover_callbacks, [CLUSTER_ATTR_CLUSTER_NAME] = &cluster_attr_cluster_name,
@@ -433,7 +429,6 @@ static struct config_group *make_cluster(struct config_group *g, cl->cl_log_info = dlm_config.ci_log_info; cl->cl_protocol = dlm_config.ci_protocol; cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; - cl->cl_waitwarn_us = dlm_config.ci_waitwarn_us; cl->cl_new_rsb_count = dlm_config.ci_new_rsb_count; cl->cl_recover_callbacks = dlm_config.ci_recover_callbacks; memcpy(cl->cl_cluster_name, dlm_config.ci_cluster_name,
@@ -955,7 +950,6 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)#define DEFAULT_PROTOCOL DLM_PROTO_TCP#define DEFAULT_MARK 0#define DEFAULT_TIMEWARN_CS 500/* 5 sec = 500 centiseconds */ -#define DEFAULT_WAITWARN_US 0#define DEFAULT_NEW_RSB_COUNT 128#define DEFAULT_RECOVER_CALLBACKS 0#define DEFAULT_CLUSTER_NAME ""
@@ -972,7 +966,6 @@ struct dlm_config_info dlm_config = { .ci_protocol = DEFAULT_PROTOCOL, .ci_mark = DEFAULT_MARK, .ci_timewarn_cs = DEFAULT_TIMEWARN_CS, - .ci_waitwarn_us = DEFAULT_WAITWARN_US, .ci_new_rsb_count = DEFAULT_NEW_RSB_COUNT, .ci_recover_callbacks =DEFAULT_RECOVER_CALLBACKS , .ci_cluster_name = DEFAULT_CLUSTER_NAME
fs/dlm/config.h +0 -1
@@ -38,7 +38,6 @@ struct dlm_config_info {int ci_protocol;int ci_mark;int ci_timewarn_cs; -int ci_waitwarn_us;int ci_new_rsb_count;int ci_recover_callbacks;char ci_cluster_name[DLM_LOCKSPACE_LEN ];
fs/dlm/dlm_internal.h +0 -1
@@ -258,7 +258,6 @@ struct dlm_lkb {struct list_head lkb_ownqueue;/* list of locks for a process */ struct list_head lkb_time_list;ktime_t lkb_timestamp; -ktime_t lkb_wait_time;unsigned long lkb_timeout_cs;struct mutex lkb_cb_mutex;
fs/dlm/lock.c +0 -80
98 lines not on this page · raw message
fs/dlm/lockspace.c +0 -1
@@ -275,7 +275,6 @@ static int dlm_scand(void *data) ls->ls_scan_time = jiffies;dlm_scan_rsbs (ls);dlm_scan_timeout (ls); -dlm_scan_waiters (ls);dlm_unlock_recovery (ls); }else { ls->ls_scan_time +=HZ ;
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH 2/5 fs: dlm: remove warn waiter handling
Hi,
Quoted 128 lines · Alexander Aring
This patch removes a feature in DLM to warn about if we don't get an answer back if we send a DLM message out and we wait for a reply message. There are in my opinion two reasons to add such warning, first is to know there might be a communication error and a message drop due communication errors. Second the other side dropped the message on stack because some reason.
However the first reason the midcomms layer will notify us if a message was received otherwise midcomms debugfs can tell us if there are still pending messages around.
For the second reason we can check the other nodes debug messages to see if there was a drop on application layer. However I think the initial idea of this feature was to check for the first reason.
This patch also removes the configfs entry
waitwarn_uswhich is not being set by official dlm user space software, we assume fail to setting this configfs entry will not end in an critical error.Signed-off-by Alexander Aring <[email protected]>--- fs/dlm/config.c | 7 ---- fs/dlm/config.h | 1 - fs/dlm/dlm_internal.h | 1 - fs/dlm/lock.c | 80 ------------------------------------------- fs/dlm/lockspace.c | 1 - 5 files changed, 90 deletions(-)fs/dlm/config.c +0
-7@@ -76,7 +76,6 @@ struct dlm_cluster {unsigned int cl_protocol;unsigned int cl_mark;unsigned int cl_timewarn_cs; -unsigned int cl_waitwarn_us;unsigned int cl_new_rsb_count;unsigned int cl_recover_callbacks;char cl_cluster_name[DLM_LOCKSPACE_LEN ];@@ -103,7 +102,6 @@ enum {CLUSTER_ATTR_PROTOCOL ,CLUSTER_ATTR_MARK ,CLUSTER_ATTR_TIMEWARN_CS , -CLUSTER_ATTR_WAITWARN_US ,CLUSTER_ATTR_NEW_RSB_COUNT ,CLUSTER_ATTR_RECOVER_CALLBACKS , CLUSTER_ATTR_CLUSTER_NAME,@@ -225,7 +223,6 @@ CLUSTER_ATTR(log_info, NULL);CLUSTER_ATTR (protocol, dlm_check_protocol_and_dlm_running);CLUSTER_ATTR (mark,NULL );CLUSTER_ATTR (timewarn_cs, dlm_check_zero); -CLUSTER_ATTR (waitwarn_us,NULL );CLUSTER_ATTR (new_rsb_count,NULL );CLUSTER_ATTR (recover_callbacks,NULL );@@ -241,7 +238,6 @@ static struct configfs_attribute *cluster_attrs[] = { [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol, [CLUSTER_ATTR_MARK] = &cluster_attr_mark, [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs, - [CLUSTER_ATTR_WAITWARN_US] = &cluster_attr_waitwarn_us, [CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count, [CLUSTER_ATTR_RECOVER_CALLBACKS] = &cluster_attr_recover_callbacks, [CLUSTER_ATTR_CLUSTER_NAME] = &cluster_attr_cluster_name,@@ -433,7 +429,6 @@ static struct config_group *make_cluster(struct config_group *g, cl->cl_log_info = dlm_config.ci_log_info; cl->cl_protocol = dlm_config.ci_protocol; cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; - cl->cl_waitwarn_us = dlm_config.ci_waitwarn_us; cl->cl_new_rsb_count = dlm_config.ci_new_rsb_count; cl->cl_recover_callbacks = dlm_config.ci_recover_callbacks; memcpy(cl->cl_cluster_name, dlm_config.ci_cluster_name,@@ -955,7 +950,6 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)#define DEFAULT_PROTOCOL DLM_PROTO_TCP#define DEFAULT_MARK 0#define DEFAULT_TIMEWARN_CS 500/* 5 sec = 500 centiseconds */ -#define DEFAULT_WAITWARN_US 0#define DEFAULT_NEW_RSB_COUNT 128#define DEFAULT_RECOVER_CALLBACKS 0#define DEFAULT_CLUSTER_NAME ""@@ -972,7 +966,6 @@ struct dlm_config_info dlm_config = { .ci_protocol = DEFAULT_PROTOCOL, .ci_mark = DEFAULT_MARK, .ci_timewarn_cs = DEFAULT_TIMEWARN_CS, - .ci_waitwarn_us = DEFAULT_WAITWARN_US, .ci_new_rsb_count = DEFAULT_NEW_RSB_COUNT, .ci_recover_callbacks =DEFAULT_RECOVER_CALLBACKS , .ci_cluster_name = DEFAULT_CLUSTER_NAMEfs/dlm/config.h +0
-1@@ -38,7 +38,6 @@ struct dlm_config_info {int ci_protocol;int ci_mark;int ci_timewarn_cs; -int ci_waitwarn_us;int ci_new_rsb_count;int ci_recover_callbacks;char ci_cluster_name[DLM_LOCKSPACE_LEN ];fs/dlm/dlm_internal.h +0
-1@@ -258,7 +258,6 @@ struct dlm_lkb {struct list_head lkb_ownqueue;/* list of locks for a process */ struct list_head lkb_time_list;ktime_t lkb_timestamp; -ktime_t lkb_wait_time;unsigned long lkb_timeout_cs;struct mutex lkb_cb_mutex;fs/dlm/lock.c +0
-7@@ -1402,75 +1402,6 @@ static int msg_reply_type(int mstype)return -1 ; } -static int nodeid_warned (int nodeid,int num_nodes,int *warned) -{ -int i; - -for (i =0 ; i < num_nodes; i++) { -if (!warned[i]) { - warned[i] = nodeid;
fs/dlm/lock.c static int msg_reply_type(int mstype) · line 1421
Quoted 10 lines
fs/dlm/lock.c +0
-10-return 0 ; - } -if (warned[i] == nodeid) -return 1 ; - } -return 0 ; -} - -void dlm_scan_waiters (struct dlm_ls *ls) -{
there is probably a prototype which I need to remove as well... and I need to check the other patches...
- Alex
Alexander Aring
maintainerPATCH 3/5 fs: dlm: remove timeout from dlm_user_adopt_orphan
In reply to Alexander AringThis patch removes the timeout parameter from dlm_user_adopt_orphan(), it's never been used.
--- fs/dlm/lock.c | 2 +- fs/dlm/lock.h | 2 +- fs/dlm/user.c | 1 - 3 files changed, 2 insertions(+), 3 deletions(-)
fs/dlm/lock.c +1 -1
@@ -5886,7 +5886,7 @@ int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,int dlm_user_adopt_orphan (struct dlm_ls *ls,struct dlm_user_args *ua_tmp,int mode,uint32_t flags,void *name,unsigned int namelen, -unsigned long timeout_cs,uint32_t *lkid) +uint32_t *lkid) {struct dlm_lkb *lkb =NULL , *iter;struct dlm_user_args *ua;
fs/dlm/lock.h +1 -1
@@ -49,7 +49,7 @@ int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, unsigned long timeout_cs);int dlm_user_adopt_orphan (struct dlm_ls *ls,struct dlm_user_args *ua_tmp,int mode,uint32_t flags,void *name,unsigned int namelen, -unsigned long timeout_cs,uint32_t *lkid); +uint32_t *lkid);int dlm_user_unlock (struct dlm_ls *ls,struct dlm_user_args *ua_tmp,uint32_t flags,uint32_t lkid,char *lvb_in); int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
fs/dlm/user.c +0 -1
@@ -270,7 +270,6 @@ static int device_user_lock(struct dlm_user_proc *proc, error =dlm_user_adopt_orphan (ls, ua, params->mode, params->flags, params->name, params->namelen, - (unsigned long ) params->timeout, &lkid);if (!error) error = lkid;
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH 4/5 fs: dlm: add API deprecation warning
In reply to Alexander AringThis patch adds a deprecation config to DLM for API which will be removed in kernel v5.22. This deprecation warning will occur if somebody enables the deprecation API Kconfig entry and using the actual feature which will get deprecated as a notification to update their user space.
Note that the timeout feature for kernel locks was never been supported.
--- fs/dlm/Kconfig | 9 +++++++++ fs/dlm/lockspace.c | 11 ++++++++++- fs/dlm/netlink.c | 8 ++++++++ fs/dlm/user.c | 8 ++++++++ 4 files changed, 35 insertions(+), 1 deletion(-)
fs/dlm/Kconfig +9 -0
@@ -9,6 +9,15 @@ menuconfig DLM A general purpose distributed lock manager for kernel or userspace applications. +config DLM_DEPRECATED_API + bool "DLM deprecated API" + depends on DLM + help + Enables DLM deprecated API which will be removed in later Linux + kernel releases. + + If you are unsure, say N. + config DLM_DEBUG bool "DLM debugging" depends on DLM
fs/dlm/lockspace.c +10 -1
@@ -489,8 +489,17 @@ static int new_lockspace(const char *name, const char *cluster, ls->ls_ops_arg = ops_arg; } -if (flags &DLM_LSFL_TIMEWARN ) +if (flags &DLM_LSFL_TIMEWARN ) { +#ifdef CONFIG_DLM_DEPRECATED_API +pr_warn_once ("===============================================================\n" +"WARNING: the dlm DLM_LSFL_TIMEWARN flag is being deprecated and\n" +" will be removed in v5.22!\n" +" Inclusive DLM_LSFL_TIMEWARN define in UAPI header!\n" +"===============================================================\n" ); +#endif +set_bit (LSFL_TIMEWARN , &ls->ls_flags); + }/* ls_exflags are forced to match among nodes, and we don't need to require all nodes to have some flags set */
fs/dlm/netlink.c +8 -0
@@ -57,6 +57,14 @@ static int send_data(struct sk_buff *skb)static int user_cmd (struct sk_buff *skb,struct genl_info *info) { +#ifdef CONFIG_DLM_DEPRECATED_API +pr_warn_once ("====================================================\n" +"WARNING: the dlm netlink API is being deprecated and\n" +" will be removed in v5.22!\n" +" Inclusive DLM netlink UAPI header!\n" +"====================================================\n" ); +#endif + listener_nlportid = info->snd_portid;printk ("user_cmd nlpid %u\n" , listener_nlportid);return 0 ;
fs/dlm/user.c +8 -0
@@ -250,6 +250,14 @@ static int device_user_lock(struct dlm_user_proc *proc, goto out; } +#ifdef CONFIG_DLM_DEPRECATED_API +if (params->timeout) +pr_warn_once ("========================================================\n" +"WARNING: the lkb timeout feature is being deprecated and\n" +" will be removed in v5.22!\n" +"========================================================\n" ); +#endif + ua =kzalloc (sizeof (struct dlm_user_args ),GFP_NOFS );if (!ua) goto out;
Signature · 1 line
2.31.1
Alexander Aring
maintainerPATCH 5/5 fs: dlm: don't use deprecated API by default
In reply to Alexander AringThis patch will disable the usage of current deprecated API if CONFIG_DLM_DEPRECATED_API is not set. This API will be removed in upcoming kernel release v5.22. I marked some places with a ifdef around deprecated API, at other places I used a no-op function replacement, depending on the situation how it's used and what was simpler to implement.
This patch disables the configfs entry timewarn_cs which will be set by official dlm user space software but does not end in a critical error. We assume it should be save to remove it.
--- fs/dlm/Makefile | 2 +- fs/dlm/config.c | 14 +++++++++++++ fs/dlm/config.h | 2 ++ fs/dlm/dlm_internal.h | 19 ++++++++++++++++- fs/dlm/lock.c | 49 +++++++++++++++++++++++++++++++++++++++++++ fs/dlm/lock.h | 7 +++++++ fs/dlm/lockspace.c | 14 ++++++++++--- fs/dlm/user.c | 12 +++++++++++ 8 files changed, 114 insertions(+), 5 deletions(-)
fs/dlm/Makefile +1 -1
@@ -9,7 +9,6 @@ dlm-y := ast.o \ member.o \ memory.o \ midcomms.o \ - netlink.o \ lowcomms.o \ plock.o \ rcom.o \
@@ -18,5 +17,6 @@ dlm-y := ast.o \ requestqueue.o \ user.o \ util.o +dlm-$(CONFIG_DLM_DEPRECATED_API) += netlink.o dlm-$(CONFIG_DLM_DEBUG) += debug_fs.o
fs/dlm/config.c +14 -0
@@ -75,7 +75,9 @@ struct dlm_cluster {unsigned int cl_log_info;unsigned int cl_protocol;unsigned int cl_mark; +#ifdef CONFIG_DLM_DEPRECATED_API unsigned int cl_timewarn_cs; +#endif unsigned int cl_new_rsb_count;unsigned int cl_recover_callbacks;char cl_cluster_name[DLM_LOCKSPACE_LEN ];
@@ -101,7 +103,9 @@ enum {CLUSTER_ATTR_LOG_INFO ,CLUSTER_ATTR_PROTOCOL ,CLUSTER_ATTR_MARK , +#ifdef CONFIG_DLM_DEPRECATED_APICLUSTER_ATTR_TIMEWARN_CS , +#endifCLUSTER_ATTR_NEW_RSB_COUNT ,CLUSTER_ATTR_RECOVER_CALLBACKS , CLUSTER_ATTR_CLUSTER_NAME,
@@ -222,7 +226,9 @@ CLUSTER_ATTR(log_debug, NULL);CLUSTER_ATTR (log_info,NULL );CLUSTER_ATTR (protocol, dlm_check_protocol_and_dlm_running);CLUSTER_ATTR (mark,NULL ); +#ifdef CONFIG_DLM_DEPRECATED_API CLUSTER_ATTR (timewarn_cs, dlm_check_zero); +#endif CLUSTER_ATTR (new_rsb_count,NULL );CLUSTER_ATTR (recover_callbacks,NULL );
@@ -237,7 +243,9 @@ static struct configfs_attribute *cluster_attrs[] = { [CLUSTER_ATTR_LOG_INFO] = &cluster_attr_log_info, [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol, [CLUSTER_ATTR_MARK] = &cluster_attr_mark, +#ifdef CONFIG_DLM_DEPRECATED_API [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs, +#endif [CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count, [CLUSTER_ATTR_RECOVER_CALLBACKS] = &cluster_attr_recover_callbacks, [CLUSTER_ATTR_CLUSTER_NAME] = &cluster_attr_cluster_name,
@@ -428,7 +436,9 @@ static struct config_group *make_cluster(struct config_group *g, cl->cl_log_debug = dlm_config.ci_log_debug; cl->cl_log_info = dlm_config.ci_log_info; cl->cl_protocol = dlm_config.ci_protocol; +#ifdef CONFIG_DLM_DEPRECATED_API cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; +#endif cl->cl_new_rsb_count = dlm_config.ci_new_rsb_count; cl->cl_recover_callbacks = dlm_config.ci_recover_callbacks; memcpy(cl->cl_cluster_name, dlm_config.ci_cluster_name,
@@ -949,7 +959,9 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)#define DEFAULT_LOG_INFO 1#define DEFAULT_PROTOCOL DLM_PROTO_TCP#define DEFAULT_MARK 0 +#ifdef CONFIG_DLM_DEPRECATED_API #define DEFAULT_TIMEWARN_CS 500/* 5 sec = 500 centiseconds */ +#endif #define DEFAULT_NEW_RSB_COUNT 128#define DEFAULT_RECOVER_CALLBACKS 0#define DEFAULT_CLUSTER_NAME ""
@@ -965,7 +977,9 @@ struct dlm_config_info dlm_config = { .ci_log_info = DEFAULT_LOG_INFO, .ci_protocol = DEFAULT_PROTOCOL, .ci_mark =DEFAULT_MARK , +#ifdef CONFIG_DLM_DEPRECATED_API .ci_timewarn_cs = DEFAULT_TIMEWARN_CS, +#endif .ci_new_rsb_count =DEFAULT_NEW_RSB_COUNT , .ci_recover_callbacks = DEFAULT_RECOVER_CALLBACKS, .ci_cluster_name = DEFAULT_CLUSTER_NAME
fs/dlm/config.h +2 -0
@@ -37,7 +37,9 @@ struct dlm_config_info {int ci_log_info;int ci_protocol;int ci_mark; +#ifdef CONFIG_DLM_DEPRECATED_API int ci_timewarn_cs; +#endif int ci_new_rsb_count;int ci_recover_callbacks;char ci_cluster_name[DLM_LOCKSPACE_LEN ];
fs/dlm/dlm_internal.h +18 -1
@@ -145,7 +145,9 @@ struct dlm_args {void (*bastfn) (void *astparam,int mode);int mode;struct dlm_lksb *lksb; +#ifdef CONFIG_DLM_DEPRECATED_API unsigned long timeout; +#endif };
@@ -203,8 +205,10 @@ struct dlm_args {#define DLM_IFL_OVERLAP_UNLOCK 0x00080000#define DLM_IFL_OVERLAP_CANCEL 0x00100000#define DLM_IFL_ENDOFLIFE 0x00200000 +#ifdef CONFIG_DLM_DEPRECATED_API #define DLM_IFL_WATCH_TIMEWARN 0x00400000#define DLM_IFL_TIMEOUT_CANCEL 0x00800000 +#endif #define DLM_IFL_DEADLOCK_CANCEL 0x01000000#define DLM_IFL_STUB_MS 0x02000000/* magic number for m_flags */ /* least significant 2 bytes are message changed, they are full transmitted
@@ -256,9 +260,12 @@ struct dlm_lkb {struct list_head lkb_rsb_lookup;/* waiting for rsb lookup */ struct list_head lkb_wait_reply;/* waiting for remote reply */ struct list_head lkb_ownqueue;/* list of locks for a process */ -struct list_head lkb_time_list;ktime_t lkb_timestamp; + +#ifdef CONFIG_DLM_DEPRECATED_API +struct list_head lkb_time_list;unsigned long lkb_timeout_cs; +#endif struct mutex lkb_cb_mutex;struct work_struct lkb_cb_work;
@@ -574,8 +581,10 @@ struct dlm_ls {struct mutex ls_orphans_mutex;struct list_head ls_orphans; +#ifdef CONFIG_DLM_DEPRECATED_API struct mutex ls_timeout_mutex;struct list_head ls_timeout; +#endif spinlock_t ls_new_rsb_spin;int ls_new_rsb_count;
@@ -694,7 +703,9 @@ struct dlm_ls {#define LSFL_RCOM_READY 5#define LSFL_RCOM_WAIT 6#define LSFL_UEVENT_WAIT 7 +#ifdef CONFIG_DLM_DEPRECATED_API #define LSFL_TIMEWARN 8 +#endif #define LSFL_CB_DELAY 9#define LSFL_NODIR 10
@@ -747,9 +758,15 @@ static inline int dlm_no_directory(struct dlm_ls *ls)return test_bit (LSFL_NODIR , &ls->ls_flags); } +#ifdef CONFIG_DLM_DEPRECATED_API int dlm_netlink_init (void );void dlm_netlink_exit (void );void dlm_timeout_warn (struct dlm_lkb *lkb); +#else +static inline int dlm_netlink_init (void ) {return 0 ; } +static inline void dlm_netlink_exit (void ) { }; +static inline void dlm_timeout_warn (struct dlm_lkb *lkb) { }; +#endif int dlm_plock_init (void );void dlm_plock_exit (void );
fs/dlm/lock.c +49 -0
148 lines not on this page · raw message
fs/dlm/lock.h +7 -0
@@ -41,12 +41,19 @@ void dlm_recover_waiters_pre(struct dlm_ls *ls);int dlm_recover_master_copy (struct dlm_ls *ls,struct dlm_rcom *rc);int dlm_recover_process_copy (struct dlm_ls *ls,struct dlm_rcom *rc); +#ifdef CONFIG_DLM_DEPRECATED_API int dlm_user_request (struct dlm_ls *ls,struct dlm_user_args *ua,int mode,uint32_t flags,void *name,unsigned int namelen,unsigned long timeout_cs);int dlm_user_convert (struct dlm_ls *ls,struct dlm_user_args *ua_tmp,int mode,uint32_t flags,uint32_t lkid,char *lvb_in,unsigned long timeout_cs); +#else +int dlm_user_request (struct dlm_ls *ls,struct dlm_user_args *ua,int mode, +uint32_t flags,void *name,unsigned int namelen); +int dlm_user_convert (struct dlm_ls *ls,struct dlm_user_args *ua_tmp, +int mode,uint32_t flags,uint32_t lkid,char *lvb_in); +#endif int dlm_user_adopt_orphan (struct dlm_ls *ls,struct dlm_user_args *ua_tmp,int mode,uint32_t flags,void *name,unsigned int namelen,uint32_t *lkid);
fs/dlm/lockspace.c +11 -3
@@ -489,22 +489,28 @@ static int new_lockspace(const char *name, const char *cluster, ls->ls_ops_arg = ops_arg; } -if (flags &DLM_LSFL_TIMEWARN ) {#ifdef CONFIG_DLM_DEPRECATED_API +if (flags &DLM_LSFL_TIMEWARN ) {pr_warn_once ("===============================================================\n" "WARNING: the dlm DLM_LSFL_TIMEWARN flag is being deprecated and\n" " will be removed in v5.22!\n" " Inclusive DLM_LSFL_TIMEWARN define in UAPI header!\n" "===============================================================\n" ); -#endif set_bit (LSFL_TIMEWARN , &ls->ls_flags); }/* ls_exflags are forced to match among nodes, and we don't -need to require all nodes to have some flags set */ +* need to require all nodes to have some flags set +*/ ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN |DLM_LSFL_FS |DLM_LSFL_NEWEXCL )); +#else +/* ls_exflags are forced to match among nodes, and we don't +* need to require all nodes to have some flags set +*/ + ls->ls_exflags = (flags & ~(DLM_LSFL_FS |DLM_LSFL_NEWEXCL )); +#endif size =READ_ONCE (dlm_config.ci_rsbtbl_size); ls->ls_rsbtbl_size = size;
@@ -535,8 +541,10 @@ static int new_lockspace(const char *name, const char *cluster,mutex_init (&ls->ls_waiters_mutex);INIT_LIST_HEAD (&ls->ls_orphans);mutex_init (&ls->ls_orphans_mutex); +#ifdef CONFIG_DLM_DEPRECATED_API INIT_LIST_HEAD (&ls->ls_timeout);mutex_init (&ls->ls_timeout_mutex); +#endif INIT_LIST_HEAD (&ls->ls_new_rsb);spin_lock_init (&ls->ls_new_rsb_spin);
fs/dlm/user.c +12 -0
@@ -270,10 +270,16 @@ static int device_user_lock(struct dlm_user_proc *proc, ua->xid = params->xid;if (params->flags &DLM_LKF_CONVERT ) { +#ifdef CONFIG_DLM_DEPRECATED_API error =dlm_user_convert (ls, ua, params->mode, params->flags, params->lkid, params->lvb, (unsigned long ) params->timeout); +#else + error =dlm_user_convert (ls, ua, + params->mode, params->flags, + params->lkid, params->lvb); +#endif }else if (params->flags &DLM_LKF_ORPHAN ) { error = dlm_user_adopt_orphan(ls, ua, params->mode, params->flags,
@@ -282,10 +288,16 @@ static int device_user_lock(struct dlm_user_proc *proc,if (!error) error = lkid; }else { +#ifdef CONFIG_DLM_DEPRECATED_API error =dlm_user_request (ls, ua, params->mode, params->flags, params->name, params->namelen, (unsigned long ) params->timeout); +#else + error =dlm_user_request (ls, ua, + params->mode, params->flags, + params->name, params->namelen); +#endif if (!error) error = ua->lksb.sb_lkid; }
Signature · 1 line
2.31.1