hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/block/drbd/drbd_state.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 drbd_state.c
34
....@@ -10,19 +11,6 @@
1011 Thanks to Carter Burden, Bart Grantham and Gennadiy Nerubayev
1112 from Logicworks, Inc. for making SDP replication support possible.
1213
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.
2614 */
2715
2816 #include <linux/drbd_limits.h>
....@@ -1122,7 +1110,7 @@
11221110 ns.pdsk = D_UP_TO_DATE;
11231111 }
11241112
1125
- /* Implications of the connection stat on the disk states */
1113
+ /* Implications of the connection state on the disk states */
11261114 disk_min = D_DISKLESS;
11271115 disk_max = D_UP_TO_DATE;
11281116 pdsk_min = D_INCONSISTENT;
....@@ -1549,7 +1537,7 @@
15491537 return rv;
15501538 }
15511539
1552
-void notify_resource_state_change(struct sk_buff *skb,
1540
+int notify_resource_state_change(struct sk_buff *skb,
15531541 unsigned int seq,
15541542 struct drbd_resource_state_change *resource_state_change,
15551543 enum drbd_notification_type type)
....@@ -1562,10 +1550,10 @@
15621550 .res_susp_fen = resource_state_change->susp_fen[NEW],
15631551 };
15641552
1565
- notify_resource_state(skb, seq, resource, &resource_info, type);
1553
+ return notify_resource_state(skb, seq, resource, &resource_info, type);
15661554 }
15671555
1568
-void notify_connection_state_change(struct sk_buff *skb,
1556
+int notify_connection_state_change(struct sk_buff *skb,
15691557 unsigned int seq,
15701558 struct drbd_connection_state_change *connection_state_change,
15711559 enum drbd_notification_type type)
....@@ -1576,10 +1564,10 @@
15761564 .conn_role = connection_state_change->peer_role[NEW],
15771565 };
15781566
1579
- notify_connection_state(skb, seq, connection, &connection_info, type);
1567
+ return notify_connection_state(skb, seq, connection, &connection_info, type);
15801568 }
15811569
1582
-void notify_device_state_change(struct sk_buff *skb,
1570
+int notify_device_state_change(struct sk_buff *skb,
15831571 unsigned int seq,
15841572 struct drbd_device_state_change *device_state_change,
15851573 enum drbd_notification_type type)
....@@ -1589,10 +1577,10 @@
15891577 .dev_disk_state = device_state_change->disk_state[NEW],
15901578 };
15911579
1592
- notify_device_state(skb, seq, device, &device_info, type);
1580
+ return notify_device_state(skb, seq, device, &device_info, type);
15931581 }
15941582
1595
-void notify_peer_device_state_change(struct sk_buff *skb,
1583
+int notify_peer_device_state_change(struct sk_buff *skb,
15961584 unsigned int seq,
15971585 struct drbd_peer_device_state_change *p,
15981586 enum drbd_notification_type type)
....@@ -1606,7 +1594,7 @@
16061594 .peer_resync_susp_dependency = p->resync_susp_dependency[NEW],
16071595 };
16081596
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);
16101598 }
16111599
16121600 static void broadcast_state_change(struct drbd_state_change *state_change)
....@@ -1614,9 +1602,9 @@
16141602 struct drbd_resource_state_change *resource_state_change = &state_change->resource[0];
16151603 bool resource_state_has_changed;
16161604 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 *,
16181606 enum drbd_notification_type) = NULL;
1619
- void *uninitialized_var(last_arg);
1607
+ void *last_arg = NULL;
16201608
16211609 #define HAS_CHANGED(state) ((state)[OLD] != (state)[NEW])
16221610 #define FINAL_STATE_CHANGE(type) \
....@@ -2107,9 +2095,8 @@
21072095 spin_unlock_irq(&connection->resource->req_lock);
21082096 }
21092097 }
2110
- kref_put(&connection->kref, drbd_destroy_connection);
2111
-
21122098 conn_md_sync(connection);
2099
+ kref_put(&connection->kref, drbd_destroy_connection);
21132100
21142101 return 0;
21152102 }