From patchwork Wed Mar 11 21:28:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shirshov X-Patchwork-Id: 11432855 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F2FC92C for ; Wed, 11 Mar 2020 21:28:42 +0000 (UTC) Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BBC232074C for ; Wed, 11 Mar 2020 21:28:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBC232074C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=libteam-bounces@lists.fedorahosted.org Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id E66CD6049738; Wed, 11 Mar 2020 21:28:40 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org E66CD6049738 Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id D28FC5D58DA73; Wed, 11 Mar 2020 21:28:40 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 75E6E5D58DA71; Wed, 11 Mar 2020 21:28:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mailman01.phx2.fedoraproject.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-ib01.fedoraproject.org (smtp-mm-ib01.vpn.fedoraproject.org [192.168.1.83]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id BFDC35D58DA68 for ; Wed, 11 Mar 2020 21:28:35 +0000 (UTC) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id 5865A605D2D9 for ; Wed, 11 Mar 2020 21:28:35 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id j20so1699952pll.6 for ; Wed, 11 Mar 2020 14:28:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qWu/QpEqF0Iv2CmIE2dWtby7SjU+uMDWhkBIMKmgRs8=; b=ICIswsalw8R0QvBnc2GERYB1Vk9m8ZBWDeXbFl7OLpR6+rxYe3qLdg8mNtgPB9y3Va h+XcU+n21J8GjxYVhiwauZpjs+SH9PpwClsmfJ/i+e/Fn0w5DUJ87+DINQqDfvHaEBDK AZl8s2i0s+VU2bYgAVOgl2/fyLlejnYKKIz9rk1Qb1oEqmbRdR2O7nR3lqGr6WIHmXvk Q2C2Hrl0pRQ0UjIFk8P4rEenM96aBZ7e88mzJ8NvUu4PdMOus2y890TbgIBzzl3NOpyB Z6AEvoQLRooTy51WJCjGqi13Zaguhcl/U02hro8ZwWBG3a1fLWdrppU9koB7Ef5nezW2 VYgg== X-Gm-Message-State: ANhLgQ0azpLtexiMebGMjy06d940cPnG3ck0vYbx2OJJsTEBLhH0dPWO B5b1NwXZrkgG9DPi+WdCzFAqVUrwacA= X-Google-Smtp-Source: ADFU+vvkxSTvqruQ3FcM4xRDVzPntk+QuFDIE5ab2KS5o4mO/KGUGKyqJJ39OjBM0PkJpgeBdkmegg== X-Received: by 2002:a17:902:b58b:: with SMTP id a11mr5012202pls.9.1583962113976; Wed, 11 Mar 2020 14:28:33 -0700 (PDT) Received: from localhost.localdomain (50-47-141-89.evrt.wa.frontiernet.net. [50.47.141.89]) by smtp.gmail.com with ESMTPSA id 127sm33152471pfb.130.2020.03.11.14.28.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Mar 2020 14:28:33 -0700 (PDT) From: Pavel Shirshov To: libteam@lists.fedorahosted.org Subject: [PATCH] Don't fire an error when timerfd socket read returned 0 Date: Wed, 11 Mar 2020 14:28:26 -0700 Message-Id: <1583962106-3058-1-git-send-email-pavel.contrib@gmail.com> X-Mailer: git-send-email 2.7.4 Message-ID-Hash: NGDBPKKVYCQZAKCMGNPNHCO4RRUZ6YAB X-Message-ID-Hash: NGDBPKKVYCQZAKCMGNPNHCO4RRUZ6YAB X-MailFrom: pavel.contrib@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jpirko@redhat.com X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It is possible to read 0 bytes from timerfd descriptor despite the fact that descriptor notified poll() that descriptor is ready. We saw such behaviour on some hardware platforms. This patch is solving this by treating such situation as normal. Signed-off-by: Pavel Shirshov --- teamd/teamd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/teamd/teamd.c b/teamd/teamd.c index e035ac5..8cdc16d 100644 --- a/teamd/teamd.c +++ b/teamd/teamd.c @@ -265,6 +265,10 @@ static int handle_period_fd(int fd) teamd_log_err("read() failed."); return -errno; } + if (ret == 0) { + teamd_log_warn("read() for timer_fd returned 0."); + return 0; + } if (ret != sizeof(uint64_t)) { teamd_log_err("read() returned unexpected number of bytes."); return -EINVAL;