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>
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;
- 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;
+ }
+ }
+ }
+ /* 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);