Bug 855274 - mount a loop device to write some file, and umount immediately will fail
Summary: mount a loop device to write some file, and umount immediately will fail
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: gvfs
Version: 17
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Ondrej Holy
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 853674
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-07 07:35 UTC by Mark Wu
Modified: 2013-08-01 06:14 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 853674
Environment:
Last Closed: 2013-08-01 06:14:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mark Wu 2012-09-07 07:35:01 UTC
+++ This bug was initially created as a clone of Bug #853674 +++

Created attachment 609013 [details]
strace -f ./testumount.sh >testumount.txt 2>&1

Description of problem:
Mount a floppy image, and write some files, then immediately umount. The umount will fail.


Version-Release number of selected component (if applicable):
uname -a:
Linux zhshzhouf17 3.5.2-3.fc17.x86_64 #1 SMP Tue Aug 21 19:06:52 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

rpm -q glibc:
glibc-2.15-56.fc17.x86_64


How reproducible:
On my machine, always, on kernel 3.4 and 3.5 release. Other release are not tested. On some of my colleagues's machines, it can be reproduced. It can not be reporduced on virtual machines.


Steps to Reproduce:
1. I write a script to reproduce the problem.

#!/usr/bin/bash
mkdir tmpMount
/usr/sbin/mkfs.msdos -C floppy.img 1440
/usr/bin/mount -o loop floppy.img tmpMount
echo '123'>tmpMount/tst1.txt
echo '123'>tmpMount/tst2.txt
echo '123'>tmpMount/tst3.txt
echo '123'>tmpMount/tst4.txt
echo '123'>tmpMount/tst5.txt
echo '123'>tmpMount/tst6.txt
echo '123'>tmpMount/tst7.txt
echo '123'>tmpMount/tst8.txt
echo '123'>tmpMount/tst9.txt
#sleep 2
/usr/bin/umount -f tmpMount
rm -rf tmpMount floppy.img
  
Actual results:
When I run the script, umount fails. The script prints some error message as follow.
mkfs.msdos 3.0.12 (29 Oct 2011)
umount: /home/edward/src/tmpMount: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
rm: cannot remove `tmpMount': Device or resource busy

Expected results:
The device can be umounted and no error are reported.

Additional info:
1. sleep several seconds before umount
If I uncomment the "sleep" command in the script, umount works again. This means data is waiting to be sync to disk, so the device is busy, and umount can not detach the devices. On my system, if I sync before umount, umount will work.

2. lsof the mount point prints nothing
If I lsof the mount point between before umount, nothing will be printed, but umount works again

So I guess the driver/kernel holds the devices because the data is in the a kernel buffer but not written to disk.

By the way, lsof gives the following waring when I lsof the mount point. lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /run/user/edward/gvfs Output information may be incomplete

I have fuse and gvfs-fuse packages installed, but fuse.service can not be started. When I try to start the service, it fails and says "No such file or directory".

I don't know if the fuse problem is related to this problem.

3. lazy umount does not work, but fsync + lazy umount works
When I use lazy umount in the script, it works. However when I let the script mount the image again immediately, the image contains nothing. The image should contain the files created by the script.

When I fsync the FDs of those files before the lazy umount, umount successed. Then I mount the image again immediately, I can see the files there.

4. strace
The detialed strace report is in the attachment. I use the following command to generate that report.
strace -f ./testumount.sh >testumount.txt 2>&1

--- Additional comment from danken on 2012-09-02 13:50:04 CST ---

Could you check if this is also the case with other filesystems, or only with mkfs.msdos ?

--- Additional comment from zhshzhou.ibm.com on 2012-09-02 19:02:12 CST ---

Thanks for the quick reply. I tested ext2, ext3, ext4 and vfat images, all can reproduce this bug.

--- Additional comment from danken on 2012-09-03 05:42:39 CST ---

A kernel developer failed to reproduce the issue on his system today. Could you give more details on the hosts where this shows up? Which storage is backing your filesystem? Is there a host where you can grant access to a developer?

--- Additional comment from zhshzhou.ibm.com on 2012-09-03 10:39:53 CST ---

I'm sorry that I can not grant access because of the security policy.

My machine is ThinkPad T420, manufactured by Lennovo. The colleagues' machines are ThinkPad T410.

I use hard drive and Fedora 17 default LVM layout created by the OS installation.

lvm versions are
lvm2-libs-2.02.95-6.fc17.x86_64
lvm2-2.02.95-6.fc17.x86_64

df -l gives the following information
Filesystem                      1K-blocks     Used Available Use% Mounted on
rootfs                           93857720 33665472  55424504  38% /
devtmpfs                          4012256        0   4012256   0% /dev
tmpfs                             4029556      304   4029252   1% /dev/shm
tmpfs                             4029556     2320   4027236   1% /run
/dev/mapper/vg_zhshzhou-lvroot   93857720 33665472  55424504  38% /
tmpfs                             4029556        0   4029556   0% /sys/fs/cgroup
tmpfs                             4029556        0   4029556   0% /media
/dev/mapper/35000cca68ac8e2fdp2    495844    86730    383514  19% /boot
/dev/mapper/vg_zhshzhou-lvhome  103212320 33563604  64405836  35% /home



--- Additional comment from wudxw.ibm.com on 2012-09-07 15:29:28 CST ---

I can reproduce this problem, and the problem disappear after I kill the process of gvfsd-trash.  It looks it's the same problem reported in: http://code.google.com/p/chromium-os/issues/detail?id=23443. 
So I think we should ask gvfs guys take a look at first.

gvfs version:
gvfs-1.12.3-1.fc17

Comment 1 Tomáš Bžatek 2012-09-07 10:39:39 UTC
Seems like https://bugzilla.gnome.org/show_bug.cgi?id=677648 to me.

Comment 2 Fedora Admin XMLRPC Client 2013-05-23 14:28:06 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Fedora Admin XMLRPC Client 2013-05-23 14:29:58 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Fedora End Of Life 2013-07-04 01:36:19 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2013-08-01 06:14:42 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.