Re: [PATCH] usb: storage: add shutdown function for usb storage driver

From: Alan Stern
Date: Tue Oct 24 2023 - 11:35:41 EST


On Tue, Oct 24, 2023 at 03:43:56AM +0000, Li, Meng wrote:
>
>
> > -----Original Message-----
> > From: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

> > On Mon, Oct 23, 2023 at 01:41:11PM +0800, Meng Li wrote:
> > > On ls1043/ls1046 rdb platform, if a PCIe-USB host controller is
> > > installed, and an USB disk is also installed on the PCIe card, when
> > > executing "reboot -f" to reset the board, there will be below error reported:
> > > usb 2-2: device not accepting address 2, error -108

> > > This issue is introduced by linux-yocto commit 837547b64a34("driver: net:
> > > dpaa: release resource when executing kexec") that cause to spend more
> > > time on shutdown operation. So, the 2 platforms with DPAA are not
> > > reset immediately after executing force reboot command. Moreover, the
> > > usb-storage thread is still in active status, there is still control
> > > data transferred between USB disk and PCIe host controller. But now
> > > the shutdown callback of usb pci driver had been invoked to stop the
> > > PCIe host controller completely. In this situation, the data transferring failed
> > and report error.
> >
> > That's _supposed_ to happen. By design, the "reboot -f" command is meant
> > to carry out an immediate reboot, without using the init system, unmounting
> > filesystems, or doing other cleanup operations.
> >
>
> As my above said, I understand what you mean. I also thought over what you said.
> I am not sure, but I still sent patch to upstream community, and want to get some suggest from more authoritative maintainer.
>
> > If you want a clean reboot with no errors, don't use the "-f" option.
> >
>
> There is also error report even if I use command "reboot"

Okay, that's a different matter. In fact, I don't know what is supposed
to happen during a clean reboot.

Greg, do you know? Should we take the time to disconnect all the USB
devices during a system shutdown? What happens with non-USB disk
drives? Or other removable devices?

Alan Stern