Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934170AbbLPKTI (ORCPT ); Wed, 16 Dec 2015 05:19:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38068 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933053AbbLPKTF (ORCPT ); Wed, 16 Dec 2015 05:19:05 -0500 From: Vitaly Kuznetsov To: Dexuan Cui Cc: KY Srinivasan , "gregkh\@linuxfoundation.org" , "linux-kernel\@vger.kernel.org" , "devel\@linuxdriverproject.org" , "olaf\@aepfle.de" , "apw\@canonical.com" , "jasowang\@redhat.com" Subject: Re: [PATCH 1/3] Drivers: hv: utils: fix hvt_op_poll() return value on transport destroy References: <1450225615-4672-1-git-send-email-kys@microsoft.com> <1450225648-4711-1-git-send-email-kys@microsoft.com> Date: Wed, 16 Dec 2015 11:19:00 +0100 In-Reply-To: (Dexuan Cui's message of "Wed, 16 Dec 2015 06:37:19 +0000") Message-ID: <877fkevgq3.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2120 Lines: 57 Dexuan Cui writes: >> From: devel [mailto:driverdev-devel-bounces@linuxdriverproject.org] On Behalf >> Of K. Y. Srinivasan >> Sent: Wednesday, December 16, 2015 8:27 >> To: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; >> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com; >> vkuznets@redhat.com; jasowang@redhat.com >> Subject: [PATCH 1/3] Drivers: hv: utils: fix hvt_op_poll() return value on transport >> destroy >> >> From: Vitaly Kuznetsov >> >> The return type of hvt_op_poll() is unsigned int and -EBADF is >> inappropriate, poll functions return POLL* statuses. >> >> Reported-by: Dexuan Cui >> Signed-off-by: Vitaly Kuznetsov >> Signed-off-by: K. Y. Srinivasan >> --- >> drivers/hv/hv_utils_transport.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/hv/hv_utils_transport.c b/drivers/hv/hv_utils_transport.c >> index ee20b50..4f42c0e 100644 >> --- a/drivers/hv/hv_utils_transport.c >> +++ b/drivers/hv/hv_utils_transport.c >> @@ -109,7 +109,7 @@ static unsigned int hvt_op_poll(struct file *file, >> poll_table *wait) >> poll_wait(file, &hvt->outmsg_q, wait); >> >> if (hvt->mode == HVUTIL_TRANSPORT_DESTROY) >> - return -EBADF; >> + return POLLERR | POLLHUP; >> >> if (hvt->outmsg_len > 0) >> return POLLIN | POLLRDNORM; >> -- > > Hi Vitaly, > The daemon only polls on POLLIN. > I'm not sure returning "POLLERR | POLLHUP" here can wake up the daemon or not. > I tested this patch with hv_kvp_daemon which does poll() and it works: we wake up all pollers from hvutil_transport_destroy(). Here we just need to return proper value. Actually, the return value doesn't really matter -- we do read() after poll() and get -EBADF there. But let's be consistent. -- Vitaly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/