All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Dexuan Cui <decui@microsoft.com>
Cc: KY Srinivasan <kys@microsoft.com>,
	"gregkh\@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devel\@linuxdriverproject.org" <devel@linuxdriverproject.org>,
	"olaf\@aepfle.de" <olaf@aepfle.de>,
	"apw\@canonical.com" <apw@canonical.com>,
	"jasowang\@redhat.com" <jasowang@redhat.com>
Subject: Re: [PATCH 3/9] Drivers: hv: utils: introduce HVUTIL_TRANSPORT_DESTROY mode
Date: Tue, 15 Dec 2015 18:10:33 +0100	[thread overview]
Message-ID: <87r3invdrq.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <d165234a6e9a4340a421bf30c1dcc3ba@HKXPR3004MB0088.064d.mgd.msft.net> (Dexuan Cui's message of "Tue, 15 Dec 2015 12:14:53 +0000")

Dexuan Cui <decui@microsoft.com> 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 <vkuznets@redhat.com>
>> 
>> 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

  reply	other threads:[~2015-12-15 17:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15  3:00 [PATCH 0/9] Drivers: hv: Cleanup ringbuffer code K. Y. Srinivasan
2015-12-15  3:01 ` [PATCH 1/9] Drivers: hv: utils: fix memory leak on on_msg() failure K. Y. Srinivasan
2015-12-15  3:01   ` [PATCH 2/9] Drivers: hv: utils: rename outmsg_lock K. Y. Srinivasan
2015-12-15  3:01   ` [PATCH 3/9] Drivers: hv: utils: introduce HVUTIL_TRANSPORT_DESTROY mode K. Y. Srinivasan
2015-12-15 12:14     ` Dexuan Cui
2015-12-15 17:10       ` Vitaly Kuznetsov [this message]
2015-12-15  3:01   ` [PATCH 4/9] Drivers: hv: utils: fix crash when device is removed from host side K. Y. Srinivasan
2015-12-15  3:01   ` [PATCH 5/9] Drivers: hv: ring_buffer.c: fix comment style K. Y. Srinivasan
2015-12-15  3:01   ` [PATCH 6/9] Drivers: hv: ring_buffer: remove stray smp_read_barrier_depends() K. Y. Srinivasan
2015-12-15  3:01   ` [PATCH 7/9] Drivers: hv: ring_buffer: remove code duplication from hv_ringbuffer_peek/read() K. Y. Srinivasan
2015-12-15  3:02   ` [PATCH 8/9] Drivers: hv: remove code duplication between vmbus_recvpacket()/vmbus_recvpacket_raw() K. Y. Srinivasan
2015-12-15  3:02   ` [PATCH 9/9] Drivers: hv: ring_buffer: eliminate hv_ringbuffer_peek() K. Y. Srinivasan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3invdrq.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=apw@canonical.com \
    --cc=decui@microsoft.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.