
Hi Wolfgang,
Dear Stephen,
In message 545D40E1.2030700@wwwdotorg.org you wrote:
My gut feeling is that there might be some USB driver error involved here.
Where I've seen this is writing to an SD card in a USB-based SD card reader.
I have a fairly regular amd64 machine running Ubuntu. I put the loop above into my own scripts that mount an SD card, copy new data to it, and then immediately unmount it for the same reason that Lukasz made this patch; umount doesn't always unmount. I did this so long ago that I don't recall which Ubuntu version I had at the time, nor the kernel version. It was *probably* Ubuntu 10.04 or 12.10 though. Now I'm on 14.04, but have no idea if I still need the loop since it's already in place:-)
But this is a bug. Papering over is not a good idea. It should be analyzed, reported, and finally fixed.
I've debugged the script with strace.
The problem is with umount() syscall:
[pid 23296] umount("/mnt/tmp-ums-test", 0) = -1 EBUSY (Device or resource busy)
It is somehow strange, because with strace attached I occasionally see correct behaviour:
[pid 23776] umount("/mnt/tmp-ums-test", 0) = 0
I need to debug the syscall in the kernel.
Information about my system:
x86_64: Linux 3.12.0 #2 SMP PREEMPT Wed Nov 27 10:26:22 CET 2013 x86_64 GNU/Linux
Debian 7.4.
Best regards,
Wolfgang Denk