Skip to content

Commit 964a4ea

Browse files
committed
Merge tag 'dlm-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Pull dlm updates from David Teigland: "This set removes some unnecessary debugfs error handling, and checks that lowcomms workqueues are not NULL before destroying" * tag 'dlm-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm: dlm: no need to check return value of debugfs_create functions dlm: check if workqueues are NULL before flushing/destroying
2 parents 23bbbf5 + a48f972 commit 964a4ea

4 files changed

Lines changed: 19 additions & 33 deletions

File tree

‎fs/dlm/debug_fs.c‎

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ void dlm_delete_debug_file(struct dlm_ls *ls)
737737
debugfs_remove(ls->ls_debug_toss_dentry);
738738
}
739739

740-
int dlm_create_debug_file(struct dlm_ls *ls)
740+
void dlm_create_debug_file(struct dlm_ls *ls)
741741
{
742742
char name[DLM_LOCKSPACE_LEN + 8];
743743

@@ -748,8 +748,6 @@ int dlm_create_debug_file(struct dlm_ls *ls)
748748
dlm_root,
749749
ls,
750750
&format1_fops);
751-
if (!ls->ls_debug_rsb_dentry)
752-
goto fail;
753751

754752
/* format 2 */
755753

@@ -761,8 +759,6 @@ int dlm_create_debug_file(struct dlm_ls *ls)
761759
dlm_root,
762760
ls,
763761
&format2_fops);
764-
if (!ls->ls_debug_locks_dentry)
765-
goto fail;
766762

767763
/* format 3 */
768764

@@ -774,8 +770,6 @@ int dlm_create_debug_file(struct dlm_ls *ls)
774770
dlm_root,
775771
ls,
776772
&format3_fops);
777-
if (!ls->ls_debug_all_dentry)
778-
goto fail;
779773

780774
/* format 4 */
781775

@@ -787,8 +781,6 @@ int dlm_create_debug_file(struct dlm_ls *ls)
787781
dlm_root,
788782
ls,
789783
&format4_fops);
790-
if (!ls->ls_debug_toss_dentry)
791-
goto fail;
792784

793785
memset(name, 0, sizeof(name));
794786
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name);
@@ -798,21 +790,12 @@ int dlm_create_debug_file(struct dlm_ls *ls)
798790
dlm_root,
799791
ls,
800792
&waiters_fops);
801-
if (!ls->ls_debug_waiters_dentry)
802-
goto fail;
803-
804-
return 0;
805-
806-
fail:
807-
dlm_delete_debug_file(ls);
808-
return -ENOMEM;
809793
}
810794

811-
int __init dlm_register_debugfs(void)
795+
void __init dlm_register_debugfs(void)
812796
{
813797
mutex_init(&debug_buf_lock);
814798
dlm_root = debugfs_create_dir("dlm", NULL);
815-
return dlm_root ? 0 : -ENOMEM;
816799
}
817800

818801
void dlm_unregister_debugfs(void)

‎fs/dlm/dlm_internal.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,14 +719,14 @@ int dlm_plock_init(void);
719719
void dlm_plock_exit(void);
720720

721721
#ifdef CONFIG_DLM_DEBUG
722-
int dlm_register_debugfs(void);
722+
void dlm_register_debugfs(void);
723723
void dlm_unregister_debugfs(void);
724-
int dlm_create_debug_file(struct dlm_ls *ls);
724+
void dlm_create_debug_file(struct dlm_ls *ls);
725725
void dlm_delete_debug_file(struct dlm_ls *ls);
726726
#else
727-
static inline int dlm_register_debugfs(void) { return 0; }
727+
static inline void dlm_register_debugfs(void) { }
728728
static inline void dlm_unregister_debugfs(void) { }
729-
static inline int dlm_create_debug_file(struct dlm_ls *ls) { return 0; }
729+
static inline void dlm_create_debug_file(struct dlm_ls *ls) { }
730730
static inline void dlm_delete_debug_file(struct dlm_ls *ls) { }
731731
#endif
732732

‎fs/dlm/lowcomms.c‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,8 +1628,10 @@ static void clean_writequeues(void)
16281628

16291629
static void work_stop(void)
16301630
{
1631-
destroy_workqueue(recv_workqueue);
1632-
destroy_workqueue(send_workqueue);
1631+
if (recv_workqueue)
1632+
destroy_workqueue(recv_workqueue);
1633+
if (send_workqueue)
1634+
destroy_workqueue(send_workqueue);
16331635
}
16341636

16351637
static int work_start(void)
@@ -1689,13 +1691,17 @@ static void work_flush(void)
16891691
struct hlist_node *n;
16901692
struct connection *con;
16911693

1692-
flush_workqueue(recv_workqueue);
1693-
flush_workqueue(send_workqueue);
1694+
if (recv_workqueue)
1695+
flush_workqueue(recv_workqueue);
1696+
if (send_workqueue)
1697+
flush_workqueue(send_workqueue);
16941698
do {
16951699
ok = 1;
16961700
foreach_conn(stop_conn);
1697-
flush_workqueue(recv_workqueue);
1698-
flush_workqueue(send_workqueue);
1701+
if (recv_workqueue)
1702+
flush_workqueue(recv_workqueue);
1703+
if (send_workqueue)
1704+
flush_workqueue(send_workqueue);
16991705
for (i = 0; i < CONN_HASH_SIZE && ok; i++) {
17001706
hlist_for_each_entry_safe(con, n,
17011707
&connection_hash[i], list) {

‎fs/dlm/main.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ static int __init init_dlm(void)
3535
if (error)
3636
goto out_lockspace;
3737

38-
error = dlm_register_debugfs();
39-
if (error)
40-
goto out_config;
38+
dlm_register_debugfs();
4139

4240
error = dlm_user_init();
4341
if (error)
@@ -61,7 +59,6 @@ static int __init init_dlm(void)
6159
dlm_user_exit();
6260
out_debug:
6361
dlm_unregister_debugfs();
64-
out_config:
6562
dlm_config_exit();
6663
out_lockspace:
6764
dlm_lockspace_exit();

0 commit comments

Comments
 (0)