Frederik Himpe | 19 Mar 2009 12:06
Picon
Favicon

ntfs-3g hanging when mounting file system (because of recovery?)

On Mandriva's bugzilla, there are lots of reports [1] about the system 
starting to hang during mounting of the NTFS partitions with ntfs-3g. The 
system continues to boot when pressing Ctrl-C. This seems to happen 
especially at the first boot after installation, which makes me think that 
this could be caused by the recover option now in ntfs-3g (ntfsresize 
probably marked the ntfs file system as dirty during installation).

Is it possible that this recover option needs user input or would there be 
another reason why ntfs-3g causes the boot process to stop until Ctrl-C is 
pressed?

[1] https://qa.mandriva.com/show_bug.cgi?id=48674

--

-- 
Frederik Himpe

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
Szabolcs Szakacsits | 19 Mar 2009 18:12
Favicon

Re: ntfs-3g hanging when mounting file system (because of recovery?)


On Thu, 19 Mar 2009, Frederik Himpe wrote:

> On Mandriva's bugzilla, there are lots of reports [1] about the system 
> starting to hang during mounting of the NTFS partitions with ntfs-3g. The 
> system continues to boot when pressing Ctrl-C. This seems to happen 
> especially at the first boot after installation, which makes me think that 
> this could be caused by the recover option now in ntfs-3g (ntfsresize 
> probably marked the ntfs file system as dirty during installation).
> 
> Is it possible that this recover option needs user input or would there be 
> another reason why ntfs-3g causes the boot process to stop until Ctrl-C is 
> pressed?
> 
> [1] https://qa.mandriva.com/show_bug.cgi?id=48674

Ntfs-3g triggers a recently introduced bug in mount(8) which can cause 
mount to hang. 'strace -f' will confirm it. Fix must be already available 
for mount(8).

        Szaka

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
Frederik Himpe | 19 Mar 2009 23:50
Picon
Favicon

Re: ntfs-3g hanging when mounting file system (because of recovery?)

On Thu, 19 Mar 2009 19:12:53 +0200, Szabolcs Szakacsits wrote:

> On Thu, 19 Mar 2009, Frederik Himpe wrote:
> 
>> On Mandriva's bugzilla, there are lots of reports [1] about the system
>> starting to hang during mounting of the NTFS partitions with ntfs-3g.
>> The system continues to boot when pressing Ctrl-C. This seems to happen
>> especially at the first boot after installation, which makes me think
>> that this could be caused by the recover option now in ntfs-3g
>> (ntfsresize probably marked the ntfs file system as dirty during
>> installation).
> 
> Ntfs-3g triggers a recently introduced bug in mount(8) which can cause
> mount to hang. 'strace -f' will confirm it. Fix must be already
> available for mount(8).

Do you know where this fix can be found?

--

-- 
Frederik Himpe

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
Szabolcs Szakacsits | 20 Mar 2009 00:18
Favicon

Re: ntfs-3g hanging when mounting file system (because of recovery?)


On Thu, 19 Mar 2009, Frederik Himpe wrote:
> On Thu, 19 Mar 2009 19:12:53 +0200, Szabolcs Szakacsits wrote:
> > On Thu, 19 Mar 2009, Frederik Himpe wrote:
> > 
> >> On Mandriva's bugzilla, there are lots of reports [1] about the system
> >> starting to hang during mounting of the NTFS partitions with ntfs-3g.
> >> The system continues to boot when pressing Ctrl-C. This seems to happen
> >> especially at the first boot after installation, which makes me think
> >> that this could be caused by the recover option now in ntfs-3g
> >> (ntfsresize probably marked the ntfs file system as dirty during
> >> installation).
> > 
> > Ntfs-3g triggers a recently introduced bug in mount(8) which can cause
> > mount to hang. 'strace -f' will confirm it. Fix must be already
> > available for mount(8).
> 
> Do you know where this fix can be found?

I suppose in the latest package or git which contains the mount(8)
utility the problematic Mandriva distribution version uses.

        Szaka

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
(Continue reading)

Pascal Terjan | 23 Mar 2009 17:55
Picon

Re: ntfs-3g hanging when mounting file system (because of recovery?)

Szabolcs Szakacsits <szaka <at> ...> writes:

> On Thu, 19 Mar 2009, Frederik Himpe wrote:
> > On Thu, 19 Mar 2009 19:12:53 +0200, Szabolcs Szakacsits wrote:
> > > On Thu, 19 Mar 2009, Frederik Himpe wrote:
> > > 
> > >> On Mandriva's bugzilla, there are lots of reports [1] about the system
> > >> starting to hang during mounting of the NTFS partitions with ntfs-3g.
> > >> The system continues to boot when pressing Ctrl-C. This seems to happen
> > >> especially at the first boot after installation, which makes me think
> > >> that this could be caused by the recover option now in ntfs-3g
> > >> (ntfsresize probably marked the ntfs file system as dirty during
> > >> installation).
> > > 
> > > Ntfs-3g triggers a recently introduced bug in mount(8) which can cause
> > > mount to hang. 'strace -f' will confirm it. Fix must be already
> > > available for mount(8).
> > 
> > Do you know where this fix can be found?
> 
> I suppose in the latest package or git which contains the mount(8)
> utility the problematic Mandriva distribution version uses.

I can't any fix in util-linux-ng git that may look related

BTW fedora has the same issue 
https://bugzilla.redhat.com/show_bug.cgi?id=486619

I could manage to get a shell on such box, after it hanged
gdb and strace can't give any info
(Continue reading)

Szabolcs Szakacsits | 23 Mar 2009 18:17
Favicon

Re: ntfs-3g hanging when mounting file system (because of recovery?)


Looks like the mount(8) double /etc/mtab lock deadlock bug mentioned at 
https://qa.mandriva.com/show_bug.cgi?id=48674#c12

Check /proc/locks. /bin/mount is hanging. 

	Szaka

On Mon, 23 Mar 2009, Pascal Terjan wrote:

> Szabolcs Szakacsits <szaka <at> ...> writes:
> 
> > On Thu, 19 Mar 2009, Frederik Himpe wrote:
> > > On Thu, 19 Mar 2009 19:12:53 +0200, Szabolcs Szakacsits wrote:
> > > > On Thu, 19 Mar 2009, Frederik Himpe wrote:
> > > > 
> > > >> On Mandriva's bugzilla, there are lots of reports [1] about the system
> > > >> starting to hang during mounting of the NTFS partitions with ntfs-3g.
> > > >> The system continues to boot when pressing Ctrl-C. This seems to happen
> > > >> especially at the first boot after installation, which makes me think
> > > >> that this could be caused by the recover option now in ntfs-3g
> > > >> (ntfsresize probably marked the ntfs file system as dirty during
> > > >> installation).
> > > > 
> > > > Ntfs-3g triggers a recently introduced bug in mount(8) which can cause
> > > > mount to hang. 'strace -f' will confirm it. Fix must be already
> > > > available for mount(8).
> > > 
> > > Do you know where this fix can be found?
> > 
(Continue reading)

Pascal Terjan | 23 Mar 2009 18:45
Picon

Re: ntfs-3g hanging when mounting file system (because of recovery?)

On Mon, Mar 23, 2009 at 6:17 PM, Szabolcs Szakacsits <szaka <at> ntfs-3g.org> wrote:

Looks like the mount(8) double /etc/mtab lock deadlock bug mentioned at
https://qa.mandriva.com/show_bug.cgi?id=48674#c12

Check /proc/locks. /bin/mount is hanging.

Oh sorry I had missed this comment, I'll try reproduce again and look at the locks but

1/ the links in the comment are about a bug in ecryptfs selinux patch at fedora and the report about the same problem without any explanation or solution
2/ I still can't find anything about a mtab lock bug in mount and a fix for it
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@...
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel
Szabolcs Szakacsits | 23 Mar 2009 21:42
Favicon

Re: ntfs-3g hanging when mounting file system (because of recovery?)


On Mon, 23 Mar 2009, Pascal Terjan wrote:
> On Mon, Mar 23, 2009 at 6:17 PM, Szabolcs Szakacsits <szaka@...>wrote:
> 
> > Looks like the mount(8) double /etc/mtab lock deadlock bug mentioned at
> > https://qa.mandriva.com/show_bug.cgi?id=48674#c12
> >
> > Check /proc/locks. /bin/mount is hanging.
> 
> Oh sorry I had missed this comment, I'll try reproduce again and look at the
> locks but
> 
> 1/ the links in the comment are about a bug in ecryptfs selinux patch at
> fedora and the report about the same problem without any explanation or
> solution
> 2/ I still can't find anything about a mtab lock bug in mount and a fix for
> it

Check where /bin/mount hangs (ask maintainer?). ntfs-3g calls mount(8) to 
update /etc/mtab which doesn't return, so ntfs-3g hangs too waiting for it.

It could be also SELinux related. There were a few similar cases in the 
past. Does Mandriva also use SELinux? Does this text help from the Fedora 
bugzilla:

--------------------------------------------------------------------->
Another interesting thing: If I initiate a full relabeling of the 
filesystems (i.e. touching /.autorelabel) the system boots fine too and 
mounts the ntfs paritions during boot without problems. The next boot will 
hang again (unless initiating another relabeling or changing the nfts 
fstab-entries to noauto)
<---------------------------------------------------------------------

	Szaka

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
Pascal Terjan | 23 Mar 2009 22:12
Picon

Re: ntfs-3g hanging when mounting file system (because of recovery?)

On Mon, Mar 23, 2009 at 9:42 PM, Szabolcs Szakacsits <szaka <at> ntfs-3g.org> wrote:

On Mon, 23 Mar 2009, Pascal Terjan wrote:
> On Mon, Mar 23, 2009 at 6:17 PM, Szabolcs Szakacsits <szaka <at> ntfs-3g.org>wrote:
>
> > Looks like the mount(8) double /etc/mtab lock deadlock bug mentioned at
> > https://qa.mandriva.com/show_bug.cgi?id=48674#c12
> >
> > Check /proc/locks. /bin/mount is hanging.
>
> Oh sorry I had missed this comment, I'll try reproduce again and look at the
> locks but
>
> 1/ the links in the comment are about a bug in ecryptfs selinux patch at
> fedora and the report about the same problem without any explanation or
> solution
> 2/ I still can't find anything about a mtab lock bug in mount and a fix for
> it

Check where /bin/mount hangs (ask maintainer?). ntfs-3g calls mount(8) to
update /etc/mtab which doesn't return, so ntfs-3g hangs too waiting for it.

I could not reproduce at all over the last hours, I will try again tomorrow


It could be also SELinux related. There were a few similar cases in the
past. Does Mandriva also use SELinux?

No we don't use SELinux

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@...
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel
Pascal Terjan | 27 Mar 2009 14:44
Picon

Re: ntfs-3g hanging when mounting file system (because of recovery?)

Hello,
I finally have some interesting information!

This issue happens when audit is enabled:

auditctl -e 1
auditctl -w /etc
mount /dev/sda1 /mnt/windows

------------------------------------------------------------------------------
Szabolcs Szakacsits | 27 Mar 2009 18:00
Favicon

Re: ntfs-3g hanging when mounting file system (because of recovery?)


Hi,

Thank you for the update.

On Fri, 27 Mar 2009, Pascal Terjan wrote:

> I finally have some interesting information!
> 
> This issue happens when audit is enabled:
> 
> auditctl -e 1
> auditctl -w /etc
> mount /dev/sda1 /mnt/windows

I suppose then the problem is in the kernel audit code? This is how 
ntfs-3g mount happens considering the /etc directory:

   /bin/mount calls /bin/ntfs-3g 
   /bin/ntfs-3g calls /bin/mount to update /etc/mtab 
   the second /bin/mount hangs

Hopefully this will help the developer who is writing the kernel 
audit code.

Regards,
	    Szaka

------------------------------------------------------------------------------
Pascal Terjan | 27 Mar 2009 19:47
Picon

Re: ntfs-3g hanging when mounting file system (because of recovery?)

On Fri, Mar 27, 2009 at 6:00 PM, Szabolcs Szakacsits <szaka@...> wrote:
>
> Hi,
>
> Thank you for the update.
>
> On Fri, 27 Mar 2009, Pascal Terjan wrote:
>
>> I finally have some interesting information!
>>
>> This issue happens when audit is enabled:
>>
>> auditctl -e 1
>> auditctl -w /etc
>> mount /dev/sda1 /mnt/windows
>
> I suppose then the problem is in the kernel audit code? This is how
> ntfs-3g mount happens considering the /etc directory:
>
>   /bin/mount calls /bin/ntfs-3g
>   /bin/ntfs-3g calls /bin/mount to update /etc/mtab
>   the second /bin/mount hangs
>
> Hopefully this will help the developer who is writing the kernel
> audit code.
>
> Regards,
>            Szaka
>

The second /bin/mount hangs on readlink("/mnt/windows",

mount         S 00004cca     0 11821  11819
 c3401dcc 00200082 00004cca 00004cca c3401d7c c0134709 00200086 386e9131
 000003e1 00004cca dfb8d540 dfb5a000 c05ebcd9 c05b7380 df88a490 df88a6f0
 c1409380 00000000 00000000 38734404 000003e1 c3401db0 c3401da8 df88a6f0
Call Trace:
 [<c0134709>] ? release_console_sem+0x199/0x1e0
 [<c014934a>] ? prepare_to_wait+0x3a/0x70
 [<e0d4a77c>] wait_answer_interruptible+0x6c/0xa0 [fuse]
 [<c01490f0>] ? autoremove_wake_function+0x0/0x50
 [<e0d4a9f1>] fuse_request_send+0x181/0x250 [fuse]
 [<e0d4bba5>] ? fuse_get_req+0xc5/0x120 [fuse]
 [<e0d4c403>] fuse_getxattr+0xe3/0x140 [fuse]
 [<e0d4c320>] ? fuse_getxattr+0x0/0x140 [fuse]
 [<c022d940>] get_vfs_caps_from_disk+0x60/0xe0
 [<c01ba5eb>] ? __link_path_walk+0x26b/0xd70
 [<c016cfa7>] audit_copy_inode+0x77/0xb0
 [<c016d410>] __audit_inode+0xf0/0x280
 [<c01bb4da>] do_path_lookup+0x13a/0x1a0
 [<c01bc0aa>] user_path_at+0x4a/0x80
 [<c01c770d>] ? mntput_no_expire+0x1d/0x140
 [<c01c770d>] ? mntput_no_expire+0x1d/0x140
 [<c01b45fe>] sys_readlinkat+0x2e/0x90
 [<c01b4687>] sys_readlink+0x27/0x30
 [<c0103fdb>] sysenter_do_call+0x12/0x2f
 [<c03a0000>] ? serial_pnp_probe+0xb0/0x240

So it looks like the issue is that when mount does readlink on the
mountpoint audit will do a request to get the xattr which will hang
because ntfs-3g is not ready to reply, probably waiting for mount to
finish

Is it necessary to wait for the child mount in main process ?

------------------------------------------------------------------------------
Szabolcs Szakacsits | 27 Mar 2009 21:32
Favicon

Re: ntfs-3g hanging when mounting file system (because of recovery?)


On Fri, 27 Mar 2009, Pascal Terjan wrote:
> On Fri, Mar 27, 2009 at 6:00 PM, Szabolcs Szakacsits
<szaka@...> wrote:
> > On Fri, 27 Mar 2009, Pascal Terjan wrote:
> >
> >> I finally have some interesting information!
> >>
> >> This issue happens when audit is enabled:
> >>
> >> auditctl -e 1
> >> auditctl -w /etc
> >> mount /dev/sda1 /mnt/windows
> >
> > I suppose then the problem is in the kernel audit code? This is how
> > ntfs-3g mount happens considering the /etc directory:
> >
> >   /bin/mount calls /bin/ntfs-3g
> >   /bin/ntfs-3g calls /bin/mount to update /etc/mtab
> >   the second /bin/mount hangs
> >
> > Hopefully this will help the developer who is writing the kernel
> > audit code.
> 
> The second /bin/mount hangs on readlink("/mnt/windows",
> 
> mount         S 00004cca     0 11821  11819
>  c3401dcc 00200082 00004cca 00004cca c3401d7c c0134709 00200086 386e9131
>  000003e1 00004cca dfb8d540 dfb5a000 c05ebcd9 c05b7380 df88a490 df88a6f0
>  c1409380 00000000 00000000 38734404 000003e1 c3401db0 c3401da8 df88a6f0
> Call Trace:
>  [<c0134709>] ? release_console_sem+0x199/0x1e0
>  [<c014934a>] ? prepare_to_wait+0x3a/0x70
>  [<e0d4a77c>] wait_answer_interruptible+0x6c/0xa0 [fuse]
>  [<c01490f0>] ? autoremove_wake_function+0x0/0x50
>  [<e0d4a9f1>] fuse_request_send+0x181/0x250 [fuse]
>  [<e0d4bba5>] ? fuse_get_req+0xc5/0x120 [fuse]
>  [<e0d4c403>] fuse_getxattr+0xe3/0x140 [fuse]
>  [<e0d4c320>] ? fuse_getxattr+0x0/0x140 [fuse]
>  [<c022d940>] get_vfs_caps_from_disk+0x60/0xe0
>  [<c01ba5eb>] ? __link_path_walk+0x26b/0xd70
>  [<c016cfa7>] audit_copy_inode+0x77/0xb0
>  [<c016d410>] __audit_inode+0xf0/0x280
>  [<c01bb4da>] do_path_lookup+0x13a/0x1a0
>  [<c01bc0aa>] user_path_at+0x4a/0x80
>  [<c01c770d>] ? mntput_no_expire+0x1d/0x140
>  [<c01c770d>] ? mntput_no_expire+0x1d/0x140
>  [<c01b45fe>] sys_readlinkat+0x2e/0x90
>  [<c01b4687>] sys_readlink+0x27/0x30
>  [<c0103fdb>] sysenter_do_call+0x12/0x2f
>  [<c03a0000>] ? serial_pnp_probe+0xb0/0x240

Very useful information, thank you.

> So it looks like the issue is that when mount does readlink on the
> mountpoint audit will do a request to get the xattr which will hang
> because ntfs-3g is not ready to reply, probably waiting for mount to
> finish

Yes. 

> Is it necessary to wait for the child mount in main process ?

Yes. 

I forwarded the issue to FUSE development. I'll let you know ASAP when 
there is a solution or suggestion where/how the "mount on a symlink with 
audit turned on for the /etc directory" scenario could be fixed.

Thanks,
	   Szaka

------------------------------------------------------------------------------
Szabolcs Szakacsits | 28 Mar 2009 19:09
Favicon

Re: ntfs-3g hanging when mounting file system (because of recovery?)


On Fri, 27 Mar 2009, Szabolcs Szakacsits wrote:
> 
> I forwarded the issue to FUSE development. I'll let you know ASAP when 
> there is a solution or suggestion where/how the "mount on a symlink with 
> audit turned on for the /etc directory" scenario could be fixed.

Could you please point us to the util-linux-ng source and all the patches 
the relevant Mandriva version applied, or tell us why /etc/mtab update 
needs to do a symlink(2) on the mount point?

Thanks,
	   Szaka

------------------------------------------------------------------------------
Pascal Terjan | 28 Mar 2009 22:27
Picon

Re: ntfs-3g hanging when mounting file system (because of recovery?)

On Sat, Mar 28, 2009 at 7:09 PM, Szabolcs Szakacsits <szaka@...> wrote:
>
> On Fri, 27 Mar 2009, Szabolcs Szakacsits wrote:
>>
>> I forwarded the issue to FUSE development. I'll let you know ASAP when
>> there is a solution or suggestion where/how the "mount on a symlink with
>> audit turned on for the /etc directory" scenario could be fixed.
>
> Could you please point us to the util-linux-ng source and all the patches
> the relevant Mandriva version applied, or tell us why /etc/mtab update
> needs to do a symlink(2) on the mount point?

We use util-linux-ng-2.14.1 + patches on
http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/util-linux-ng/current/SOURCES/

It does not call symlink but readlink

The function canonicalize_mountpoint will end up calling a myrealpath
function dropping extra /, following symlinks, etc...

http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blob_plain;f=mount/realpath.c;hb=stable/v2.14

------------------------------------------------------------------------------
Szabolcs Szakacsits | 28 Mar 2009 22:44
Favicon

Re: ntfs-3g hanging when mounting file system


Hi,

Thank you for the followup. 

As far as I see, this is a mount(8) bug. Canonicalize_mountpoint should be 
called before mount(2), not after.

Regards,
	   Szaka

On Sat, 28 Mar 2009, Pascal Terjan wrote:

> On Sat, Mar 28, 2009 at 7:09 PM, Szabolcs Szakacsits
<szaka@...> wrote:
> >
> > On Fri, 27 Mar 2009, Szabolcs Szakacsits wrote:
> >>
> >> I forwarded the issue to FUSE development. I'll let you know ASAP when
> >> there is a solution or suggestion where/how the "mount on a symlink with
> >> audit turned on for the /etc directory" scenario could be fixed.
> >
> > Could you please point us to the util-linux-ng source and all the patches
> > the relevant Mandriva version applied, or tell us why /etc/mtab update
> > needs to do a symlink(2) on the mount point?
> 
> We use util-linux-ng-2.14.1 + patches on
> http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/util-linux-ng/current/SOURCES/
> 
> It does not call symlink but readlink
> 
> The function canonicalize_mountpoint will end up calling a myrealpath
> function dropping extra /, following symlinks, etc...
> 
> http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blob_plain;f=mount/realpath.c;hb=stable/v2.14

------------------------------------------------------------------------------
Szabolcs Szakacsits | 28 Mar 2009 23:47
Favicon

Re: ntfs-3g hanging when mounting file system


On Sat, 28 Mar 2009, Szabolcs Szakacsits wrote:

> As far as I see, this is a mount(8) bug. Canonicalize_mountpoint should be 
> called before mount(2), not after.

Of course that's not possible because fuse/ntfs-3g already called mount(2).

So mount helpers or/and FUSE should do the realpath and call mount(8) -i 
with it and mount(8) should trust it in such case. Apparently the 
mountpoint passed to mount(8) -i is not canonicalized yet (it's probably 
true for most mount helpers).

Another simple workaround is if we don't wait for the result of mtab 
update. This may or may not cause problems depending on how the mntent 
functions work and other things. Moreover technically it's still incorrect 
mount(8) trying to resolve the mountpoint inside the already mounted file 
system.

Couldn't /etc/mtab be just a symlink to /proc/mounts or one of its 
variants? ;-) Then no need to call /bin/mount -i.

	Szaka

> On Sat, 28 Mar 2009, Pascal Terjan wrote:
> 
> > On Sat, Mar 28, 2009 at 7:09 PM, Szabolcs Szakacsits
<szaka@...> wrote:
> > >
> > > On Fri, 27 Mar 2009, Szabolcs Szakacsits wrote:
> > >>
> > >> I forwarded the issue to FUSE development. I'll let you know ASAP when
> > >> there is a solution or suggestion where/how the "mount on a symlink with
> > >> audit turned on for the /etc directory" scenario could be fixed.
> > >
> > > Could you please point us to the util-linux-ng source and all the patches
> > > the relevant Mandriva version applied, or tell us why /etc/mtab update
> > > needs to do a symlink(2) on the mount point?
> > 
> > We use util-linux-ng-2.14.1 + patches on
> > http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/util-linux-ng/current/SOURCES/
> > 
> > It does not call symlink but readlink
> > 
> > The function canonicalize_mountpoint will end up calling a myrealpath
> > function dropping extra /, following symlinks, etc...
> > 
> > http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blob_plain;f=mount/realpath.c;hb=stable/v2.14

------------------------------------------------------------------------------
Pascal Terjan | 28 Mar 2009 23:46
Picon

Re: ntfs-3g hanging when mounting file system

On Sat, Mar 28, 2009 at 10:44 PM, Szabolcs Szakacsits
<szaka@...> wrote:
>
> Hi,
>
> Thank you for the followup.
>
> As far as I see, this is a mount(8) bug. Canonicalize_mountpoint should be
> called before mount(2), not after.

Well the second mount process starts by doing canonicalize_mountpoint
before updating the mtab (and never calls mount(2)).

------------------------------------------------------------------------------
Szabolcs Szakacsits | 29 Mar 2009 00:24
Favicon

Re: ntfs-3g hanging when mounting file system


On Sat, 28 Mar 2009, Pascal Terjan wrote:
> On Sat, Mar 28, 2009 at 10:44 PM, Szabolcs Szakacsits
<szaka@...> wrote:
> >
> > Thank you for the followup.
> >
> > As far as I see, this is a mount(8) bug. Canonicalize_mountpoint should be
> > called before mount(2), not after.
> 
> Well the second mount process starts by doing canonicalize_mountpoint
> before updating the mtab (and never calls mount(2)).

If mount(8) calls the mount.foo helpers with resolved mountpoint then no 
need to resolve it again when it's called with the -i option.

But this breaks things which call mount -i with unresolved mountpoint.

Of course there could be a new mount(8) option for the resolved mountpoint 
case but the problem is, there are about half dozen different mount(8) 
already. We had a lot of problems with '/bin/mount -i' in the past.

It seems it would be more reliable and maintainable to copy back the 
relevant mount mtab update code to FUSE (and fuse-lite). How much code 
is it?

	Szaka

------------------------------------------------------------------------------
Szabolcs Szakacsits | 1 Apr 2009 03:54
Favicon

Re: ntfs-3g hanging when mounting file system


On Sun, 29 Mar 2009, Szabolcs Szakacsits wrote:
> 
> It seems it would be more reliable and maintainable to copy back the 
> relevant mount mtab update code to FUSE (and fuse-lite). How much code 
> is it?

I've checked. I think it's not worth.

Moreover both mount(8) and umount(8) ignore mtab update failure. So perhaps 
FUSE file systems should behave the same way.

If no strong objection then the temporary ntfs-3g workaround (not waiting 
for mtab update) will be included in the next stable package along with 
other important reliability fixes earliest on Thursday.

Thank you for making available the new Mandriva and Fedora packages with 
the workaround so fast.

Regards,
	   Szaka

------------------------------------------------------------------------------
Miklos Szeredi | 1 Apr 2009 13:18
Picon

Re: ntfs-3g hanging when mounting file system

On Wed, 1 Apr 2009, Szabolcs Szakacsits wrote:
> On Sun, 29 Mar 2009, Szabolcs Szakacsits wrote:
> > 
> > It seems it would be more reliable and maintainable to copy back the 
> > relevant mount mtab update code to FUSE (and fuse-lite). How much code 
> > is it?
> 
> I've checked. I think it's not worth.
> 
> Moreover both mount(8) and umount(8) ignore mtab update failure.

Hmm, interesting.

>  So perhaps 
> FUSE file systems should behave the same way.

Probably, yes.

> If no strong objection then the temporary ntfs-3g workaround (not waiting 
> for mtab update) will be included in the next stable package along with 
> other important reliability fixes earliest on Thursday.

Could you please forward me the patch?

Thanks,
Miklos

------------------------------------------------------------------------------
Szabolcs Szakacsits | 1 Apr 2009 17:15
Favicon

Re: ntfs-3g hanging when mounting file system


On Wed, 1 Apr 2009, Miklos Szeredi wrote:
> 
> > If no strong objection then the temporary ntfs-3g workaround (not waiting 
> > for mtab update) will be included in the next stable package along with 
> > other important reliability fixes earliest on Thursday.
> 
> Could you please forward me the patch?

Gladly.

Index: libfuse-lite/mount_util.c
===================================================================
RCS file: /cvsroot/ntfs-3g/ntfs-3g/libfuse-lite/mount_util.c,v
retrieving revision 1.5
diff -u -p -r1.5 mount_util.c
--- libfuse-lite/mount_util.c	27 Jun 2008 12:37:02 -0000	1.5
+++ libfuse-lite/mount_util.c	1 Apr 2009 14:44:46 -0000
 <at>  <at>  -58,7 +58,6  <at>  <at>  int fuse_mnt_add_mount(const char *progn
                        const char *mnt, const char *type, const char *opts)
 {
     int res;
-    int status;

     if (!mtab_needs_update(mnt))
         return 0;
 <at>  <at>  -66,7 +65,7  <at>  <at>  int fuse_mnt_add_mount(const char *progn
     res = fork();
     if (res == -1) {
         fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno));
-        return -1;
+        return 0;
     }
     if (res == 0) {
         char templ[] = "/tmp/fusermountXXXXXX";
 <at>  <at>  -96,14 +95,6  <at>  <at>  int fuse_mnt_add_mount(const char *progn
                 strerror(errno));
         exit(1);
     }
-    res = waitpid(res, &status, 0);
-    if (res == -1) {
-        fprintf(stderr, "%s: waitpid: %s\n", progname, strerror(errno));
-        return -1;
-    }
-    if (status != 0)
-        return -1;
-
     return 0;
 }

------------------------------------------------------------------------------

Gmane