Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp626586ybx; Wed, 30 Oct 2019 02:22:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwlEmWOPfBdW8mQg62i5AmnidqEMOMejAuXLpdVL0KpLBBPKw1jf9tfbqlJ4DmUqoE78oz X-Received: by 2002:a50:fa84:: with SMTP id w4mr31000388edr.250.1572427347184; Wed, 30 Oct 2019 02:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572427347; cv=none; d=google.com; s=arc-20160816; b=rW/DnQvjqav/vNP4TKNg6IUe0v8SrYchHlfAj4ACyaIIR/rJwGUCUnLzp8Fr1vdOaS HvUddnBgnBKyM83Cif7g1kDg5m14AWtm3ErbBrV66bduxIVaHuOafjpbeBeNtwRCzYba ifjqSVM7xZoFJuETcvOmrTP1l0M8sYUkSWrGLJiA8A2uJRmDCwG8uTlryYTBjXMLiR+s D/kE92+DslXnioGenlIwlU0crVyl9B9QfHIM03fQDvu4J5zPbtNSkrOJoiqZjKMCpuxi hlwnIvPRUb15zfJrZ7PJeBW27Wjbw/IiL9yoNdBE9cfJuKTCp35vq/SpSqPsLxKunDv2 WXyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=fobFLc4e0FcmJOzViStAjr5/7ws6/u0JmqsBFPcZ0Bs=; b=o+45HSFIwckAE3GrzkU9C3fT5h+rMSoYe23VoPQ8ah3jm1Np331F9L4GfiN4OtA2Wi Q0cIp//JuvuwPhzQDT/ubWpx5Oz432qUjg6mJrgMmb5VP4+2kx8wxmGQRAJRJM+ojDmL jpA6iz7uPlO9VBlOE83eU1PoNnkRq0DD+o1bWmNLWNpXd1zvQSQBnUAHLE0Vuqs4MZvw lJgmv0934YzBYYEulOGnUMIt/UY02ZuH3xp1O55pMzcnkR23PHjEDAw9673/afpbgoO5 08F6RD1OBp0fRbGnVSwvaKECyaUQ1u+yq5jAxC1UngJ4iCNuH18sktBew2IRX3jAXog2 7hGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17si813821ejg.44.2019.10.30.02.22.03; Wed, 30 Oct 2019 02:22:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726357AbfJ3JVT (ORCPT + 99 others); Wed, 30 Oct 2019 05:21:19 -0400 Received: from relay.sw.ru ([185.231.240.75]:56870 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbfJ3JVT (ORCPT ); Wed, 30 Oct 2019 05:21:19 -0400 Received: from [172.16.24.163] (helo=snorch.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iPkAG-0003hv-3T; Wed, 30 Oct 2019 12:21:16 +0300 From: Pavel Tikhomirov To: Alexander Viro Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Pavel Tikhomirov Subject: [PATCH] fs/ppoll: skip excess EINTR if we never sleep Date: Wed, 30 Oct 2019 12:21:02 +0300 Message-Id: <20191030092102.871-1-ptikhomirov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If while calling sys_ppoll with zero timeout we had received a signal, we do return -EINTR. FMPOV the -EINTR should specify that we were interrupted by the signal, and not that we have a pending signal which does not interfere with us at all as we were planning to return anyway. We can just return 0 in these case. I understand that it is a rare situation that signal comes to us while in poll with zero timeout, but that reproduced somehow on VZ7 kernel on CRIU tests. Signed-off-by: Pavel Tikhomirov --- fs/select.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/select.c b/fs/select.c index 53a0c149f528..54d523e3de7f 100644 --- a/fs/select.c +++ b/fs/select.c @@ -873,7 +873,7 @@ static int do_poll(struct poll_list *list, struct poll_wqueues *wait, { poll_table* pt = &wait->pt; ktime_t expire, *to = NULL; - int timed_out = 0, count = 0; + int timed_out = 0, no_timeout = 0, count = 0; u64 slack = 0; __poll_t busy_flag = net_busy_loop_on() ? POLL_BUSY_LOOP : 0; unsigned long busy_start = 0; @@ -881,10 +881,10 @@ static int do_poll(struct poll_list *list, struct poll_wqueues *wait, /* Optimise the no-wait case */ if (end_time && !end_time->tv_sec && !end_time->tv_nsec) { pt->_qproc = NULL; - timed_out = 1; + no_timeout = 1; } - if (end_time && !timed_out) + if (end_time && !no_timeout) slack = select_estimate_accuracy(end_time); for (;;) { @@ -921,10 +921,10 @@ static int do_poll(struct poll_list *list, struct poll_wqueues *wait, pt->_qproc = NULL; if (!count) { count = wait->error; - if (signal_pending(current)) + if (!no_timeout && signal_pending(current)) count = -ERESTARTNOHAND; } - if (count || timed_out) + if (count || timed_out || no_timeout) break; /* only if found POLL_BUSY_LOOP sockets && not out of time */ -- 2.21.0