Skip to content

Commit 659b361

Browse files
committed
Merge tag 'dlm-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Pull dlm updates from David Teigland: - Allow blocking posix lock requests to be interrupted while waiting. This requires a cancel request to be sent to the userspace daemon where posix lock requests are processed across the cluster. - Fix a posix lock patch from the previous cycle in which lock requests from different file systems could be mixed up. - Fix some long standing problems with nfs posix lock cancelation. - Add a new debugfs file for printing queued callbacks. - Stop modifying buffers that have been used to receive a message. - Misc cleanups and some refactoring. * tag 'dlm-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm: dlm: fix plock lookup when using multiple lockspaces fs: dlm: don't use RCOM_NAMES for version detection fs: dlm: create midcomms nodes when configure fs: dlm: constify receive buffer fs: dlm: drop rxbuf manipulation in dlm_recover_master_copy fs: dlm: drop rxbuf manipulation in dlm_copy_master_names fs: dlm: get recovery sequence number as parameter fs: dlm: cleanup lock order fs: dlm: remove clear_members_cb fs: dlm: add plock dev tracepoints fs: dlm: check on plock ops when exit dlm fs: dlm: debugfs for queued callbacks fs: dlm: remove unused processed_nodes fs: dlm: add missing spin_unlock fs: dlm: fix F_CANCELLK to cancel pending request fs: dlm: allow to F_SETLKW getting interrupted fs: dlm: remove twice newline
2 parents e7e9423 + 7c53e84 commit 659b361

25 files changed

+629
-421
lines changed

fs/dlm/config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ static ssize_t comm_addr_store(struct config_item *item, const char *buf,
664664

665665
memcpy(addr, buf, len);
666666

667-
rv = dlm_lowcomms_addr(cm->nodeid, addr, len);
667+
rv = dlm_midcomms_addr(cm->nodeid, addr, len);
668668
if (rv) {
669669
kfree(addr);
670670
return rv;

fs/dlm/debug_fs.c

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "dlm_internal.h"
1919
#include "midcomms.h"
2020
#include "lock.h"
21+
#include "ast.h"
2122

2223
#define DLM_DEBUG_BUF_LEN 4096
2324
static char debug_buf[DLM_DEBUG_BUF_LEN];
@@ -365,6 +366,52 @@ static void print_format4(struct dlm_rsb *r, struct seq_file *s)
365366
unlock_rsb(r);
366367
}
367368

369+
static void print_format5_lock(struct seq_file *s, struct dlm_lkb *lkb)
370+
{
371+
struct dlm_callback *cb;
372+
373+
/* lkb_id lkb_flags mode flags sb_status sb_flags */
374+
375+
spin_lock(&lkb->lkb_cb_lock);
376+
list_for_each_entry(cb, &lkb->lkb_callbacks, list) {
377+
seq_printf(s, "%x %x %d %x %d %x\n",
378+
lkb->lkb_id,
379+
dlm_iflags_val(lkb),
380+
cb->mode,
381+
cb->flags,
382+
cb->sb_status,
383+
cb->sb_flags);
384+
}
385+
spin_unlock(&lkb->lkb_cb_lock);
386+
}
387+
388+
static void print_format5(struct dlm_rsb *r, struct seq_file *s)
389+
{
390+
struct dlm_lkb *lkb;
391+
392+
lock_rsb(r);
393+
394+
list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) {
395+
print_format5_lock(s, lkb);
396+
if (seq_has_overflowed(s))
397+
goto out;
398+
}
399+
400+
list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) {
401+
print_format5_lock(s, lkb);
402+
if (seq_has_overflowed(s))
403+
goto out;
404+
}
405+
406+
list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) {
407+
print_format5_lock(s, lkb);
408+
if (seq_has_overflowed(s))
409+
goto out;
410+
}
411+
out:
412+
unlock_rsb(r);
413+
}
414+
368415
struct rsbtbl_iter {
369416
struct dlm_rsb *rsb;
370417
unsigned bucket;
@@ -408,6 +455,13 @@ static int table_seq_show(struct seq_file *seq, void *iter_ptr)
408455
}
409456
print_format4(ri->rsb, seq);
410457
break;
458+
case 5:
459+
if (ri->header) {
460+
seq_puts(seq, "lkb_id lkb_flags mode flags sb_status sb_flags\n");
461+
ri->header = 0;
462+
}
463+
print_format5(ri->rsb, seq);
464+
break;
411465
}
412466

413467
return 0;
@@ -417,6 +471,7 @@ static const struct seq_operations format1_seq_ops;
417471
static const struct seq_operations format2_seq_ops;
418472
static const struct seq_operations format3_seq_ops;
419473
static const struct seq_operations format4_seq_ops;
474+
static const struct seq_operations format5_seq_ops;
420475

421476
static void *table_seq_start(struct seq_file *seq, loff_t *pos)
422477
{
@@ -448,6 +503,8 @@ static void *table_seq_start(struct seq_file *seq, loff_t *pos)
448503
ri->format = 3;
449504
if (seq->op == &format4_seq_ops)
450505
ri->format = 4;
506+
if (seq->op == &format5_seq_ops)
507+
ri->format = 5;
451508

452509
tree = toss ? &ls->ls_rsbtbl[bucket].toss : &ls->ls_rsbtbl[bucket].keep;
453510

@@ -602,10 +659,18 @@ static const struct seq_operations format4_seq_ops = {
602659
.show = table_seq_show,
603660
};
604661

662+
static const struct seq_operations format5_seq_ops = {
663+
.start = table_seq_start,
664+
.next = table_seq_next,
665+
.stop = table_seq_stop,
666+
.show = table_seq_show,
667+
};
668+
605669
static const struct file_operations format1_fops;
606670
static const struct file_operations format2_fops;
607671
static const struct file_operations format3_fops;
608672
static const struct file_operations format4_fops;
673+
static const struct file_operations format5_fops;
609674

610675
static int table_open1(struct inode *inode, struct file *file)
611676
{
@@ -683,7 +748,21 @@ static int table_open4(struct inode *inode, struct file *file)
683748
struct seq_file *seq;
684749
int ret;
685750

686-
ret = seq_open(file, &format4_seq_ops);
751+
ret = seq_open(file, &format5_seq_ops);
752+
if (ret)
753+
return ret;
754+
755+
seq = file->private_data;
756+
seq->private = inode->i_private; /* the dlm_ls */
757+
return 0;
758+
}
759+
760+
static int table_open5(struct inode *inode, struct file *file)
761+
{
762+
struct seq_file *seq;
763+
int ret;
764+
765+
ret = seq_open(file, &format5_seq_ops);
687766
if (ret)
688767
return ret;
689768

@@ -725,6 +804,14 @@ static const struct file_operations format4_fops = {
725804
.release = seq_release
726805
};
727806

807+
static const struct file_operations format5_fops = {
808+
.owner = THIS_MODULE,
809+
.open = table_open5,
810+
.read = seq_read,
811+
.llseek = seq_lseek,
812+
.release = seq_release
813+
};
814+
728815
/*
729816
* dump lkb's on the ls_waiters list
730817
*/
@@ -793,6 +880,7 @@ void dlm_delete_debug_file(struct dlm_ls *ls)
793880
debugfs_remove(ls->ls_debug_locks_dentry);
794881
debugfs_remove(ls->ls_debug_all_dentry);
795882
debugfs_remove(ls->ls_debug_toss_dentry);
883+
debugfs_remove(ls->ls_debug_queued_asts_dentry);
796884
}
797885

798886
static int dlm_state_show(struct seq_file *file, void *offset)
@@ -936,6 +1024,17 @@ void dlm_create_debug_file(struct dlm_ls *ls)
9361024
dlm_root,
9371025
ls,
9381026
&waiters_fops);
1027+
1028+
/* format 5 */
1029+
1030+
memset(name, 0, sizeof(name));
1031+
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name);
1032+
1033+
ls->ls_debug_queued_asts_dentry = debugfs_create_file(name,
1034+
0644,
1035+
dlm_root,
1036+
ls,
1037+
&format5_fops);
9391038
}
9401039

9411040
void __init dlm_register_debugfs(void)

fs/dlm/dir.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void dlm_recover_dir_nodeid(struct dlm_ls *ls)
5858
up_read(&ls->ls_root_sem);
5959
}
6060

61-
int dlm_recover_directory(struct dlm_ls *ls)
61+
int dlm_recover_directory(struct dlm_ls *ls, uint64_t seq)
6262
{
6363
struct dlm_member *memb;
6464
char *b, *last_name = NULL;
@@ -90,7 +90,7 @@ int dlm_recover_directory(struct dlm_ls *ls)
9090
}
9191

9292
error = dlm_rcom_names(ls, memb->nodeid,
93-
last_name, last_len);
93+
last_name, last_len, seq);
9494
if (error)
9595
goto out_free;
9696

@@ -196,7 +196,8 @@ int dlm_recover_directory(struct dlm_ls *ls)
196196
return error;
197197
}
198198

199-
static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, char *name, int len)
199+
static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, const char *name,
200+
int len)
200201
{
201202
struct dlm_rsb *r;
202203
uint32_t hash, bucket;
@@ -232,7 +233,7 @@ static struct dlm_rsb *find_rsb_root(struct dlm_ls *ls, char *name, int len)
232233
for rsb's we're master of and whose directory node matches the requesting
233234
node. inbuf is the rsb name last sent, inlen is the name's length */
234235

235-
void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen,
236+
void dlm_copy_master_names(struct dlm_ls *ls, const char *inbuf, int inlen,
236237
char *outbuf, int outlen, int nodeid)
237238
{
238239
struct list_head *list;
@@ -245,9 +246,8 @@ void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen,
245246
if (inlen > 1) {
246247
r = find_rsb_root(ls, inbuf, inlen);
247248
if (!r) {
248-
inbuf[inlen - 1] = '\0';
249-
log_error(ls, "copy_master_names from %d start %d %s",
250-
nodeid, inlen, inbuf);
249+
log_error(ls, "copy_master_names from %d start %d %.*s",
250+
nodeid, inlen, inlen, inbuf);
251251
goto out;
252252
}
253253
list = r->res_root_list.next;

fs/dlm/dir.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
int dlm_dir_nodeid(struct dlm_rsb *rsb);
1616
int dlm_hash2nodeid(struct dlm_ls *ls, uint32_t hash);
1717
void dlm_recover_dir_nodeid(struct dlm_ls *ls);
18-
int dlm_recover_directory(struct dlm_ls *ls);
19-
void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen,
20-
char *outbuf, int outlen, int nodeid);
18+
int dlm_recover_directory(struct dlm_ls *ls, uint64_t seq);
19+
void dlm_copy_master_names(struct dlm_ls *ls, const char *inbuf, int inlen,
20+
char *outbuf, int outlen, int nodeid);
2121

2222
#endif /* __DIR_DOT_H__ */
2323

fs/dlm/dlm_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ struct dlm_ls {
598598
struct dentry *ls_debug_locks_dentry; /* debugfs */
599599
struct dentry *ls_debug_all_dentry; /* debugfs */
600600
struct dentry *ls_debug_toss_dentry; /* debugfs */
601+
struct dentry *ls_debug_queued_asts_dentry; /* debugfs */
601602

602603
wait_queue_head_t ls_uevent_wait; /* user part of join/leave */
603604
int ls_uevent_result;

0 commit comments

Comments
 (0)