Re: [PATCH] cdc-acm: Kill ACM_READY() macro completely

From: Greg KH
Date: Fri Dec 09 2011 - 22:34:46 EST


On Fri, Dec 09, 2011 at 04:51:54PM -0800, Havard Skinnemoen wrote:
> The ACM_READY() macro doesn't seem to do anything useful, and it may
> prevent tty_wait_until_sent() from working properly when called from
> close.
>
> Previously, acm_tty_chars_in_buffer() returned 0 whenever
> acm->port.count was 0. This means close() could return before all the
> data has actually been written.
>
> Signed-off-by: Havard Skinnemoen <hskinnemoen@xxxxxxxxxx>
> ---
> Hi Greg,
>
> Thanks for picking up my patch. Unfortunately, it's not completely bug-free.
>
> This fixes an issue I found while testing the patch: After writing something to
> /dev/ttyACM0, the process would hang for a fairly long time (10-15 seconds)
> when closing the device. This is because port.count drops to 0 before
> tty_wait_until_sent_from_close() is called, which causes ACM_READY() to return
> false, any outstanding writes never get reaped because the workqueue doesn't
> get scheduled, tty_wait_until_sent never sees any progress and eventually times
> out.
>
> Please feel free to fold this into "cdc-acm: Fix potential deadlock (lockdep
> warning)", or let me know if you want me to send you a v2 of that patch
> instead.

I'll just apply this one, as I can't merge it together as I already
applied it.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/