Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp669806ybb; Thu, 28 Mar 2019 09:50:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXIsRNFvkJemkDJu4ixGrXPRDoIDjBPDUBc/L88q8ow7qdzhZOtPOdJEW/YksMcotrutVu X-Received: by 2002:a63:fc5a:: with SMTP id r26mr15722379pgk.97.1553791844886; Thu, 28 Mar 2019 09:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553791844; cv=none; d=google.com; s=arc-20160816; b=pmSRg4Pkc5RSoL3hiCo1xw0JVCmIigFk7e2sMXrhZmNCN94jYWNg4ZTeR7zCTyZHcM VdzXXb+2Ed8t9dO1TpN+dem1bz3gW4UbI0y1m5DpeU7BDSL6X7GZa/On32x4YNXQzqB2 jZue4gfvBhd1i0EupcyWXDYLSuBZBqcyyBwP3zRlxftcVhPS3g0RYwlJVxkXTrq3lxzD LxKasGil9WXghONTmMmKXqbENIp+TLFCnRhrzFaao/oP+DNEdtQQ5Owe/L2GIWIfPeEU sVHQtnUeGcY04yyEuPeWK8dM7P1ytNTIcwb54iytFEDKBvVqDpDgAb64YiaXh1C7QAe3 G5MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=lZ/g82m8W38wzVNCVgWxlzjH9oeiMJ2d8aYxrG5tZ5Q=; b=GLm7so8wyM3Mq36Tbs9hllw9zQhKqYqm8rA7VXBSMq18Ban4O9UcHobP0I3ruWXLEJ jJRRiBry6y+uOrHVZSXIhTevyzDSw/y9Dcp5gI8X31+ifgNBgDufS1E/9P8H/2n7EyHk p8GX3VzlLHxxbPmibr1ZGhMxxl++XfUMTE1pe237MHcv2zqdOC4zBtZf3C39a8uQU4lA /gcPbdXCI8dOkWl+CJanilFweSHikOc0wPuICf2WyQUSiMa5G27sFk4VPv537WjUoJCu kDafjumIMvO1I+zs0R9awOtx6SmWdFBtwXbMO46GvqyMVDhTV9/sdsorirvV9CYlPDI7 YrMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q65si21341656pfi.185.2019.03.28.09.50.27; Thu, 28 Mar 2019 09:50:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbfC1Qtq (ORCPT + 99 others); Thu, 28 Mar 2019 12:49:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:52484 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725849AbfC1Qtq (ORCPT ); Thu, 28 Mar 2019 12:49:46 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0E2B9ABDE; Thu, 28 Mar 2019 16:49:44 +0000 (UTC) Message-ID: <1553791752.6310.2.camel@suse.com> Subject: Re: [PATCH] usb: uas: fix usb subsystem hang after power off hub port From: Oliver Neukum To: Alan Stern Cc: gregkh@linuxfoundation.org, usb-storage@lists.one-eyed-alien.net, Jacky.Cao@sony.com, Kento.A.Kobayashi@sony.com, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org Date: Thu, 28 Mar 2019 17:49:12 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Do, 2019-03-28 at 11:57 -0400, Alan Stern wrote: > On Thu, 28 Mar 2019, Oliver Neukum wrote: > > > On Do, 2019-03-28 at 07:53 +0000, Kento.A.Kobayashi@sony.com wrote: > > > Hi, > > > > > > > Sorry, > > > > > > > > I thought this was clear. Your patch is making the assumption that the reset is triggered by the SCSI layer. You cannot make that assumption, as there is an ioctl for resetting a USB device. > > > > In case we are getting an error during the reset (our endpoints vanish), the device driver must report that to the USB layer, so the driver will always be disconnected. > > > > We cannot drop errors. > > > > > > > > Regards > > > > Oliver > > > > > > This patch modified uas_post_reset to skip rebind operation to avoid exception while -ENODEV happens not drop error. > > > If uas_post_reset happens -ENODEV, usb_reset_and_verify_device must happen error. > > > So,when we use ioctl(USBDEVFS_RESET) to reset device, if usb_reset_and_verify_device happens error, the error will be reported through ioctl return value. > > > > OK, It is possible that I am stupid. We must rebind if uas_post_reset() > > fails. The driver will crash without the endpoints. Can you please > > explain again in greater detail, what you are trying to achieve? > > Actually no, the driver doesn't have to do anything if the post-reset > method fails. usbcore will take care of rebinding automatically. Yes, but the rebinding is not optional. Hence, either the post_reset() must fail to trigger it, or it will be triggered anyway. So if the rebinding hangs the machine, I cannot see how alter changing the return value of uas_post_reset() would help. It looks to me like the state transitions of SCSI are too restrictive. Regards Oliver