Bug 245912 - mount doesn't write the 'loop=...' option in /etc/mtab when mounting a loop device
mount doesn't write the 'loop=...' option in /etc/mtab when mounting a loop d...
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: util-linux (Show other bugs)
7
x86_64 Linux
low Severity low
: ---
: ---
Assigned To: Karel Zak
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-27 08:04 EDT by Andras Simon
Modified: 2008-06-16 21:43 EDT (History)
2 users (show)

See Also:
Fixed In Version: 2.13-0.52.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-06-16 21:43:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
output of strace on mount (9.48 KB, text/plain)
2007-06-27 14:57 EDT, Andras Simon
no flags Details

  None (edit)
Description Andras Simon 2007-06-27 08:04:46 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.4) Gecko/20070603 Fedora/2.0.0.4-2.fc7 Firefox/2.0.0.4

Description of problem:
See the summary.

Version-Release number of selected component (if applicable):
util-linux-2.13-0.51

How reproducible:
Always


Steps to Reproduce:
1.mount an image via the loop device, e.g.
mount -o loop,offset=32256 /usr/local/kvm-images/WinXP.raw /mnt/

2.check that the corresponding entry in /etc/mtab doesn't have the 'loop=...' option


Actual Results:
# grep loop /etc/mtab
/dev/loop0 /mnt fuseblk rw,nosuid,nodev,noatime,allow_other,blksize=4096 0 0

Expected Results:
# grep loop /etc/mtab
/dev/loop0 /mnt fuseblk rw,nosuid,nodev,noatime,allow_other,blksize=4096,loop=/dev/loop0 0 0

Additional info:
The consequence of this is that umount doesn't free the loop device. losetup -a still shows 
/dev/loop0: [080c]:14073859 (/usr/local/kvm-images/WinXP.raw), offset 32256
after 
umount /mnt
Given that there are only 8 loop devices by default, after a few mount/unmount's one runs out of free loop devices.
Comment 1 Andras Simon 2007-06-27 08:57:13 EDT
The problem doesn't show up when mounting iso images. (Thanks to Luciano Rocha
for the suggestion.)
Comment 2 Karel Zak 2007-06-27 12:40:49 EDT
I think 'fuseblk' uses a special mount program (e.g. /sbin/mount.<foo>) and it
seems that this program doesn't add the loop=/dev/loopN to the /etc/mtab file.

Right?
Comment 3 Andras Simon 2007-06-27 13:16:27 EDT
Might be... How do I check it? 

/sbin/mount.ntfs-fuse certainly seems to be involved in the process.
Comment 4 Karel Zak 2007-06-27 13:28:14 EDT
Please, try "strace -o log mount <your options>". And add the log as an bugzilla
attachment.
Comment 5 Andras Simon 2007-06-27 14:57:41 EDT
Created attachment 158042 [details]
output of strace on mount
Comment 6 Karel Zak 2007-06-27 17:23:11 EDT
The problem is /sbin/mount.ntfs that ignores the loop=/dev/loopN option.
Comment 7 Tom "spot" Callaway 2007-06-27 18:42:18 EDT
Well, this is interesting. ntfs-3g (the package that provides /sbin/mount.ntfs)
doesn't need any loop= options to mount local files into a directory.

See:
http://www.ntfs-3g.org/quality.html (at the bottom)

So, what is happening (to the best of my knowledge) is that mount sees the loop=
command, allocates a loop device, then mount.ntfs ignores it (because it doesn't
need it).

The obvious workaround is to remove the loop option from the initial mount
command, as it is not needed.

[root@localhost ~]# mount /root/ntfs-test.img /mnt/
[root@localhost ~]# losetup -a
[root@localhost ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/root/ntfs-test.img on /mnt type fuse (rw,nosuid,nodev,noatime,allow_other)

This might be a case where ntfs-3g would either want to silently free up the
loop device if it sees a loop option passed to it, or outright throw an error
when it sees a loop device (*** ntfs-3g mounts do not require loop options! ***).

Adding upstream maintainer to CC for his opinion.
Comment 8 Szabolcs Szakacsits 2007-06-27 19:25:13 EDT
In my copy of mount the loop=/dev/loopN option isn't passed to ntfs-3g. If it
were then ntfs-3g passes it to FUSE which does the /etc/mtab modification. I
think FUSE indeed ignores the 'loop' mount option. I notified Miklos Szeredi,
FUSE maintainer.
Comment 9 Karel Zak 2007-06-27 19:36:20 EDT
(In reply to comment #7)
> This might be a case where ntfs-3g would either want to silently free up the
> loop device if it sees a loop option passed to it, or outright throw an error
> when it sees a loop device (*** ntfs-3g mounts do not require loop options! ***).

I think an error/warning message is good idea.

(In reply to comment #8)
> In my copy of mount the loop=/dev/loopN option isn't passed to ntfs-3g. 

What version of util-linux is in use?

Comment 10 Andras Simon 2007-06-28 07:10:35 EDT
(In reply to comment #7)
> Well, this is interesting. ntfs-3g (the package that provides /sbin/mount.ntfs)
> doesn't need any loop= options to mount local files into a directory.
> 
> See:
> http://www.ntfs-3g.org/quality.html (at the bottom)
> 
> So, what is happening (to the best of my knowledge) is that mount sees the loop=
> command, allocates a loop device, then mount.ntfs ignores it (because it doesn't
> need it).
> 
> The obvious workaround is to remove the loop option from the initial mount
> command, as it is not needed.
> 
> [root@localhost ~]# mount /root/ntfs-test.img /mnt/
> [root@localhost ~]# losetup -a
> [root@localhost ~]# mount
> /dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
> proc on /proc type proc (rw)
> sysfs on /sys type sysfs (rw)
> devpts on /dev/pts type devpts (rw,gid=5,mode=620)
> /dev/sda1 on /boot type ext3 (rw)
> tmpfs on /dev/shm type tmpfs (rw)
> none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
> sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
> /root/ntfs-test.img on /mnt type fuse (rw,nosuid,nodev,noatime,allow_other)
> 
> This might be a case where ntfs-3g would either want to silently free up the
> loop device if it sees a loop option passed to it, or outright throw an error
> when it sees a loop device (*** ntfs-3g mounts do not require loop options! ***).

[root@localhost ~]# losetup -a                                                  
[root@localhost ~]# mount -o offset=32256 /usr/local/kvm-images/WinXP.raw /mnt/ 
[root@localhost ~]# losetup -a
/dev/loop0: [080c]:14073859 (/usr/local/kvm-images/WinXP.raw), offset 32256
[root@localhost ~]# umount /mnt/
[root@localhost ~]# losetup -a
/dev/loop0: [080c]:14073859 (/usr/local/kvm-images/WinXP.raw), offset 32256

So it doesn't seem to make a difference whether the loop option for mount is
used or not.
Comment 11 Andras Simon 2007-06-28 07:12:53 EDT
> 
> What version of util-linux is in use?
> 

2.13-0.51.fc7

Comment 12 Tom "spot" Callaway 2007-06-28 09:38:05 EDT
The offset option seems to be triggering the loop initialization. My dummy
filesystem also uses a loop device. But, if I mount with no offset option, no
loop device.

[root@localhost ~]# losetup -a
[root@localhost ~]# mount -o offset=0 /root/ntfs-test.img /mnt/loop
[root@localhost ~]# losetup -a
/dev/loop0: [fd00]:16876164 (/root/ntfs-test.img)
[root@localhost ~]# umount /mnt/loop
[root@localhost ~]# losetup -a
/dev/loop0: [fd00]:16876164 (/root/ntfs-test.img)
[root@localhost ~]# losetup -d /dev/loop0
[root@localhost ~]# mount /root/ntfs-test.img /mnt/loop
[root@localhost ~]# losetup -a
[root@localhost ~]# 
Comment 13 Szabolcs Szakacsits 2007-06-28 10:02:50 EDT
> This might be a case where ntfs-3g would either want to silently free up the
> loop device if it sees a loop option passed to it, or outright throw an error
> when it sees a loop device (*** ntfs-3g mounts do not require loop options! ***).

Loop device is need if the 'offset' mount option is used.

> What version of util-linux is in use?

2.12a, 2.12q, 2.12r. None of them sends the 'loop=' option to ntfs-3g. So unless
it's fixed in recent util-linux versions, this is an util-linux and FUSE bug. 

Ntfs-3g passes all unhandled options to FUSE for further processing and the
/etc/mtab modification is done by FUSE.

Workaround could be 'umount -d mountpoint' but sometimes that could fail with
EBUSY (probably due to a known FUSE issue).
Comment 14 Szabolcs Szakacsits 2007-06-29 08:41:33 EDT
Miklos Szeredi's opinion is that mount(8) should write a flag into e.g.
/var/lib/mount/loopX, so umount(8) could free the loop device. He thinks the
issue has nothing to do with the mounted file system, this is a characteristic
of the loop device handling.

Karel could discuss this with him directly or on util-linux-ng list. Miklos is
working on /etc/mtab elimination.

So, from FUSE point of view, this is an util-linux problem. From ntfs-3g point
of view, this is not a direct ntfs-3g issue and there isn't anything we could
help here.
Comment 15 Karel Zak 2007-06-29 08:55:13 EDT
Yes, I'm going to play with this issue next week.
Comment 16 Karel Zak 2007-07-02 17:43:30 EDT
Sorry, the bug is really in the mount(8) -- the command doesn't correctly call
external mount programs with a "loop=" option.

The bug has been fixed in the upstream code and will be fixed in F7, FC6 ASAP.
Comment 17 Andras Simon 2007-07-02 18:30:56 EDT
(In reply to comment #16)

Great!
Thanks!

Comment 18 Szabolcs Szakacsits 2007-07-02 18:39:04 EDT
(In reply to comment #16)
> Sorry, the bug is really in the mount(8) -- the command doesn't correctly call
> external mount programs with a "loop=" option.
> 
> The bug has been fixed in the upstream code and will be fixed in F7, FC6 ASAP.

Thanks but I think that will not solve the problem. Ntfs-3g will pass it to
FUSE which is doing the /etc/mtab modification but FUSE will not process
it, it will give it back to ntfs-3g which will ignore it since it's a
mount(8) option which should be handled either by mount(8) or FUSE. Thus
the option will basically go to /dev/null.

Miklos says since loop is created by mount(8) thus mount(8) should handle  
this case entirely. Mount(8) indeed tries this by passing the option (now)  
to the external mount utilities. But FUSE ignores it. So if Miklos won't
fix it, what he apparently is willing at the moment (please discuss this
with him directly!) and you also don't store this information somewhere
else then this bug won't get fixed.

I think it would be completely insane if ntfs-3g would start editing
/etc/mtab too besides FUSE, mount(8) and plenty of other utilities, 
just to fix this loop= mount option case.
Comment 19 Szabolcs Szakacsits 2007-07-02 18:44:04 EDT
(In reply to comment #18)
> So if Miklos won't fix it, what he apparently is willing at the moment 
> (please discuss this with him directly!) 

Ooops, I wanted to write that "he is apparently __not__ willing to fix this
issue in FUSE". 

I think, it should be fixed in FUSE too.
Comment 20 Fedora Update System 2007-07-11 11:17:07 EDT
util-linux-2.13-0.52.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
Comment 21 Fedora Update System 2007-07-18 16:57:30 EDT
util-linux-2.13-0.52.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 22 Szabolcs Szakacsits 2007-07-18 17:09:24 EDT
> ------- Additional Comments From updates@fedoraproject.org  2007-07-18 16:57
EST -------
> util-linux-2.13-0.52.fc7 has been pushed to the Fedora 7 stable
> repository.  If problems still persist, please make note of it in this
> bug report.
  
Problem should be still persist, it was noted in comment #18.
Comment 23 Szabolcs Szakacsits 2007-07-18 17:13:55 EDT
Btw, thinking on the issue a bit and contrary to my opinion above, I also think
that this should be entirely fixed in util-linux, not FUSE. See Miklos' argument
above.
Comment 24 Bug Zapper 2008-05-14 09:17:39 EDT
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. 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 '7'.

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 7'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 7 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 please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

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. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:
http://docs.fedoraproject.org/release-notes/

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 25 Bug Zapper 2008-06-16 21:43:18 EDT
Fedora 7 changed to end-of-life (EOL) status on June 13, 2008. 
Fedora 7 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.