From patchwork Mon Nov 7 23:10:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 9416209 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC32360720 for ; Mon, 7 Nov 2016 23:17:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEE6428C1D for ; Mon, 7 Nov 2016 23:17:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C37A728E74; Mon, 7 Nov 2016 23:17:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16E6428C1D for ; Mon, 7 Nov 2016 23:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752550AbcKGXR3 (ORCPT ); Mon, 7 Nov 2016 18:17:29 -0500 Received: from rere.qmqm.pl ([84.10.57.10]:36904 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563AbcKGXR1 (ORCPT ); Mon, 7 Nov 2016 18:17:27 -0500 Received: by rere.qmqm.pl (Postfix, from userid 1000) id AFA6E6081; Tue, 8 Nov 2016 00:10:18 +0100 (CET) Message-Id: In-Reply-To: References: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH 1/3] eventfd: make POLLRDNORM/POLLWRNORM working MIME-Version: 1.0 To: linux-fsdevel@vger.kernel.org Cc: Alexander Viro Date: Tue, 8 Nov 2016 00:10:18 +0100 (CET) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP poll(2) suggests these should be equivalent to POLLIN/POLLOUT. Signed-off-by: Michał Mirosław --- fs/eventfd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/eventfd.c b/fs/eventfd.c index 1231cd1..2c91cf0 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -60,7 +60,7 @@ __u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n) n = ULLONG_MAX - ctx->count; ctx->count += n; if (waitqueue_active(&ctx->wqh)) - wake_up_locked_poll(&ctx->wqh, POLLIN); + wake_up_locked_poll(&ctx->wqh, POLLIN | POLLRDNORM); spin_unlock_irqrestore(&ctx->wqh.lock, flags); return n; @@ -163,11 +163,11 @@ static unsigned int eventfd_poll(struct file *file, poll_table *wait) count = READ_ONCE(ctx->count); if (count > 0) - events |= POLLIN; + events |= POLLIN | POLLRDNORM; if (count == ULLONG_MAX) events |= POLLERR; if (ULLONG_MAX - 1 > count) - events |= POLLOUT; + events |= POLLOUT | POLLWRNORM; return events; } @@ -200,7 +200,7 @@ int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, eventfd_ctx_do_read(ctx, cnt); __remove_wait_queue(&ctx->wqh, wait); if (*cnt != 0 && waitqueue_active(&ctx->wqh)) - wake_up_locked_poll(&ctx->wqh, POLLOUT); + wake_up_locked_poll(&ctx->wqh, POLLOUT | POLLWRNORM); spin_unlock_irqrestore(&ctx->wqh.lock, flags); return *cnt != 0 ? 0 : -EAGAIN; @@ -253,7 +253,7 @@ ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt) if (likely(res == 0)) { eventfd_ctx_do_read(ctx, cnt); if (waitqueue_active(&ctx->wqh)) - wake_up_locked_poll(&ctx->wqh, POLLOUT); + wake_up_locked_poll(&ctx->wqh, POLLOUT | POLLWRNORM); } spin_unlock_irq(&ctx->wqh.lock); @@ -317,7 +317,7 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c if (likely(res > 0)) { ctx->count += ucnt; if (waitqueue_active(&ctx->wqh)) - wake_up_locked_poll(&ctx->wqh, POLLIN); + wake_up_locked_poll(&ctx->wqh, POLLIN | POLLRDNORM); } spin_unlock_irq(&ctx->wqh.lock);