Enumeration not happening if device removed during file transfer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SCENARIO:
In host mode, I am trying to copy some files from the pendrive to the
sdcard or vice-versa using the astro file manager.During the file
transfer, if I disconnect the pendrive,and then reconnect it back,it
is observed that re-enumeration is not taking place.

ANALYSIS:
>From the stack trace,we see that there are 2 main threads involved:
1) usb-storage thread:
When file transfer is in progress,the pendrive is removed.In this
context,usb_sg_wait() function is waiting infinitely for the IO to
complete (wait_for_completion(&io->complete)). Since the drive is
removed,this wait never completes.

2) khubd thread
On disconnecting the pendrive, during the device delete operation,
usb_stor_disconnect() function is called which is trying to release
the storage resources and then tries to stop the usb-storage thread
via kthread_stop().

The usb_storage thread is not listening on kthread_should_stop as it
is waiting infinitely on usb_sg_wait(). Hence the hub thread is also
blocked as it tries to stop the storage thread.

QUESTIONS:
1)Why is the wait_for_completion(&io->complete) not a timed wait? (*
After adding a timeout of 5 seconds,this issue is no longer seen , the
pendrive enumerates each time)
2)If we do put a timed wait,what should be the ideal timeout value?

Kindly provide appropriate feedback.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux