FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Fri Jun 18, 2021 19:42



Post new topic Reply to topic  [ 12 posts ] 
umount: /dev/dm-7: not mounted 
Author Message

Joined: Sat May 14, 2011 14:54
Posts: 7
Post umount: /dev/dm-7: not mounted
Hi. There's an annoying problem with device-mapper. The background is here: https://bugs.archlinux.org/task/23184 .
ntfs-3g adds "/dev/dm-*" entries to mtab instead of "/dev/mapper/*". Such filesystems can be unmounted only by the mount point name, but not the device name.
It mostly affects the truecrypt users.
Code:
$ mount /dev/mapper/truecrypt1 /media/myprivate -t ntfs-3g
$ mount
/dev/dm-7 on /media/myprivate type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
$ umount /dev/mapper/truecrypt1
umount: /dev/mapper/truecrypt1: not mounted
$ umount /dev/dm-7
umount: /dev/dm-7: not mounted
$ umount /media/myprivate

This problem is present in current git. It would be great if the developers picked the attached patch. In it I replaced all usages of realpath() function to it's analog from the util-linux project, that correctly handles /dev/dm-* names.
On other OSes all should work as before.


Attachments:
canonicalize_path.patch.gz [2.21 KiB]
Downloaded 1046 times
Sat May 14, 2011 15:23
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: umount: /dev/dm-7: not mounted
Hi,

Quote:
There's an annoying problem with device-mapper [...]
ntfs-3g adds "/dev/dm-*" entries to mtab instead of "/dev/mapper/*".


Hmm. This problem is unrelated to ntfs-3g, you have to patch all the filesystems drivers (at least all which rely on fuse).

First, can you check that the modification to "mount_util.c" is unneeded, this deals with the mountpoint, not the device path.

Then, I see that ntfs-3g forwards the device path it receives to fuse, which forwards to some package which puts it into mtab. Do you know where the "dm-*" comes from, and why umount cannot use it ? Either a wrong path has been issued or it should be usable by its targets, ntfs-3g is just a way among others from the source to a target.

Or am I missing something ?

Regards

Jean-Pierre


Sun May 15, 2011 09:02
Profile

Joined: Sat May 14, 2011 14:54
Posts: 7
Post Re: umount: /dev/dm-7: not mounted
jpa wrote:
Then, I see that ntfs-3g forwards the device path it receives to fuse, which forwards to some package which puts it into mtab. Do you know where the "dm-*" comes from, and why umount cannot use it ? Either a wrong path has been issued or it should be usable by its targets, ntfs-3g is just a way among others from the source to a target.

mount/umount have their own funtion to canonicalize device file names. Perhaps, there're 2 reasons:
Sometimes (with dmraid) /dev/mapper/* files can be NOT symlinks to /dev/dm-*, but special files with the same major:minor.
/dev/mapper/* names are quite descriptive compared to dm-0, dm-1 etc.

The umount program expects the canonic device name in mtab (or --no-canonicalize). Otherwise it'll fail.
Truecript expects /dev/mapper/truecrypt*, when it checks whether it's volumes are mounted.

jpa wrote:
This problem is unrelated to ntfs-3g, you have to patch all the filesystems drivers (at least all which rely on fuse).

This issue seems common among drivers that use their own mount program, e.g. nilfs2. They use realpath() to resolve symlinks. If you change it, this issue will vanish in modern linuxes. Older linuxes won't be affected.

jpa wrote:
First, can you check that the modification to "mount_util.c" is unneeded, this deals with the mountpoint, not the device path.

Is libfuse-lite only for linux, where we shouldn't check for presence of realpath()?


Sun May 15, 2011 13:26
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: umount: /dev/dm-7: not mounted
Hi,


Quote:
Quote:
jpa wrote:
First, can you check that the modification to "mount_util.c" is unneeded, this deals with the mountpoint, not the device path.

Is libfuse-lite only for linux, where we shouldn't check for presence of realpath()?

libfuse-lite is a simplified fuse library. Some distributions use it, others (eg Ubuntu) use the full fuse library. If you need fixing fuse-lite, you also need fixing the full version.

However, your explanation is only about the device path, and the realpath() in fuse is about the mountpoint, NOT the device path, so the part of your proposed patch dealing with the file libfuse-lite/mount_util.c is not related to the issue. I just would like you to remove this part and check whether the fix is still valid. I just have no configuration to make sure of it.

Regards

Jean-Pierre


Sun May 15, 2011 13:58
Profile

Joined: Sat May 14, 2011 14:54
Posts: 7
Post Re: umount: /dev/dm-7: not mounted
I understood that _ntfs_canonicalize_path() shouldn't be used inside libfuse-lite, but there's also _ntfs_realpath() - a dummy realpath() implementation for systems lacking it.
I mean, is there a possibility that libfuse-lite will be used on a system without realpath()? Then we should keep realpath.c inside libfuse-lite. Otherwise I can move it to libntfs-3g.


Sun May 15, 2011 15:30
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: umount: /dev/dm-7: not mounted
Hi again,

Quote:
I understood that _ntfs_canonicalize_path() shouldn't be used inside libfuse-lite,

But that is not what I mean. The realpath() at line 180 of mount-util.c has nothing to do with /dev/anything, it is not related with your issue. You should leave it unchanged, no need to move it elsewhere.

Regards

Jean-Pierre


Sun May 15, 2011 17:00
Profile

Joined: Sat May 14, 2011 14:54
Posts: 7
Post Re: umount: /dev/dm-7: not mounted
Sorry for the delay. Heres the patch without mount-util.c


Attachments:
canonicalize_path.patch.gz [1.99 KiB]
Downloaded 1052 times
Mon May 16, 2011 21:48
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: umount: /dev/dm-7: not mounted
Hi,

Quote:
Sorry for the delay. Heres the patch without mount-util.c

Thanks. Can you confirm this fixes your issue ? I cannot test myself.

Also, is there a real need for "#define MAXSYMLINKS" ?

Regards

Jean-Pierre


Mon May 16, 2011 22:01
Profile

Joined: Sat May 14, 2011 14:54
Posts: 7
Post Re: umount: /dev/dm-7: not mounted
i confirm.
Yes, MAXSYMLINKS is unneeded - leftover code.

Quote:
You cannot make another post so soon after your last.
- :evil:


Tue May 17, 2011 06:56
Profile

Joined: Tue May 17, 2011 21:33
Posts: 5
Post Re: umount: /dev/dm-7: not mounted
I ran into this recently on Ubuntu during the Natty development cycle when it caused the installer to hang. There are two related bugs, one in umount, and one in ntfs-3g. The bug in umount is that even when you specify the dm-N name that is recorded in mtab, it fails to unmount it. I reported this to the util-linux mailing list where it was fixed. The bug in ntfs-3g is that it records dm-N instead of /dev/mapper/foo in mtab. It needs to record the /dev/mapper/foo name so that you can later unmount the same device name that you used to mount with.

This applies to dmraid devices, but also LVM, though it is unlikely that people will be using NTFS on an LVM volume since it isn't accessible to Windows.


Tue May 17, 2011 21:45
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: umount: /dev/dm-7: not mounted
Hi,

Quote:
The bug in ntfs-3g is that it records dm-N instead of /dev/mapper/foo in mtab. It needs to record the /dev/mapper/foo name so that you can later unmount the same device name that you used to mount with.

Can you check whether the patch posted above by basinilya solves this ?
Quote:
The bug in umount is that even when you specify the dm-N name that is recorded in mtab, it fails to unmount it.

My interpretation is that this is the only bug. When you mount a symlinked device, such as /dev/disk/by-uuid/xx, the actual device path is stored in mtab, and umount is able to unmount the symlinked name. It should be able to unmount dm-N names the same way. You are not to patch all filesystems as a workaround. AFAIK the canonicalization is made to prevent device hijackings.
Quote:
I reported this to the util-linux mailing list where it was fixed.

This is probably the same as the patch posted by basinilya.
Quote:
This applies to dmraid devices, but also LVM, though it is unlikely that people will be using NTFS on an LVM volume since it isn't accessible to Windows.

Do you mean the same patch applies, or a similar workaround is also needed ?

Regards

Jean-Pierre


Wed May 18, 2011 08:27
Profile

Joined: Tue May 17, 2011 21:33
Posts: 5
Post Re: umount: /dev/dm-7: not mounted
jpa wrote:
My interpretation is that this is the only bug. When you mount a symlinked device, such as /dev/disk/by-uuid/xx, the actual device path is stored in mtab, and umount is able to unmount the symlinked name. It should be able to unmount dm-N names the same way. You are not to patch all filesystems as a workaround. AFAIK the canonicalization is made to prevent device hijackings.


The /dev/mapper/name is the canonical device name, not a symlink. Quoting the discussion from util-linux:

The /dev/dm-N names are private for DM and should not be used in
userspace for normal operations. All utils which use the /dev/dm-N
format for DM devices (in output or in files like mtab) should be
FIXED.

Karel

jpa wrote:
Do you mean the same patch applies, or a similar workaround is also needed ?


I mean the same problem applies because LVM is also a device-mapper device.


Wed May 18, 2011 15:52
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.