.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | drbd_state.c |
---|
3 | 4 | |
---|
.. | .. |
---|
10 | 11 | Thanks to Carter Burden, Bart Grantham and Gennadiy Nerubayev |
---|
11 | 12 | from Logicworks, Inc. for making SDP replication support possible. |
---|
12 | 13 | |
---|
13 | | - drbd is free software; you can redistribute it and/or modify |
---|
14 | | - it under the terms of the GNU General Public License as published by |
---|
15 | | - the Free Software Foundation; either version 2, or (at your option) |
---|
16 | | - any later version. |
---|
17 | | - |
---|
18 | | - drbd is distributed in the hope that it will be useful, |
---|
19 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
20 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
21 | | - GNU General Public License for more details. |
---|
22 | | - |
---|
23 | | - You should have received a copy of the GNU General Public License |
---|
24 | | - along with drbd; see the file COPYING. If not, write to |
---|
25 | | - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
26 | 14 | */ |
---|
27 | 15 | |
---|
28 | 16 | #include <linux/drbd_limits.h> |
---|
.. | .. |
---|
1122 | 1110 | ns.pdsk = D_UP_TO_DATE; |
---|
1123 | 1111 | } |
---|
1124 | 1112 | |
---|
1125 | | - /* Implications of the connection stat on the disk states */ |
---|
| 1113 | + /* Implications of the connection state on the disk states */ |
---|
1126 | 1114 | disk_min = D_DISKLESS; |
---|
1127 | 1115 | disk_max = D_UP_TO_DATE; |
---|
1128 | 1116 | pdsk_min = D_INCONSISTENT; |
---|
.. | .. |
---|
1549 | 1537 | return rv; |
---|
1550 | 1538 | } |
---|
1551 | 1539 | |
---|
1552 | | -void notify_resource_state_change(struct sk_buff *skb, |
---|
| 1540 | +int notify_resource_state_change(struct sk_buff *skb, |
---|
1553 | 1541 | unsigned int seq, |
---|
1554 | 1542 | struct drbd_resource_state_change *resource_state_change, |
---|
1555 | 1543 | enum drbd_notification_type type) |
---|
.. | .. |
---|
1562 | 1550 | .res_susp_fen = resource_state_change->susp_fen[NEW], |
---|
1563 | 1551 | }; |
---|
1564 | 1552 | |
---|
1565 | | - notify_resource_state(skb, seq, resource, &resource_info, type); |
---|
| 1553 | + return notify_resource_state(skb, seq, resource, &resource_info, type); |
---|
1566 | 1554 | } |
---|
1567 | 1555 | |
---|
1568 | | -void notify_connection_state_change(struct sk_buff *skb, |
---|
| 1556 | +int notify_connection_state_change(struct sk_buff *skb, |
---|
1569 | 1557 | unsigned int seq, |
---|
1570 | 1558 | struct drbd_connection_state_change *connection_state_change, |
---|
1571 | 1559 | enum drbd_notification_type type) |
---|
.. | .. |
---|
1576 | 1564 | .conn_role = connection_state_change->peer_role[NEW], |
---|
1577 | 1565 | }; |
---|
1578 | 1566 | |
---|
1579 | | - notify_connection_state(skb, seq, connection, &connection_info, type); |
---|
| 1567 | + return notify_connection_state(skb, seq, connection, &connection_info, type); |
---|
1580 | 1568 | } |
---|
1581 | 1569 | |
---|
1582 | | -void notify_device_state_change(struct sk_buff *skb, |
---|
| 1570 | +int notify_device_state_change(struct sk_buff *skb, |
---|
1583 | 1571 | unsigned int seq, |
---|
1584 | 1572 | struct drbd_device_state_change *device_state_change, |
---|
1585 | 1573 | enum drbd_notification_type type) |
---|
.. | .. |
---|
1589 | 1577 | .dev_disk_state = device_state_change->disk_state[NEW], |
---|
1590 | 1578 | }; |
---|
1591 | 1579 | |
---|
1592 | | - notify_device_state(skb, seq, device, &device_info, type); |
---|
| 1580 | + return notify_device_state(skb, seq, device, &device_info, type); |
---|
1593 | 1581 | } |
---|
1594 | 1582 | |
---|
1595 | | -void notify_peer_device_state_change(struct sk_buff *skb, |
---|
| 1583 | +int notify_peer_device_state_change(struct sk_buff *skb, |
---|
1596 | 1584 | unsigned int seq, |
---|
1597 | 1585 | struct drbd_peer_device_state_change *p, |
---|
1598 | 1586 | enum drbd_notification_type type) |
---|
.. | .. |
---|
1606 | 1594 | .peer_resync_susp_dependency = p->resync_susp_dependency[NEW], |
---|
1607 | 1595 | }; |
---|
1608 | 1596 | |
---|
1609 | | - notify_peer_device_state(skb, seq, peer_device, &peer_device_info, type); |
---|
| 1597 | + return notify_peer_device_state(skb, seq, peer_device, &peer_device_info, type); |
---|
1610 | 1598 | } |
---|
1611 | 1599 | |
---|
1612 | 1600 | static void broadcast_state_change(struct drbd_state_change *state_change) |
---|
.. | .. |
---|
1614 | 1602 | struct drbd_resource_state_change *resource_state_change = &state_change->resource[0]; |
---|
1615 | 1603 | bool resource_state_has_changed; |
---|
1616 | 1604 | unsigned int n_device, n_connection, n_peer_device, n_peer_devices; |
---|
1617 | | - void (*last_func)(struct sk_buff *, unsigned int, void *, |
---|
| 1605 | + int (*last_func)(struct sk_buff *, unsigned int, void *, |
---|
1618 | 1606 | enum drbd_notification_type) = NULL; |
---|
1619 | | - void *uninitialized_var(last_arg); |
---|
| 1607 | + void *last_arg = NULL; |
---|
1620 | 1608 | |
---|
1621 | 1609 | #define HAS_CHANGED(state) ((state)[OLD] != (state)[NEW]) |
---|
1622 | 1610 | #define FINAL_STATE_CHANGE(type) \ |
---|
.. | .. |
---|
2107 | 2095 | spin_unlock_irq(&connection->resource->req_lock); |
---|
2108 | 2096 | } |
---|
2109 | 2097 | } |
---|
2110 | | - kref_put(&connection->kref, drbd_destroy_connection); |
---|
2111 | | - |
---|
2112 | 2098 | conn_md_sync(connection); |
---|
| 2099 | + kref_put(&connection->kref, drbd_destroy_connection); |
---|
2113 | 2100 | |
---|
2114 | 2101 | return 0; |
---|
2115 | 2102 | } |
---|