Skip to content

Commit 2c3fa6a

Browse files
Alexander Aringteigland
authored andcommitted
dlm: check required context while close
This patch adds a WARN_ON() check to validate the right context while dlm_midcomms_close() is called. Even before commit 489d8e5 ("fs: dlm: add reliable connection if reconnect") in this context dlm_lowcomms_close() flushes all ongoing transmission triggered by dlm application stack. If we do that, it's required that no new message will be triggered by the dlm application stack. The function dlm_midcomms_close() is not called often so we can check if all lockspaces are in such context. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 4015974 commit 2c3fa6a

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

fs/dlm/lockspace.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,3 +922,15 @@ void dlm_stop_lockspaces(void)
922922
log_print("dlm user daemon left %d lockspaces", count);
923923
}
924924

925+
void dlm_stop_lockspaces_check(void)
926+
{
927+
struct dlm_ls *ls;
928+
929+
spin_lock(&lslist_lock);
930+
list_for_each_entry(ls, &lslist, ls_list) {
931+
if (WARN_ON(!rwsem_is_locked(&ls->ls_in_recovery) ||
932+
!dlm_locking_stopped(ls)))
933+
break;
934+
}
935+
spin_unlock(&lslist_lock);
936+
}

fs/dlm/lockspace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct dlm_ls *dlm_find_lockspace_local(void *id);
1919
struct dlm_ls *dlm_find_lockspace_device(int minor);
2020
void dlm_put_lockspace(struct dlm_ls *ls);
2121
void dlm_stop_lockspaces(void);
22+
void dlm_stop_lockspaces_check(void);
2223

2324
#endif /* __LOCKSPACE_DOT_H__ */
2425

fs/dlm/midcomms.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
#include <net/tcp.h>
136136

137137
#include "dlm_internal.h"
138+
#include "lockspace.h"
138139
#include "lowcomms.h"
139140
#include "config.h"
140141
#include "memory.h"
@@ -1412,6 +1413,8 @@ int dlm_midcomms_close(int nodeid)
14121413
if (nodeid == dlm_our_nodeid())
14131414
return 0;
14141415

1416+
dlm_stop_lockspaces_check();
1417+
14151418
idx = srcu_read_lock(&nodes_srcu);
14161419
/* Abort pending close/remove operation */
14171420
node = nodeid2node(nodeid, 0);

0 commit comments

Comments
 (0)