Whamcloud - gitweb
LU-2855 kuc: error management in KUC broadcast delivery
authorThomas Leibovici <thomas.leibovici@cea.fr>
Sun, 24 Feb 2013 13:08:47 +0000 (14:08 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 7 Mar 2013 00:41:04 +0000 (19:41 -0500)
In KUC broadcast groups, the message delivery fails if
a userland process terminates without closing its kuc
channel properly.
This patch improves the behavior of KUC broadcast groups,
to make it more adapted for broadcast usage: the message
delivery is successful if at least 1 userland process is
present in this group and receives
the message successfully.

Signed-off-by: Thomas Leibovici <thomas.leibovici@cea.fr>
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Change-Id: I2a121c7cfcaa6c2ee5ac48b721668bf2f254d848
Reviewed-on: http://review.whamcloud.com/5521
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/libcfs/kernel_user_comm.c

index 228f828..47b9a86 100644 (file)
@@ -273,23 +273,31 @@ CFS_EXPORT_SYMBOL(libcfs_kkuc_group_rem);
 
 int libcfs_kkuc_group_put(int group, void *payload)
 {
 
 int libcfs_kkuc_group_put(int group, void *payload)
 {
-        struct kkuc_reg *reg;
-        int rc = 0;
-        ENTRY;
+       struct kkuc_reg *reg;
+       int              rc = 0;
+       int one_success = 0;
+       ENTRY;
 
        down_read(&kg_sem);
 
        down_read(&kg_sem);
-        cfs_list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
-                if (reg->kr_fp != NULL) {
-                rc = libcfs_kkuc_msg_put(reg->kr_fp, payload);
-                        if (rc == -EPIPE) {
-                                cfs_put_file(reg->kr_fp);
-                                reg->kr_fp = NULL;
-                        }
-                }
-        }
+       cfs_list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
+               if (reg->kr_fp != NULL) {
+                       rc = libcfs_kkuc_msg_put(reg->kr_fp, payload);
+                       if (rc == 0)
+                               one_success = 1;
+                       else if (rc == -EPIPE) {
+                               cfs_put_file(reg->kr_fp);
+                               reg->kr_fp = NULL;
+                       }
+               }
+       }
        up_read(&kg_sem);
 
        up_read(&kg_sem);
 
-        RETURN(rc);
+       /* don't return an error if the message has been delivered
+        * at least to one agent */
+       if (one_success)
+               rc = 0;
+
+       RETURN(rc);
 }
 CFS_EXPORT_SYMBOL(libcfs_kkuc_group_put);
 
 }
 CFS_EXPORT_SYMBOL(libcfs_kkuc_group_put);