Dexuan Cui <de...@microsoft.com> writes:

>> From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On Behalf
>> Of K. Y. Srinivasan
>> Sent: Wednesday, December 16, 2015 8:27
>> To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
>> de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com;
>> vkuzn...@redhat.com; jasow...@redhat.com
>> Subject: [PATCH 1/3] Drivers: hv: utils: fix hvt_op_poll() return value on 
>> transport
>> destroy
>> 
>> From: Vitaly Kuznetsov <vkuzn...@redhat.com>
>> 
>> The return type of hvt_op_poll() is unsigned int and -EBADF is
>> inappropriate, poll functions return POLL* statuses.
>> 
>> Reported-by: Dexuan Cui <de...@microsoft.com>
>> Signed-off-by: Vitaly Kuznetsov <vkuzn...@redhat.com>
>> Signed-off-by: K. Y. Srinivasan <k...@microsoft.com>
>> ---
>>  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
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to