Commit 6b0afc0c authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

fs: dlm: don't use deprecated timeout features by default

This patch will disable use of deprecated timeout features if
CONFIG_DLM_DEPRECATED_API is not set.  The deprecated features
will be removed in upcoming kernel release v6.2.
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 81eeb82f
...@@ -9,7 +9,6 @@ dlm-y := ast.o \ ...@@ -9,7 +9,6 @@ dlm-y := ast.o \
member.o \ member.o \
memory.o \ memory.o \
midcomms.o \ midcomms.o \
netlink.o \
lowcomms.o \ lowcomms.o \
plock.o \ plock.o \
rcom.o \ rcom.o \
...@@ -18,5 +17,6 @@ dlm-y := ast.o \ ...@@ -18,5 +17,6 @@ dlm-y := ast.o \
requestqueue.o \ requestqueue.o \
user.o \ user.o \
util.o util.o
dlm-$(CONFIG_DLM_DEPRECATED_API) += netlink.o
dlm-$(CONFIG_DLM_DEBUG) += debug_fs.o dlm-$(CONFIG_DLM_DEBUG) += debug_fs.o
...@@ -75,7 +75,9 @@ struct dlm_cluster { ...@@ -75,7 +75,9 @@ struct dlm_cluster {
unsigned int cl_log_info; unsigned int cl_log_info;
unsigned int cl_protocol; unsigned int cl_protocol;
unsigned int cl_mark; unsigned int cl_mark;
#ifdef CONFIG_DLM_DEPRECATED_API
unsigned int cl_timewarn_cs; unsigned int cl_timewarn_cs;
#endif
unsigned int cl_new_rsb_count; unsigned int cl_new_rsb_count;
unsigned int cl_recover_callbacks; unsigned int cl_recover_callbacks;
char cl_cluster_name[DLM_LOCKSPACE_LEN]; char cl_cluster_name[DLM_LOCKSPACE_LEN];
...@@ -101,7 +103,9 @@ enum { ...@@ -101,7 +103,9 @@ enum {
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,
...@@ -222,7 +226,9 @@ CLUSTER_ATTR(log_debug, NULL); ...@@ -222,7 +226,9 @@ CLUSTER_ATTR(log_debug, NULL);
CLUSTER_ATTR(log_info, NULL); CLUSTER_ATTR(log_info, NULL);
CLUSTER_ATTR(protocol, dlm_check_protocol_and_dlm_running); CLUSTER_ATTR(protocol, dlm_check_protocol_and_dlm_running);
CLUSTER_ATTR(mark, NULL); CLUSTER_ATTR(mark, NULL);
#ifdef CONFIG_DLM_DEPRECATED_API
CLUSTER_ATTR(timewarn_cs, dlm_check_zero); CLUSTER_ATTR(timewarn_cs, dlm_check_zero);
#endif
CLUSTER_ATTR(new_rsb_count, NULL); CLUSTER_ATTR(new_rsb_count, NULL);
CLUSTER_ATTR(recover_callbacks, NULL); CLUSTER_ATTR(recover_callbacks, NULL);
...@@ -237,7 +243,9 @@ static struct configfs_attribute *cluster_attrs[] = { ...@@ -237,7 +243,9 @@ static struct configfs_attribute *cluster_attrs[] = {
[CLUSTER_ATTR_LOG_INFO] = &cluster_attr_log_info, [CLUSTER_ATTR_LOG_INFO] = &cluster_attr_log_info,
[CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol, [CLUSTER_ATTR_PROTOCOL] = &cluster_attr_protocol,
[CLUSTER_ATTR_MARK] = &cluster_attr_mark, [CLUSTER_ATTR_MARK] = &cluster_attr_mark,
#ifdef CONFIG_DLM_DEPRECATED_API
[CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs, [CLUSTER_ATTR_TIMEWARN_CS] = &cluster_attr_timewarn_cs,
#endif
[CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count, [CLUSTER_ATTR_NEW_RSB_COUNT] = &cluster_attr_new_rsb_count,
[CLUSTER_ATTR_RECOVER_CALLBACKS] = &cluster_attr_recover_callbacks, [CLUSTER_ATTR_RECOVER_CALLBACKS] = &cluster_attr_recover_callbacks,
[CLUSTER_ATTR_CLUSTER_NAME] = &cluster_attr_cluster_name, [CLUSTER_ATTR_CLUSTER_NAME] = &cluster_attr_cluster_name,
...@@ -428,7 +436,9 @@ static struct config_group *make_cluster(struct config_group *g, ...@@ -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_debug = dlm_config.ci_log_debug;
cl->cl_log_info = dlm_config.ci_log_info; cl->cl_log_info = dlm_config.ci_log_info;
cl->cl_protocol = dlm_config.ci_protocol; cl->cl_protocol = dlm_config.ci_protocol;
#ifdef CONFIG_DLM_DEPRECATED_API
cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs; cl->cl_timewarn_cs = dlm_config.ci_timewarn_cs;
#endif
cl->cl_new_rsb_count = dlm_config.ci_new_rsb_count; cl->cl_new_rsb_count = dlm_config.ci_new_rsb_count;
cl->cl_recover_callbacks = dlm_config.ci_recover_callbacks; cl->cl_recover_callbacks = dlm_config.ci_recover_callbacks;
memcpy(cl->cl_cluster_name, dlm_config.ci_cluster_name, memcpy(cl->cl_cluster_name, dlm_config.ci_cluster_name,
...@@ -949,7 +959,9 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num) ...@@ -949,7 +959,9 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)
#define DEFAULT_LOG_INFO 1 #define DEFAULT_LOG_INFO 1
#define DEFAULT_PROTOCOL DLM_PROTO_TCP #define DEFAULT_PROTOCOL DLM_PROTO_TCP
#define DEFAULT_MARK 0 #define DEFAULT_MARK 0
#ifdef CONFIG_DLM_DEPRECATED_API
#define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */ #define DEFAULT_TIMEWARN_CS 500 /* 5 sec = 500 centiseconds */
#endif
#define DEFAULT_NEW_RSB_COUNT 128 #define DEFAULT_NEW_RSB_COUNT 128
#define DEFAULT_RECOVER_CALLBACKS 0 #define DEFAULT_RECOVER_CALLBACKS 0
#define DEFAULT_CLUSTER_NAME "" #define DEFAULT_CLUSTER_NAME ""
...@@ -965,7 +977,9 @@ struct dlm_config_info dlm_config = { ...@@ -965,7 +977,9 @@ struct dlm_config_info dlm_config = {
.ci_log_info = DEFAULT_LOG_INFO, .ci_log_info = DEFAULT_LOG_INFO,
.ci_protocol = DEFAULT_PROTOCOL, .ci_protocol = DEFAULT_PROTOCOL,
.ci_mark = DEFAULT_MARK, .ci_mark = DEFAULT_MARK,
#ifdef CONFIG_DLM_DEPRECATED_API
.ci_timewarn_cs = DEFAULT_TIMEWARN_CS, .ci_timewarn_cs = DEFAULT_TIMEWARN_CS,
#endif
.ci_new_rsb_count = DEFAULT_NEW_RSB_COUNT, .ci_new_rsb_count = DEFAULT_NEW_RSB_COUNT,
.ci_recover_callbacks = DEFAULT_RECOVER_CALLBACKS, .ci_recover_callbacks = DEFAULT_RECOVER_CALLBACKS,
.ci_cluster_name = DEFAULT_CLUSTER_NAME .ci_cluster_name = DEFAULT_CLUSTER_NAME
......
...@@ -37,7 +37,9 @@ struct dlm_config_info { ...@@ -37,7 +37,9 @@ struct dlm_config_info {
int ci_log_info; int ci_log_info;
int ci_protocol; int ci_protocol;
int ci_mark; int ci_mark;
#ifdef CONFIG_DLM_DEPRECATED_API
int ci_timewarn_cs; int ci_timewarn_cs;
#endif
int ci_new_rsb_count; int ci_new_rsb_count;
int ci_recover_callbacks; int ci_recover_callbacks;
char ci_cluster_name[DLM_LOCKSPACE_LEN]; char ci_cluster_name[DLM_LOCKSPACE_LEN];
......
...@@ -145,7 +145,9 @@ struct dlm_args { ...@@ -145,7 +145,9 @@ struct dlm_args {
void (*bastfn) (void *astparam, int mode); void (*bastfn) (void *astparam, int mode);
int mode; int mode;
struct dlm_lksb *lksb; struct dlm_lksb *lksb;
#ifdef CONFIG_DLM_DEPRECATED_API
unsigned long timeout; unsigned long timeout;
#endif
}; };
...@@ -203,8 +205,10 @@ struct dlm_args { ...@@ -203,8 +205,10 @@ struct dlm_args {
#define DLM_IFL_OVERLAP_UNLOCK 0x00080000 #define DLM_IFL_OVERLAP_UNLOCK 0x00080000
#define DLM_IFL_OVERLAP_CANCEL 0x00100000 #define DLM_IFL_OVERLAP_CANCEL 0x00100000
#define DLM_IFL_ENDOFLIFE 0x00200000 #define DLM_IFL_ENDOFLIFE 0x00200000
#ifdef CONFIG_DLM_DEPRECATED_API
#define DLM_IFL_WATCH_TIMEWARN 0x00400000 #define DLM_IFL_WATCH_TIMEWARN 0x00400000
#define DLM_IFL_TIMEOUT_CANCEL 0x00800000 #define DLM_IFL_TIMEOUT_CANCEL 0x00800000
#endif
#define DLM_IFL_DEADLOCK_CANCEL 0x01000000 #define DLM_IFL_DEADLOCK_CANCEL 0x01000000
#define DLM_IFL_STUB_MS 0x02000000 /* magic number for m_flags */ #define DLM_IFL_STUB_MS 0x02000000 /* magic number for m_flags */
/* least significant 2 bytes are message changed, they are full transmitted /* least significant 2 bytes are message changed, they are full transmitted
...@@ -257,9 +261,12 @@ struct dlm_lkb { ...@@ -257,9 +261,12 @@ struct dlm_lkb {
struct list_head lkb_rsb_lookup; /* waiting for rsb lookup */ struct list_head lkb_rsb_lookup; /* waiting for rsb lookup */
struct list_head lkb_wait_reply; /* waiting for remote reply */ 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_ownqueue; /* list of locks for a process */
struct list_head lkb_time_list;
ktime_t lkb_timestamp; ktime_t lkb_timestamp;
#ifdef CONFIG_DLM_DEPRECATED_API
struct list_head lkb_time_list;
unsigned long lkb_timeout_cs; unsigned long lkb_timeout_cs;
#endif
struct mutex lkb_cb_mutex; struct mutex lkb_cb_mutex;
struct work_struct lkb_cb_work; struct work_struct lkb_cb_work;
...@@ -575,8 +582,10 @@ struct dlm_ls { ...@@ -575,8 +582,10 @@ struct dlm_ls {
struct mutex ls_orphans_mutex; struct mutex ls_orphans_mutex;
struct list_head ls_orphans; struct list_head ls_orphans;
#ifdef CONFIG_DLM_DEPRECATED_API
struct mutex ls_timeout_mutex; struct mutex ls_timeout_mutex;
struct list_head ls_timeout; struct list_head ls_timeout;
#endif
spinlock_t ls_new_rsb_spin; spinlock_t ls_new_rsb_spin;
int ls_new_rsb_count; int ls_new_rsb_count;
...@@ -695,7 +704,9 @@ struct dlm_ls { ...@@ -695,7 +704,9 @@ struct dlm_ls {
#define LSFL_RCOM_READY 5 #define LSFL_RCOM_READY 5
#define LSFL_RCOM_WAIT 6 #define LSFL_RCOM_WAIT 6
#define LSFL_UEVENT_WAIT 7 #define LSFL_UEVENT_WAIT 7
#ifdef CONFIG_DLM_DEPRECATED_API
#define LSFL_TIMEWARN 8 #define LSFL_TIMEWARN 8
#endif
#define LSFL_CB_DELAY 9 #define LSFL_CB_DELAY 9
#define LSFL_NODIR 10 #define LSFL_NODIR 10
...@@ -748,9 +759,15 @@ static inline int dlm_no_directory(struct dlm_ls *ls) ...@@ -748,9 +759,15 @@ static inline int dlm_no_directory(struct dlm_ls *ls)
return test_bit(LSFL_NODIR, &ls->ls_flags); return test_bit(LSFL_NODIR, &ls->ls_flags);
} }
#ifdef CONFIG_DLM_DEPRECATED_API
int dlm_netlink_init(void); int dlm_netlink_init(void);
void dlm_netlink_exit(void); void dlm_netlink_exit(void);
void dlm_timeout_warn(struct dlm_lkb *lkb); 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); int dlm_plock_init(void);
void dlm_plock_exit(void); void dlm_plock_exit(void);
......
...@@ -296,12 +296,14 @@ static void queue_cast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rv) ...@@ -296,12 +296,14 @@ static void queue_cast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rv)
DLM_ASSERT(lkb->lkb_lksb, dlm_print_lkb(lkb);); DLM_ASSERT(lkb->lkb_lksb, dlm_print_lkb(lkb););
#ifdef CONFIG_DLM_DEPRECATED_API
/* if the operation was a cancel, then return -DLM_ECANCEL, if a /* if the operation was a cancel, then return -DLM_ECANCEL, if a
timeout caused the cancel then return -ETIMEDOUT */ timeout caused the cancel then return -ETIMEDOUT */
if (rv == -DLM_ECANCEL && (lkb->lkb_flags & DLM_IFL_TIMEOUT_CANCEL)) { if (rv == -DLM_ECANCEL && (lkb->lkb_flags & DLM_IFL_TIMEOUT_CANCEL)) {
lkb->lkb_flags &= ~DLM_IFL_TIMEOUT_CANCEL; lkb->lkb_flags &= ~DLM_IFL_TIMEOUT_CANCEL;
rv = -ETIMEDOUT; rv = -ETIMEDOUT;
} }
#endif
if (rv == -DLM_ECANCEL && (lkb->lkb_flags & DLM_IFL_DEADLOCK_CANCEL)) { if (rv == -DLM_ECANCEL && (lkb->lkb_flags & DLM_IFL_DEADLOCK_CANCEL)) {
lkb->lkb_flags &= ~DLM_IFL_DEADLOCK_CANCEL; lkb->lkb_flags &= ~DLM_IFL_DEADLOCK_CANCEL;
...@@ -1210,7 +1212,9 @@ static int _create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret, ...@@ -1210,7 +1212,9 @@ static int _create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret,
kref_init(&lkb->lkb_ref); kref_init(&lkb->lkb_ref);
INIT_LIST_HEAD(&lkb->lkb_ownqueue); INIT_LIST_HEAD(&lkb->lkb_ownqueue);
INIT_LIST_HEAD(&lkb->lkb_rsb_lookup); INIT_LIST_HEAD(&lkb->lkb_rsb_lookup);
#ifdef CONFIG_DLM_DEPRECATED_API
INIT_LIST_HEAD(&lkb->lkb_time_list); INIT_LIST_HEAD(&lkb->lkb_time_list);
#endif
INIT_LIST_HEAD(&lkb->lkb_cb_list); INIT_LIST_HEAD(&lkb->lkb_cb_list);
mutex_init(&lkb->lkb_cb_mutex); mutex_init(&lkb->lkb_cb_mutex);
INIT_WORK(&lkb->lkb_cb_work, dlm_callback_work); INIT_WORK(&lkb->lkb_cb_work, dlm_callback_work);
...@@ -1772,6 +1776,7 @@ void dlm_scan_rsbs(struct dlm_ls *ls) ...@@ -1772,6 +1776,7 @@ void dlm_scan_rsbs(struct dlm_ls *ls)
} }
} }
#ifdef CONFIG_DLM_DEPRECATED_API
static void add_timeout(struct dlm_lkb *lkb) static void add_timeout(struct dlm_lkb *lkb)
{ {
struct dlm_ls *ls = lkb->lkb_resource->res_ls; struct dlm_ls *ls = lkb->lkb_resource->res_ls;
...@@ -1893,6 +1898,10 @@ void dlm_adjust_timeouts(struct dlm_ls *ls) ...@@ -1893,6 +1898,10 @@ void dlm_adjust_timeouts(struct dlm_ls *ls)
lkb->lkb_timestamp = ktime_add_us(lkb->lkb_timestamp, adj_us); lkb->lkb_timestamp = ktime_add_us(lkb->lkb_timestamp, adj_us);
mutex_unlock(&ls->ls_timeout_mutex); mutex_unlock(&ls->ls_timeout_mutex);
} }
#else
static void add_timeout(struct dlm_lkb *lkb) { }
static void del_timeout(struct dlm_lkb *lkb) { }
#endif
/* lkb is master or local copy */ /* lkb is master or local copy */
...@@ -2757,12 +2766,20 @@ static void confirm_master(struct dlm_rsb *r, int error) ...@@ -2757,12 +2766,20 @@ static void confirm_master(struct dlm_rsb *r, int error)
} }
} }
#ifdef CONFIG_DLM_DEPRECATED_API
static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags, static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags,
int namelen, unsigned long timeout_cs, int namelen, unsigned long timeout_cs,
void (*ast) (void *astparam), void (*ast) (void *astparam),
void *astparam, void *astparam,
void (*bast) (void *astparam, int mode), void (*bast) (void *astparam, int mode),
struct dlm_args *args) struct dlm_args *args)
#else
static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags,
int namelen, void (*ast)(void *astparam),
void *astparam,
void (*bast)(void *astparam, int mode),
struct dlm_args *args)
#endif
{ {
int rv = -EINVAL; int rv = -EINVAL;
...@@ -2815,7 +2832,9 @@ static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags, ...@@ -2815,7 +2832,9 @@ static int set_lock_args(int mode, struct dlm_lksb *lksb, uint32_t flags,
args->astfn = ast; args->astfn = ast;
args->astparam = astparam; args->astparam = astparam;
args->bastfn = bast; args->bastfn = bast;
#ifdef CONFIG_DLM_DEPRECATED_API
args->timeout = timeout_cs; args->timeout = timeout_cs;
#endif
args->mode = mode; args->mode = mode;
args->lksb = lksb; args->lksb = lksb;
rv = 0; rv = 0;
...@@ -2871,7 +2890,9 @@ static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, ...@@ -2871,7 +2890,9 @@ static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb,
lkb->lkb_lksb = args->lksb; lkb->lkb_lksb = args->lksb;
lkb->lkb_lvbptr = args->lksb->sb_lvbptr; lkb->lkb_lvbptr = args->lksb->sb_lvbptr;
lkb->lkb_ownpid = (int) current->pid; lkb->lkb_ownpid = (int) current->pid;
#ifdef CONFIG_DLM_DEPRECATED_API
lkb->lkb_timeout_cs = args->timeout; lkb->lkb_timeout_cs = args->timeout;
#endif
rv = 0; rv = 0;
out: out:
if (rv) if (rv)
...@@ -3394,8 +3415,13 @@ int dlm_lock(dlm_lockspace_t *lockspace, ...@@ -3394,8 +3415,13 @@ int dlm_lock(dlm_lockspace_t *lockspace,
trace_dlm_lock_start(ls, lkb, name, namelen, mode, flags); trace_dlm_lock_start(ls, lkb, name, namelen, mode, flags);
#ifdef CONFIG_DLM_DEPRECATED_API
error = set_lock_args(mode, lksb, flags, namelen, 0, ast, error = set_lock_args(mode, lksb, flags, namelen, 0, ast,
astarg, bast, &args); astarg, bast, &args);
#else
error = set_lock_args(mode, lksb, flags, namelen, ast, astarg, bast,
&args);
#endif
if (error) if (error)
goto out_put; goto out_put;
...@@ -5759,9 +5785,14 @@ int dlm_recover_process_copy(struct dlm_ls *ls, struct dlm_rcom *rc) ...@@ -5759,9 +5785,14 @@ int dlm_recover_process_copy(struct dlm_ls *ls, struct dlm_rcom *rc)
return 0; return 0;
} }
#ifdef CONFIG_DLM_DEPRECATED_API
int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua,
int mode, uint32_t flags, void *name, unsigned int namelen, int mode, uint32_t flags, void *name, unsigned int namelen,
unsigned long timeout_cs) 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)
#endif
{ {
struct dlm_lkb *lkb; struct dlm_lkb *lkb;
struct dlm_args args; struct dlm_args args;
...@@ -5784,8 +5815,13 @@ int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, ...@@ -5784,8 +5815,13 @@ int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua,
goto out; goto out;
} }
} }
#ifdef CONFIG_DLM_DEPRECATED_API
error = set_lock_args(mode, &ua->lksb, flags, namelen, timeout_cs, error = set_lock_args(mode, &ua->lksb, flags, namelen, timeout_cs,
fake_astfn, ua, fake_bastfn, &args); fake_astfn, ua, fake_bastfn, &args);
#else
error = set_lock_args(mode, &ua->lksb, flags, namelen, fake_astfn, ua,
fake_bastfn, &args);
#endif
if (error) { if (error) {
kfree(ua->lksb.sb_lvbptr); kfree(ua->lksb.sb_lvbptr);
ua->lksb.sb_lvbptr = NULL; ua->lksb.sb_lvbptr = NULL;
...@@ -5824,9 +5860,14 @@ int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, ...@@ -5824,9 +5860,14 @@ int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua,
return error; return error;
} }
#ifdef CONFIG_DLM_DEPRECATED_API
int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, 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, int mode, uint32_t flags, uint32_t lkid, char *lvb_in,
unsigned long timeout_cs) unsigned long timeout_cs)
#else
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
{ {
struct dlm_lkb *lkb; struct dlm_lkb *lkb;
struct dlm_args args; struct dlm_args args;
...@@ -5861,8 +5902,13 @@ int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, ...@@ -5861,8 +5902,13 @@ int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
ua->bastaddr = ua_tmp->bastaddr; ua->bastaddr = ua_tmp->bastaddr;
ua->user_lksb = ua_tmp->user_lksb; ua->user_lksb = ua_tmp->user_lksb;
#ifdef CONFIG_DLM_DEPRECATED_API
error = set_lock_args(mode, &ua->lksb, flags, 0, timeout_cs, error = set_lock_args(mode, &ua->lksb, flags, 0, timeout_cs,
fake_astfn, ua, fake_bastfn, &args); fake_astfn, ua, fake_bastfn, &args);
#else
error = set_lock_args(mode, &ua->lksb, flags, 0, fake_astfn, ua,
fake_bastfn, &args);
#endif
if (error) if (error)
goto out_put; goto out_put;
......
...@@ -24,8 +24,15 @@ int dlm_put_lkb(struct dlm_lkb *lkb); ...@@ -24,8 +24,15 @@ int dlm_put_lkb(struct dlm_lkb *lkb);
void dlm_scan_rsbs(struct dlm_ls *ls); void dlm_scan_rsbs(struct dlm_ls *ls);
int dlm_lock_recovery_try(struct dlm_ls *ls); int dlm_lock_recovery_try(struct dlm_ls *ls);
void dlm_unlock_recovery(struct dlm_ls *ls); void dlm_unlock_recovery(struct dlm_ls *ls);
#ifdef CONFIG_DLM_DEPRECATED_API
void dlm_scan_timeout(struct dlm_ls *ls); void dlm_scan_timeout(struct dlm_ls *ls);
void dlm_adjust_timeouts(struct dlm_ls *ls); void dlm_adjust_timeouts(struct dlm_ls *ls);
#else
static inline void dlm_scan_timeout(struct dlm_ls *ls) { }
static inline void dlm_adjust_timeouts(struct dlm_ls *ls) { }
#endif
int dlm_master_lookup(struct dlm_ls *ls, int nodeid, char *name, int len, int dlm_master_lookup(struct dlm_ls *ls, int nodeid, char *name, int len,
unsigned int flags, int *r_nodeid, int *result); unsigned int flags, int *r_nodeid, int *result);
...@@ -40,12 +47,19 @@ void dlm_recover_waiters_pre(struct dlm_ls *ls); ...@@ -40,12 +47,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_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc);
int dlm_recover_process_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, int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, int mode,
uint32_t flags, void *name, unsigned int namelen, uint32_t flags, void *name, unsigned int namelen,
unsigned long timeout_cs); unsigned long timeout_cs);
int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp, 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, int mode, uint32_t flags, uint32_t lkid, char *lvb_in,
unsigned long timeout_cs); 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 dlm_user_adopt_orphan(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
int mode, uint32_t flags, void *name, unsigned int namelen, int mode, uint32_t flags, void *name, unsigned int namelen,
uint32_t *lkid); uint32_t *lkid);
......
...@@ -489,22 +489,28 @@ static int new_lockspace(const char *name, const char *cluster, ...@@ -489,22 +489,28 @@ static int new_lockspace(const char *name, const char *cluster,
ls->ls_ops_arg = ops_arg; ls->ls_ops_arg = ops_arg;
} }
if (flags & DLM_LSFL_TIMEWARN) {
#ifdef CONFIG_DLM_DEPRECATED_API #ifdef CONFIG_DLM_DEPRECATED_API
if (flags & DLM_LSFL_TIMEWARN) {
pr_warn_once("===============================================================\n" pr_warn_once("===============================================================\n"
"WARNING: the dlm DLM_LSFL_TIMEWARN flag is being deprecated and\n" "WARNING: the dlm DLM_LSFL_TIMEWARN flag is being deprecated and\n"
" will be removed in v6.2!\n" " will be removed in v6.2!\n"
" Inclusive DLM_LSFL_TIMEWARN define in UAPI header!\n" " Inclusive DLM_LSFL_TIMEWARN define in UAPI header!\n"
"===============================================================\n"); "===============================================================\n");
#endif
set_bit(LSFL_TIMEWARN, &ls->ls_flags); set_bit(LSFL_TIMEWARN, &ls->ls_flags);
} }
/* ls_exflags are forced to match among nodes, and we don't /* 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 | ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN | DLM_LSFL_FS |
DLM_LSFL_NEWEXCL)); 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); size = READ_ONCE(dlm_config.ci_rsbtbl_size);
ls->ls_rsbtbl_size = size; ls->ls_rsbtbl_size = size;
...@@ -535,8 +541,10 @@ static int new_lockspace(const char *name, const char *cluster, ...@@ -535,8 +541,10 @@ static int new_lockspace(const char *name, const char *cluster,
mutex_init(&ls->ls_waiters_mutex); mutex_init(&ls->ls_waiters_mutex);
INIT_LIST_HEAD(&ls->ls_orphans); INIT_LIST_HEAD(&ls->ls_orphans);
mutex_init(&ls->ls_orphans_mutex); mutex_init(&ls->ls_orphans_mutex);
#ifdef CONFIG_DLM_DEPRECATED_API
INIT_LIST_HEAD(&ls->ls_timeout); INIT_LIST_HEAD(&ls->ls_timeout);
mutex_init(&ls->ls_timeout_mutex); mutex_init(&ls->ls_timeout_mutex);
#endif
INIT_LIST_HEAD(&ls->ls_new_rsb); INIT_LIST_HEAD(&ls->ls_new_rsb);
spin_lock_init(&ls->ls_new_rsb_spin); spin_lock_init(&ls->ls_new_rsb_spin);
......
...@@ -270,10 +270,16 @@ static int device_user_lock(struct dlm_user_proc *proc, ...@@ -270,10 +270,16 @@ static int device_user_lock(struct dlm_user_proc *proc,
ua->xid = params->xid; ua->xid = params->xid;
if (params->flags & DLM_LKF_CONVERT) { if (params->flags & DLM_LKF_CONVERT) {
#ifdef CONFIG_DLM_DEPRECATED_API
error = dlm_user_convert(ls, ua, error = dlm_user_convert(ls, ua,
params->mode, params->flags, params->mode, params->flags,
params->lkid, params->lvb, params->lkid, params->lvb,
(unsigned long) params->timeout); (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) { } else if (params->flags & DLM_LKF_ORPHAN) {
error = dlm_user_adopt_orphan(ls, ua, error = dlm_user_adopt_orphan(ls, ua,
params->mode, params->flags, params->mode, params->flags,
...@@ -282,10 +288,16 @@ static int device_user_lock(struct dlm_user_proc *proc, ...@@ -282,10 +288,16 @@ static int device_user_lock(struct dlm_user_proc *proc,
if (!error) if (!error)
error = lkid; error = lkid;
} else { } else {
#ifdef CONFIG_DLM_DEPRECATED_API
error = dlm_user_request(ls, ua, error = dlm_user_request(ls, ua,
params->mode, params->flags, params->mode, params->flags,
params->name, params->namelen, params->name, params->namelen,
(unsigned long) params->timeout); (unsigned long) params->timeout);
#else
error = dlm_user_request(ls, ua,
params->mode, params->flags,
params->name, params->namelen);
#endif
if (!error) if (!error)
error = ua->lksb.sb_lkid; error = ua->lksb.sb_lkid;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment