Skip to content

Commit 97971df

Browse files
committed
Merge tag 'dlm-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Pull dlm updates from David Teigland: "These patches include the usual cleanups and minor fixes, the removal of code that is no longer needed due to recent improvements, and improvements to processing large volumes of messages during heavy locking activity. Summary: - Misc code cleanup - Fix a couple of socket handling bugs: a double release on an error path and a data-ready race in an accept loop - Remove code for resending dir-remove messages. This code is no longer needed since the midcomms layer now ensures the messages are resent if needed - Add tracepoints for dlm messages - Improve callback queueing by replacing the fixed array with a list - Simplify the handling of a remove message followed by a lookup message by sending both without releasing a spinlock in between - Improve the concurrency of sending and receiving messages by holding locks for a shorter time, and changing how workqueues are used - Remove old code for shutting down sockets, which is no longer needed with the reliable connection handling that was recently added" * tag 'dlm-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm: (37 commits) fs: dlm: fix building without lockdep fs: dlm: parallelize lowcomms socket handling fs: dlm: don't init error value fs: dlm: use saved sk_error_report() fs: dlm: use sock2con without checking null fs: dlm: remove dlm_node_addrs lookup list fs: dlm: don't put dlm_local_addrs on heap fs: dlm: cleanup listen sock handling fs: dlm: remove socket shutdown handling fs: dlm: use listen sock as dlm running indicator fs: dlm: use list_first_entry_or_null fs: dlm: remove twice INIT_WORK fs: dlm: add midcomms init/start functions fs: dlm: add dst nodeid for msg tracing fs: dlm: rename seq to h_seq for msg tracing fs: dlm: rename DLM_IFL_NEED_SCHED to DLM_IFL_CB_PENDING fs: dlm: ast do WARN_ON_ONCE() on hotpath fs: dlm: drop lkb ref in bug case fs: dlm: avoid false-positive checker warning fs: dlm: use WARN_ON_ONCE() instead of WARN_ON() ...
2 parents 56c003e + 7a5e9f1 commit 97971df

File tree

20 files changed

+1455
-1243
lines changed

20 files changed

+1455
-1243
lines changed

fs/dlm/ast.c

Lines changed: 137 additions & 185 deletions
Large diffs are not rendered by default.

fs/dlm/ast.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,22 @@
1111
#ifndef __ASTD_DOT_H__
1212
#define __ASTD_DOT_H__
1313

14-
int dlm_add_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode,
15-
int status, uint32_t sbflags, uint64_t seq);
16-
int dlm_rem_lkb_callback(struct dlm_ls *ls, struct dlm_lkb *lkb,
17-
struct dlm_callback *cb, int *resid);
14+
#define DLM_ENQUEUE_CALLBACK_NEED_SCHED 1
15+
#define DLM_ENQUEUE_CALLBACK_SUCCESS 0
16+
#define DLM_ENQUEUE_CALLBACK_FAILURE -1
17+
int dlm_enqueue_lkb_callback(struct dlm_lkb *lkb, uint32_t flags, int mode,
18+
int status, uint32_t sbflags);
19+
#define DLM_DEQUEUE_CALLBACK_EMPTY 2
20+
#define DLM_DEQUEUE_CALLBACK_LAST 1
21+
#define DLM_DEQUEUE_CALLBACK_SUCCESS 0
22+
int dlm_dequeue_lkb_callback(struct dlm_lkb *lkb, struct dlm_callback **cb);
1823
void dlm_add_cb(struct dlm_lkb *lkb, uint32_t flags, int mode, int status,
1924
uint32_t sbflags);
25+
void dlm_callback_set_last_ptr(struct dlm_callback **from,
26+
struct dlm_callback *to);
2027

28+
void dlm_release_callback(struct kref *ref);
29+
void dlm_purge_lkb_callbacks(struct dlm_lkb *lkb);
2130
void dlm_callback_work(struct work_struct *work);
2231
int dlm_callback_start(struct dlm_ls *ls);
2332
void dlm_callback_stop(struct dlm_ls *ls);

fs/dlm/config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static int dlm_check_protocol_and_dlm_running(unsigned int x)
183183
return -EINVAL;
184184
}
185185

186-
if (dlm_allow_conn)
186+
if (dlm_lowcomms_is_running())
187187
return -EBUSY;
188188

189189
return 0;
@@ -194,7 +194,7 @@ static int dlm_check_zero_and_dlm_running(unsigned int x)
194194
if (!x)
195195
return -EINVAL;
196196

197-
if (dlm_allow_conn)
197+
if (dlm_lowcomms_is_running())
198198
return -EBUSY;
199199

200200
return 0;

fs/dlm/debug_fs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static void print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb,
246246
lkb->lkb_status,
247247
lkb->lkb_grmode,
248248
lkb->lkb_rqmode,
249-
lkb->lkb_last_bast.mode,
249+
lkb->lkb_last_bast_mode,
250250
rsb_lookup,
251251
lkb->lkb_wait_type,
252252
lkb->lkb_lvbseq,

fs/dlm/dlm_internal.h

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ struct dlm_args {
211211
#endif
212212
#define DLM_IFL_DEADLOCK_CANCEL 0x01000000
213213
#define DLM_IFL_STUB_MS 0x02000000 /* magic number for m_flags */
214+
#define DLM_IFL_CB_PENDING 0x04000000
214215
/* least significant 2 bytes are message changed, they are full transmitted
215216
* but at receive side only the 2 bytes LSB will be set.
216217
*
@@ -222,18 +223,17 @@ struct dlm_args {
222223
#define DLM_IFL_USER 0x00000001
223224
#define DLM_IFL_ORPHAN 0x00000002
224225

225-
#define DLM_CALLBACKS_SIZE 6
226-
227226
#define DLM_CB_CAST 0x00000001
228227
#define DLM_CB_BAST 0x00000002
229-
#define DLM_CB_SKIP 0x00000004
230228

231229
struct dlm_callback {
232-
uint64_t seq;
233230
uint32_t flags; /* DLM_CBF_ */
234231
int sb_status; /* copy to lksb status */
235232
uint8_t sb_flags; /* copy to lksb flags */
236233
int8_t mode; /* rq mode of bast, gr mode of cast */
234+
235+
struct list_head list;
236+
struct kref ref;
237237
};
238238

239239
struct dlm_lkb {
@@ -268,12 +268,13 @@ struct dlm_lkb {
268268
unsigned long lkb_timeout_cs;
269269
#endif
270270

271-
struct mutex lkb_cb_mutex;
271+
spinlock_t lkb_cb_lock;
272272
struct work_struct lkb_cb_work;
273273
struct list_head lkb_cb_list; /* for ls_cb_delay or proc->asts */
274-
struct dlm_callback lkb_callbacks[DLM_CALLBACKS_SIZE];
275-
struct dlm_callback lkb_last_cast;
276-
struct dlm_callback lkb_last_bast;
274+
struct list_head lkb_callbacks;
275+
struct dlm_callback *lkb_last_cast;
276+
struct dlm_callback *lkb_last_cb;
277+
int lkb_last_bast_mode;
277278
ktime_t lkb_last_cast_time; /* for debugging */
278279
ktime_t lkb_last_bast_time; /* for debugging */
279280

@@ -591,11 +592,7 @@ struct dlm_ls {
591592
int ls_new_rsb_count;
592593
struct list_head ls_new_rsb; /* new rsb structs */
593594

594-
spinlock_t ls_remove_spin;
595-
wait_queue_head_t ls_remove_wait;
596-
char ls_remove_name[DLM_RESNAME_MAXLEN+1];
597595
char *ls_remove_names[DLM_REMOVE_NAMES_MAX];
598-
int ls_remove_len;
599596
int ls_remove_lens[DLM_REMOVE_NAMES_MAX];
600597

601598
struct list_head ls_nodes; /* current nodes in ls */
@@ -631,7 +628,7 @@ struct dlm_ls {
631628

632629
/* recovery related */
633630

634-
struct mutex ls_cb_mutex;
631+
spinlock_t ls_cb_lock;
635632
struct list_head ls_cb_delay; /* save for queue_work later */
636633
struct timer_list ls_timer;
637634
struct task_struct *ls_recoverd_task;
@@ -670,7 +667,7 @@ struct dlm_ls {
670667
void *ls_ops_arg;
671668

672669
int ls_namelen;
673-
char ls_name[1];
670+
char ls_name[DLM_LOCKSPACE_LEN + 1];
674671
};
675672

676673
/*

0 commit comments

Comments
 (0)