@@ -4549,7 +4549,7 @@ static int nla_put_notification_header(struct sk_buff *msg,
45494549 return drbd_notification_header_to_skb (msg , & nh , true);
45504550}
45514551
4552- void notify_resource_state (struct sk_buff * skb ,
4552+ int notify_resource_state (struct sk_buff * skb ,
45534553 unsigned int seq ,
45544554 struct drbd_resource * resource ,
45554555 struct resource_info * resource_info ,
@@ -4591,16 +4591,17 @@ void notify_resource_state(struct sk_buff *skb,
45914591 if (err && err != - ESRCH )
45924592 goto failed ;
45934593 }
4594- return ;
4594+ return 0 ;
45954595
45964596nla_put_failure :
45974597 nlmsg_free (skb );
45984598failed :
45994599 drbd_err (resource , "Error %d while broadcasting event. Event seq:%u\n" ,
46004600 err , seq );
4601+ return err ;
46014602}
46024603
4603- void notify_device_state (struct sk_buff * skb ,
4604+ int notify_device_state (struct sk_buff * skb ,
46044605 unsigned int seq ,
46054606 struct drbd_device * device ,
46064607 struct device_info * device_info ,
@@ -4640,16 +4641,17 @@ void notify_device_state(struct sk_buff *skb,
46404641 if (err && err != - ESRCH )
46414642 goto failed ;
46424643 }
4643- return ;
4644+ return 0 ;
46444645
46454646nla_put_failure :
46464647 nlmsg_free (skb );
46474648failed :
46484649 drbd_err (device , "Error %d while broadcasting event. Event seq:%u\n" ,
46494650 err , seq );
4651+ return err ;
46504652}
46514653
4652- void notify_connection_state (struct sk_buff * skb ,
4654+ int notify_connection_state (struct sk_buff * skb ,
46534655 unsigned int seq ,
46544656 struct drbd_connection * connection ,
46554657 struct connection_info * connection_info ,
@@ -4689,16 +4691,17 @@ void notify_connection_state(struct sk_buff *skb,
46894691 if (err && err != - ESRCH )
46904692 goto failed ;
46914693 }
4692- return ;
4694+ return 0 ;
46934695
46944696nla_put_failure :
46954697 nlmsg_free (skb );
46964698failed :
46974699 drbd_err (connection , "Error %d while broadcasting event. Event seq:%u\n" ,
46984700 err , seq );
4701+ return err ;
46994702}
47004703
4701- void notify_peer_device_state (struct sk_buff * skb ,
4704+ int notify_peer_device_state (struct sk_buff * skb ,
47024705 unsigned int seq ,
47034706 struct drbd_peer_device * peer_device ,
47044707 struct peer_device_info * peer_device_info ,
@@ -4739,13 +4742,14 @@ void notify_peer_device_state(struct sk_buff *skb,
47394742 if (err && err != - ESRCH )
47404743 goto failed ;
47414744 }
4742- return ;
4745+ return 0 ;
47434746
47444747nla_put_failure :
47454748 nlmsg_free (skb );
47464749failed :
47474750 drbd_err (peer_device , "Error %d while broadcasting event. Event seq:%u\n" ,
47484751 err , seq );
4752+ return err ;
47494753}
47504754
47514755void notify_helper (enum drbd_notification_type type ,
@@ -4796,7 +4800,7 @@ void notify_helper(enum drbd_notification_type type,
47964800 err , seq );
47974801}
47984802
4799- static void notify_initial_state_done (struct sk_buff * skb , unsigned int seq )
4803+ static int notify_initial_state_done (struct sk_buff * skb , unsigned int seq )
48004804{
48014805 struct drbd_genlmsghdr * dh ;
48024806 int err ;
@@ -4810,11 +4814,12 @@ static void notify_initial_state_done(struct sk_buff *skb, unsigned int seq)
48104814 if (nla_put_notification_header (skb , NOTIFY_EXISTS ))
48114815 goto nla_put_failure ;
48124816 genlmsg_end (skb , dh );
4813- return ;
4817+ return 0 ;
48144818
48154819nla_put_failure :
48164820 nlmsg_free (skb );
48174821 pr_err ("Error %d sending event. Event seq:%u\n" , err , seq );
4822+ return err ;
48184823}
48194824
48204825static void free_state_changes (struct list_head * list )
@@ -4841,6 +4846,7 @@ static int get_initial_state(struct sk_buff *skb, struct netlink_callback *cb)
48414846 unsigned int seq = cb -> args [2 ];
48424847 unsigned int n ;
48434848 enum drbd_notification_type flags = 0 ;
4849+ int err = 0 ;
48444850
48454851 /* There is no need for taking notification_mutex here: it doesn't
48464852 matter if the initial state events mix with later state chage
@@ -4849,32 +4855,32 @@ static int get_initial_state(struct sk_buff *skb, struct netlink_callback *cb)
48494855
48504856 cb -> args [5 ]-- ;
48514857 if (cb -> args [5 ] == 1 ) {
4852- notify_initial_state_done (skb , seq );
4858+ err = notify_initial_state_done (skb , seq );
48534859 goto out ;
48544860 }
48554861 n = cb -> args [4 ]++ ;
48564862 if (cb -> args [4 ] < cb -> args [3 ])
48574863 flags |= NOTIFY_CONTINUES ;
48584864 if (n < 1 ) {
4859- notify_resource_state_change (skb , seq , state_change -> resource ,
4865+ err = notify_resource_state_change (skb , seq , state_change -> resource ,
48604866 NOTIFY_EXISTS | flags );
48614867 goto next ;
48624868 }
48634869 n -- ;
48644870 if (n < state_change -> n_connections ) {
4865- notify_connection_state_change (skb , seq , & state_change -> connections [n ],
4871+ err = notify_connection_state_change (skb , seq , & state_change -> connections [n ],
48664872 NOTIFY_EXISTS | flags );
48674873 goto next ;
48684874 }
48694875 n -= state_change -> n_connections ;
48704876 if (n < state_change -> n_devices ) {
4871- notify_device_state_change (skb , seq , & state_change -> devices [n ],
4877+ err = notify_device_state_change (skb , seq , & state_change -> devices [n ],
48724878 NOTIFY_EXISTS | flags );
48734879 goto next ;
48744880 }
48754881 n -= state_change -> n_devices ;
48764882 if (n < state_change -> n_devices * state_change -> n_connections ) {
4877- notify_peer_device_state_change (skb , seq , & state_change -> peer_devices [n ],
4883+ err = notify_peer_device_state_change (skb , seq , & state_change -> peer_devices [n ],
48784884 NOTIFY_EXISTS | flags );
48794885 goto next ;
48804886 }
@@ -4889,7 +4895,10 @@ static int get_initial_state(struct sk_buff *skb, struct netlink_callback *cb)
48894895 cb -> args [4 ] = 0 ;
48904896 }
48914897out :
4892- return skb -> len ;
4898+ if (err )
4899+ return err ;
4900+ else
4901+ return skb -> len ;
48934902}
48944903
48954904int drbd_adm_get_initial_state (struct sk_buff * skb , struct netlink_callback * cb )
0 commit comments