mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
dlm for 7.2
There are four fixes/cleanups in this series; none are likely to be issues in real usage: - improve debugfs error exit path - fix sequence number ordering in an artificial test case - fix usercopy_abort for lvb data - use hlist_for_each_entry_srcu for srcu lists -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEcGkeEvkvjdvlR90nOBtzx/yAaaoFAmowKlsACgkQOBtzx/yA aap6Kw//Zee3ZGEYREY6W71NdBd+P8cp86ej8kuL2maqGg74r57bXCbz9CZUm7wH pIZ7OhjYztYpgQjrtCqOgJ/KTkgpyA1OxNI5p1XeCIjiXsAVnBiW3Pay6ZDV6yQP ZPINZ4Ei3UOqQ90EMIbwO8J1ola+6qrd4Ojo4bzXaMN8c+Mf81ioclKPv76ldGaw H+rjTCL9o382ExF/3Xf4jPpMkq5z6FJj4nykv1UznweYEmFw3e1BeqtPBQArV9nh /aAEXuhDSJjBdmiAEzBbQLGnUZAeQ7+lIGHMLQ1+unVU7B5i1PnFw/A3nT9X/x3W tYdq95jo20nXBH8fAItiDYbLyd+RcOJvmaMoaqR/jnZaiZ9zSKrvPEjXD+Yg6xtx HH8AwQSqkdnBw8t2PcysrOXkQWpXaWJeNY+TkU0GlFnfJpj2RewnFRj9uzRFthGQ pxRV9rFtEX7dYuVqPiuUWtS4667XhFJRu2w1YEyJvgCRjhl5ADvKuRARh484RKu3 OlWEpgEmW00BHtpuZYhPS2oGvmhDGl9Q3+1lmeySOAhODAQw8QQEnnIVQcxaXvUI 747E+J6qHlYBV6SHHt/RjZSAi5ViUyx6rZx9vPJNpt7VQPZzKxjGoTnr1DB7lDij WzT29aWd2rZTPxYhBfwl918cscvV6cphgFh8Wvqvaf3q8hDUjEw= =E+94 -----END PGP SIGNATURE----- Merge tag 'dlm-7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm Pull dlm updates from David Teigland: "There are four fixes/cleanups in this series; none are likely to be issues in real usage: - improve debugfs error exit path - fix sequence number ordering in an artificial test case - fix usercopy_abort for lvb data - use hlist_for_each_entry_srcu for srcu lists" * tag 'dlm-7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm: dlm: init per node debugfs before add to node hash dlm: fix add msg handle in send_queue ordered dlm: add usercopy whitelist to dlm_cb cache dlm: use hlist_for_each_entry_srcu for SRCU protected lists
This commit is contained in:
commit
477c122f8c
|
|
@ -271,7 +271,8 @@ static struct connection *__find_con(int nodeid, int r)
|
|||
{
|
||||
struct connection *con;
|
||||
|
||||
hlist_for_each_entry_rcu(con, &connection_hash[r], list) {
|
||||
hlist_for_each_entry_srcu(con, &connection_hash[r], list,
|
||||
srcu_read_lock_held(&connections_srcu)) {
|
||||
if (con->nodeid == nodeid)
|
||||
return con;
|
||||
}
|
||||
|
|
@ -426,7 +427,8 @@ static int addr_to_nodeid(struct sockaddr_storage *addr, int *nodeid,
|
|||
|
||||
idx = srcu_read_lock(&connections_srcu);
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++) {
|
||||
hlist_for_each_entry_rcu(con, &connection_hash[i], list) {
|
||||
hlist_for_each_entry_srcu(con, &connection_hash[i], list,
|
||||
srcu_read_lock_held(&connections_srcu)) {
|
||||
WARN_ON_ONCE(!con->addr_count);
|
||||
|
||||
spin_lock(&con->addrs_lock);
|
||||
|
|
@ -1729,7 +1731,8 @@ void dlm_lowcomms_shutdown(void)
|
|||
|
||||
idx = srcu_read_lock(&connections_srcu);
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++) {
|
||||
hlist_for_each_entry_rcu(con, &connection_hash[i], list) {
|
||||
hlist_for_each_entry_srcu(con, &connection_hash[i], list,
|
||||
srcu_read_lock_held(&connections_srcu)) {
|
||||
shutdown_connection(con, true);
|
||||
stop_connection_io(con);
|
||||
flush_workqueue(process_workqueue);
|
||||
|
|
@ -1968,7 +1971,8 @@ void dlm_lowcomms_exit(void)
|
|||
|
||||
idx = srcu_read_lock(&connections_srcu);
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++) {
|
||||
hlist_for_each_entry_rcu(con, &connection_hash[i], list) {
|
||||
hlist_for_each_entry_srcu(con, &connection_hash[i], list,
|
||||
srcu_read_lock_held(&connections_srcu)) {
|
||||
spin_lock(&connections_lock);
|
||||
hlist_del_rcu(&con->list);
|
||||
spin_unlock(&connections_lock);
|
||||
|
|
|
|||
|
|
@ -48,8 +48,10 @@ int __init dlm_memory_init(void)
|
|||
if (!rsb_cache)
|
||||
goto rsb;
|
||||
|
||||
cb_cache = kmem_cache_create("dlm_cb", sizeof(struct dlm_callback),
|
||||
cb_cache = kmem_cache_create_usercopy("dlm_cb", sizeof(struct dlm_callback),
|
||||
__alignof__(struct dlm_callback), 0,
|
||||
offsetof(struct dlm_callback, lvbptr),
|
||||
sizeof_field(struct dlm_callback, lvbptr),
|
||||
NULL);
|
||||
if (!cb_cache)
|
||||
goto cb;
|
||||
|
|
|
|||
|
|
@ -275,7 +275,8 @@ static struct midcomms_node *__find_node(int nodeid, int r)
|
|||
{
|
||||
struct midcomms_node *node;
|
||||
|
||||
hlist_for_each_entry_rcu(node, &node_hash[r], hlist) {
|
||||
hlist_for_each_entry_srcu(node, &node_hash[r], hlist,
|
||||
srcu_read_lock_held(&nodes_srcu)) {
|
||||
if (node->nodeid == nodeid)
|
||||
return node;
|
||||
}
|
||||
|
|
@ -355,6 +356,7 @@ int dlm_midcomms_addr(int nodeid, struct sockaddr_storage *addr)
|
|||
if (!node)
|
||||
return -ENOMEM;
|
||||
|
||||
node->debugfs = dlm_create_debug_comms_file(nodeid, node);
|
||||
node->nodeid = nodeid;
|
||||
spin_lock_init(&node->state_lock);
|
||||
spin_lock_init(&node->send_queue_lock);
|
||||
|
|
@ -368,7 +370,6 @@ int dlm_midcomms_addr(int nodeid, struct sockaddr_storage *addr)
|
|||
hlist_add_head_rcu(&node->hlist, &node_hash[r]);
|
||||
spin_unlock_bh(&nodes_lock);
|
||||
|
||||
node->debugfs = dlm_create_debug_comms_file(nodeid, node);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -968,10 +969,10 @@ static void midcomms_new_msg_cb(void *data)
|
|||
atomic_inc(&mh->node->send_queue_cnt);
|
||||
|
||||
spin_lock_bh(&mh->node->send_queue_lock);
|
||||
/* need to be locked with list_add_tail_rcu() because list is ordered */
|
||||
mh->seq = atomic_fetch_inc(&mh->node->seq_send);
|
||||
list_add_tail_rcu(&mh->list, &mh->node->send_queue);
|
||||
spin_unlock_bh(&mh->node->send_queue_lock);
|
||||
|
||||
mh->seq = atomic_fetch_inc(&mh->node->seq_send);
|
||||
}
|
||||
|
||||
static struct dlm_msg *dlm_midcomms_get_msg_3_2(struct dlm_mhandle *mh, int nodeid,
|
||||
|
|
@ -1165,7 +1166,8 @@ void dlm_midcomms_exit(void)
|
|||
|
||||
idx = srcu_read_lock(&nodes_srcu);
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++) {
|
||||
hlist_for_each_entry_rcu(node, &node_hash[i], hlist) {
|
||||
hlist_for_each_entry_srcu(node, &node_hash[i], hlist,
|
||||
srcu_read_lock_held(&nodes_srcu)) {
|
||||
dlm_delete_debug_comms_file(node->debugfs);
|
||||
|
||||
spin_lock(&nodes_lock);
|
||||
|
|
@ -1325,7 +1327,8 @@ void dlm_midcomms_version_wait(void)
|
|||
|
||||
idx = srcu_read_lock(&nodes_srcu);
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++) {
|
||||
hlist_for_each_entry_rcu(node, &node_hash[i], hlist) {
|
||||
hlist_for_each_entry_srcu(node, &node_hash[i], hlist,
|
||||
srcu_read_lock_held(&nodes_srcu)) {
|
||||
ret = wait_event_timeout(node->shutdown_wait,
|
||||
node->version != DLM_VERSION_NOT_SET ||
|
||||
node->state == DLM_CLOSED ||
|
||||
|
|
@ -1396,7 +1399,8 @@ void dlm_midcomms_shutdown(void)
|
|||
mutex_lock(&close_lock);
|
||||
idx = srcu_read_lock(&nodes_srcu);
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++) {
|
||||
hlist_for_each_entry_rcu(node, &node_hash[i], hlist) {
|
||||
hlist_for_each_entry_srcu(node, &node_hash[i], hlist,
|
||||
srcu_read_lock_held(&nodes_srcu)) {
|
||||
midcomms_shutdown(node);
|
||||
}
|
||||
}
|
||||
|
|
@ -1404,7 +1408,8 @@ void dlm_midcomms_shutdown(void)
|
|||
dlm_lowcomms_shutdown();
|
||||
|
||||
for (i = 0; i < CONN_HASH_SIZE; i++) {
|
||||
hlist_for_each_entry_rcu(node, &node_hash[i], hlist) {
|
||||
hlist_for_each_entry_srcu(node, &node_hash[i], hlist,
|
||||
srcu_read_lock_held(&nodes_srcu)) {
|
||||
midcomms_node_reset(node);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user