Skip to contentSkip to conversation

unmount -l does not send unmount request to the server

DISCUSSION Chuck Lever 3 participants 4 messages Jan 19, 2010 – Mar 19, 2010 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Cc'ing NFSv3 mailing list.

Quoted 47 lines · Guillaume Rousse

Hello list.

A mandriva user report than unmount filesystem at shutdown is broken since the move of {mount,unmount}.nfs commands from coreutils to nfs-utils, some times ago:
https://qa.mandriva.com/show_bug.cgi?id=36490

It seems to be caused by the use of -l option in initscripts, which apparently don't send an umount request to the server anymore. A simple test is enough to confirm it:

When using 'mount.nfs server:/dir dir && umount.nfs dir' on the client, the server logs:

Jan 17 14:01:12  mountd[18714]: authenticated mount request from
192.168.0.1:840 for /home (/home)
Jan 17 14:01:12  mountd[18714]: authenticated unmount request from

192.168.0.1:1012 for /home (/home)

When using 'mount.nfs server:/dir dir && umount.nfs dir -l' on the client, the server logs:

Jan 17 14:09:17  mountd[18714]: authenticated mount request from

192.168.0.1:955 for /home (/home)

The filesystem is umounted client-side, but the server still thinks he is connected:
[root@oberkampf Desktop]# showmount
Hosts on oberkampf:
192.168.0.1

client uses nfs-utils 1.2.0.

Reading the code in nfsumount.c, as suggested by comment #11
(https://qa.mandriva.com/show_bug.cgi?id=36490#c11) seems to imply this is on purpose:

   if (mc) {
       if (!lazy && strcmp(mc->m.mnt_type, "nfs4") != 0)
           /* We ignore the error from nfs_umount23.
            * If the actual umount succeeds (in del_mtab),
            * we don't want to signal an error, as that
            * could cause /sbin/mount to retry!
            */
           nfs_umount23(mc->m.mnt_fsname, mc->m.mnt_opts);
       ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir) ?: ret;
   } else if (*spec != '/') {
       if (!lazy)
           ret = nfs_umount23(spec, "tcp,v3");
Quoted 5 lines

The description of this option seems to imply than he filesystem is marked as unmounted right now in mtab, and than he is actually umounted properly as soon as possible. This doesn't says anything about the server, tough, and I doesn't see anything in the code dealing with this 'as soon as possible' event anyway...

The init scripts use "-l" because they don't want a hang at shutdown. A hang might occur if the server is unreachable.

A UMNT is usually sent when the client knows it won't be using that export any longer.

As far as I understand it, "-l" means the kernel will do the local detach from the system's file name space whenever there are no more users (ie entirely asynchronously). I don't think umount2(MNT_DETACH) indicates whether the kernel was able to completely unmount that file system by the time the call returns, so there's perhaps no way for umount.nfs to know whether it should send the UMNT request. If the server is slow or unresponsive, that file system won't be unmounted until long after the umount.nfs command has exited.

This shouldn't be much of a big deal, since the server's rmtab is "ornamental" according to the man page. No one should rely on it being accurate.

A possible way to fix this is to have the kernel send the UMNT.

Signature · 10 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com




_______________________________________________
NFSv4 mailing list
[email protected]
http://linux-nfs.org/cgi-bin/mailman/listinfo/nfsv4
#2 lore raw

Le 19/01/2010 17:37, Chuck Lever a =E9crit :

Quoted 10 lines

As far as I understand it, "-l" means the kernel will do the local detach from the system's file name space whenever there are no more users (ie entirely asynchronously). I don't think umount2(MNT_DETACH) indicates whether the kernel was able to completely unmount that file system by the time the call returns, so there's perhaps no way for umount.nfs to know whether it should send the UMNT request. If the server is slow or unresponsive, that file system won't be unmounted until long after the umount.nfs command has exited.
=

Quoted 6 lines

This shouldn't be much of a big deal, since the server's rmtab is "ornamental" according to the man page. No one should rely on it being accurate.
=

A possible way to fix this is to have the kernel send the UMNT.

It makes sense, but it doesn't seem to trigger much interest :)

Should I open a bug somewhere, to ensure the issue won't be forgotten ? -- =

BOFH excuse #196:

Me no internet, only janitor, me just wax floors.

#4 lore raw
In reply to a message not in the archive
Quoted 4 lines · Guillaume Rousse

Le 19/01/2010 17:37, Chuck Lever a =E9crit :

Quoted 3 lines

As far as I understand it, "-l" means the kernel will do the local detach from the system's file name space whenever there are no more users (ie entirely asynchronously). I don't think umount2(MNT_DETAC=

H)

Quoted 1 line
Quoted 1 line

indicates whether the kernel was able to completely unmount that fil=

e

Quoted 7 lines
Quoted 7 lines

system by the time the call returns, so there's perhaps no way for umount.nfs to know whether it should send the UMNT request. If the server is slow or unresponsive, that file system won't be unmounted until long after the umount.nfs command has exited.

This shouldn't be much of a big deal, since the server's rmtab is "ornamental" according to the man page. No one should rely on it be=

ing

Quoted 6 lines
Quoted 3 lines

accurate.

A possible way to fix this is to have the kernel send the UMNT.

It makes sense, but it doesn't seem to trigger much interest :)

Should I open a bug somewhere, to ensure the issue won't be forgotten=

?

You might consider filing a bug in the NFSv4 bugzilla on linux-nfs.org.

--=20
chuck[dot]lever[at]oracle[dot]com

#5 lore raw

T24gRnJpLCAyMDEwLTAzLTE5IGF0IDE2OjIyIC0wNDAwLCBDaHVjayBMZXZlciB3cm90ZTogCj4g T24gMDMvMTQvMjAxMCAwNDo0MCBQTSwgR3VpbGxhdW1lIFJvdXNzZSB3cm90ZToKPiA+IExlIDE5 LzAxLzIwMTAgMTc6MzcsIENodWNrIExldmVyIGEgw6ljcml0IDoKPiA+PiBBcyBmYXIgYXMgSSB1 bmRlcnN0YW5kIGl0LCAiLWwiIG1lYW5zIHRoZSBrZXJuZWwgd2lsbCBkbyB0aGUgbG9jYWwKPiA+ PiBkZXRhY2ggZnJvbSB0aGUgc3lzdGVtJ3MgZmlsZSBuYW1lIHNwYWNlIHdoZW5ldmVyIHRoZXJl IGFyZSBubyBtb3JlCj4gPj4gdXNlcnMgKGllIGVudGlyZWx5IGFzeW5jaHJvbm91c2x5KS4gIEkg ZG9uJ3QgdGhpbmsgdW1vdW50MihNTlRfREVUQUNIKQo+ID4+IGluZGljYXRlcyB3aGV0aGVyIHRo ZSBrZXJuZWwgd2FzIGFibGUgdG8gY29tcGxldGVseSB1bm1vdW50IHRoYXQgZmlsZQo+ID4+IHN5 c3RlbSBieSB0aGUgdGltZSB0aGUgY2FsbCByZXR1cm5zLCBzbyB0aGVyZSdzIHBlcmhhcHMgbm8g d2F5IGZvcgo+ID4+IHVtb3VudC5uZnMgdG8ga25vdyB3aGV0aGVyIGl0IHNob3VsZCBzZW5kIHRo ZSBVTU5UIHJlcXVlc3QuICBJZi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