Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933488AbbLORKj (ORCPT ); Tue, 15 Dec 2015 12:10:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38906 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932462AbbLORKi (ORCPT ); Tue, 15 Dec 2015 12:10:38 -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 3/9] Drivers: hv: utils: introduce HVUTIL_TRANSPORT_DESTROY mode References: <1450148455-28399-1-git-send-email-kys@microsoft.com> <1450148521-28447-1-git-send-email-kys@microsoft.com> <1450148521-28447-3-git-send-email-kys@microsoft.com> Date: Tue, 15 Dec 2015 18:10:33 +0100 In-Reply-To: (Dexuan Cui's message of "Tue, 15 Dec 2015 12:14:53 +0000") Message-ID: <87r3invdrq.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: 1846 Lines: 52 Dexuan Cui writes: >> -----Original Message----- >> From: devel [mailto:driverdev-devel-bounces@linuxdriverproject.org] On Behalf >> Of K. Y. Srinivasan >> Sent: Tuesday, December 15, 2015 11:02 >> 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 3/9] Drivers: hv: utils: introduce HVUTIL_TRANSPORT_DESTROY >> mode >> >> From: Vitaly Kuznetsov >> >> When Hyper-V host asks us to remove some util driver by closing the >> appropriate channel there is no easy way to force the current file >> descriptor holder to hang up but we can start to respond -EBADF to all >> operations asking it to exit gracefully. >> >> As we're setting hvt->mode from two separate contexts now we need to use >> a proper locking. >> >> ... >> @@ -99,6 +107,10 @@ static unsigned int hvt_op_poll(struct file *file, >> poll_table *wait) >> hvt = container_of(file->f_op, struct hvutil_transport, fops); >> >> poll_wait(file, &hvt->outmsg_q, wait); >> + >> + if (hvt->mode == HVUTIL_TRANSPORT_DESTROY) >> + return -EBADF; >> + >> if (hvt->outmsg_len > 0) >> return POLLIN | POLLRDNORM; > > Hi Vitaly, > Should hvt_op_poll() return -EBADF -- I think it probably > should return POLLERR or POLLHUP? Oh, sorry, my bad -- hvt_op_poll() returns unsigned int and -EBADF is definitely inappropriate. I see this patch was already merged to char-misc-testing so I'll send a follow-up patch to fix things up. Thanks! -- 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/