From patchwork Thu Mar 12 22:54:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shirshov X-Patchwork-Id: 11435649 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 B3F9E161F for ; Thu, 12 Mar 2020 22:54:43 +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 7AAD0206CD for ; Thu, 12 Mar 2020 22:54:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AAD0206CD 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 B44ED607A443; Thu, 12 Mar 2020 22:54:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org B44ED607A443 Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id AA35C5D60EB68; Thu, 12 Mar 2020 22:54:42 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id D03125D60EB96; Thu, 12 Mar 2020 22:54:30 +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 2332A5D60EB8E for ; Thu, 12 Mar 2020 22:54:30 +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 B026E605D2D9 for ; Thu, 12 Mar 2020 22:54:29 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id f16so3267845plj.4 for ; Thu, 12 Mar 2020 15:54:29 -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=IHIoAnTapKlM/lpU5AVwQ0YjpDQZfxbi0ezPnMVivvc=; b=kCgQsO4jL3YWoax4erB2uK57GqTfkK8bdJveVXIpYiR+xngvyztqL5S0m9ID75qVMQ 7hB0Y67lGq2bg+7vO9amDGFs9InfY2denJXbg2uvWUxO0i4QKCe7M/8dvmBSvZJeu2tG 9MPPtLXinLwjJT4BuEwQafrg5nWD0VK5fiis+WgKXvujQr9dKVMnFFGObv03vB41JpNe dLcnieLAL7cEUa3P1fQwiufyBdaScBvAd2qArEOi7t8Nw7nfs6tVY628d1qzuMEppgP8 +QgvAf37dbG+pG5+xkee9LfuVdzs3acX3DomikXrgD/+sg7peYOHEK/F8Ic9z/fma1cV NUHQ== X-Gm-Message-State: ANhLgQ0cfcvWegXXmyBEnPTzjg9BiXJkVEoo/BADPeREYs5a8Qb7sxJV b/GNAuZ5uS+whW1QMm0vqeuwsPn5 X-Google-Smtp-Source: ADFU+vv5p4DCP1G7f3hFEudCZMdQ7hAu3X30rThJSH5I4m2DiUPtEZvMQijsExtVXAA00WVfIqKeDg== X-Received: by 2002:a17:902:8a8f:: with SMTP id p15mr10325023plo.45.1584053668456; Thu, 12 Mar 2020 15:54:28 -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 6sm15141891pfx.69.2020.03.12.15.54.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Mar 2020 15:54:28 -0700 (PDT) From: Pavel Shirshov To: libteam@lists.fedorahosted.org Subject: [PATCH] Don't return an error when timerfd socket return 0 Date: Thu, 12 Mar 2020 15:54:17 -0700 Message-Id: <1584053657-21150-1-git-send-email-pavel.contrib@gmail.com> X-Mailer: git-send-email 2.7.4 Message-ID-Hash: 3YCKWABQODIWNI2KCPDCEALLJNFZJ6UE X-Message-ID-Hash: 3YCKWABQODIWNI2KCPDCEALLJNFZJ6UE 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: jiri@resnulli.us 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 it has data. It is possible to see such behaviour on some hardware platforms. Solve 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;