From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752413AbbCaSxt (ORCPT ); Tue, 31 Mar 2015 14:53:49 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:62839 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751112AbbCaSxs (ORCPT ); Tue, 31 Mar 2015 14:53:48 -0400 Message-ID: <551AED33.2040206@mentor.com> Date: Tue, 31 Mar 2015 19:53:39 +0100 From: "Baxter, Jim" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" CC: "Zapolskiy, Vladimir" Subject: usb: gadget: f_fs: O_NONBLOCK waits MAX_SCHEDULE_TIMEOUT Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.76] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I have been looking at an issue where a phone that is the Function FS host sometimes locks up and causes the function: static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) in drivers/usb/gadget/function/f_fs.c to timeout after MAX_SCHEDULE_TIMEOUT jiffies. We are opening the ffs connection with the O_NONBLOCK option and this timeout seems to be far too long. The code causing the wait is here (line 834): if (unlikely(ret < 0)) { /* nop */ } else if (unlikely( wait_for_completion_interruptible(&done))) { ret = -EINTR; usb_ep_dequeue(ep->ep, req); } else { The function call wait_for_completion_interruptible(&done) equates to: wait_for_completion_interruptible_timeout(&done, MAX_SCHEDULE_TIMEOUT); I was wondering what to change to fix this, is it reasonable to use a very small timeout if it is O_NONBLOCK or is any blocking not allowed? I would appreciate any thoughts on how this should work? Thank you, Jim