[U-Boot] [PATCH v2] test: ums: Add sleep before unmount directory

Stephen Warren swarren at wwwdotorg.org
Fri Nov 7 23:00:01 CET 2014


On 11/07/2014 02:54 PM, Wolfgang Denk wrote:
> Dear Lukasz,
>
> In message <1415365555-9790-1-git-send-email-l.majewski at samsung.com> you wrote:
>>
>> -    umount $MNT_DIR
>>
>> +    while true; do
>> +	umount $MNT_DIR > /dev/null 2>&1
>> +	if [ $? -eq 0 ]; then
>> +	    break
>> +	fi
>> +	printf "$COLOUR_ORANGE\tSleeping to wait for umount...$COLOUR_DEFAULT\n"
>> +	sleep 1
>> +    done
>
> As Marek already pointed out, umount (both the command (8) and the
> syscall (2)) are supposed to be blocking (except for typical error
> cases like no permission, mountpoint does not exist, no file system
> mounted, etc.).
>
> If you really ever see the umount entering above loop, then there is
> some bug somewhere.  It would be indeed interesting to see the strace
> log for such umount calls.  Also, can you please add details about the
> exact execution environment (host system / architecture, kernel
> version, distro, and _especially_ which sort of USB driver is involved
> here.
>
> 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:-)


More information about the U-Boot mailing list