nfs-utils, umount -l, and unmount requests
Subsystems (2)
[I hope this is the right place to send this. I tried [email protected], who is listed on the relevant file's copyright, but that mailbox was disabled.]
This concerns nfsmount.c in nfs-utils-1.1.4.
I spent most of today trying to figure out why after upgrading an NFS client machine from Mandriva 2007.1 to 2008.1 suddenly the NFS server stopped logging "authenticated unmount request" messages when the client rebooted. It turned out this was a consequence of the umount "-l" flag, which is used in the shutdown scripts and the many recent changes in the organization of the umount commands. Long story short, under Mandriva 2007.1 umount looked for umount.nfs, which was not present in that release, and then went on to send the unmount request itself. On Mandriva 2008.1, where umount.nfs is present, the ball was passed to this program, which promptly dropped it if "-l" had been specified. The NFS directory was unmounted correctly, but the "unmount request" was never sent.
I traced this issue down to these lines of code in nfsumount.c, starting at line 351 (some may wrap):
if (mc) {
if (!lazy && strcmp(mc->m.mnt_type, "nfs4") != 0)
/* We ignore the error from do_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!
*/
do_nfs_umount23(mc->m.mnt_fsname, mc->m.mnt_opts);
ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir);
} else if (*spec != '/') {
if (!lazy)
ret = do_nfs_umount23(spec, "tcp,v3");
} else
ret = del_mtab(NULL, spec);
return ret;Removing the first "!lazy &&" resolved my immediate problem. What I don't understand is why it, and the latter "!lazy", were there in the first place. The do_nfs_umount23() routine seems to be relatively harmless, it either sends the message or it doesn't, but either way it doesn't seem to do anything to the mount information on the local node. So why is it not run if "-l" (lazy) is set?
Thanks,
David Mathog [email protected] Manager, Sequence Analysis Facility, Biology Division, Caltech
A message that is not in the archive (sent off-list or not yet received): E1L2wsc-0004Rs-2I-Mlb+9xX7RBA8OKIjkCRLjtKIQNXEaThN@public.gmane.org
Quoted 17 lines · David Mathog
if (mc) {
if (!lazy && strcmp(mc->m.mnt_type, "nfs4") != 0)
/* We ignore the error from do_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!
*/
do_nfs_umount23(mc->m.mnt_fsname, mc->m.mnt_opts);
ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir);
} else if (*spec != '/') {
if (!lazy)
ret = do_nfs_umount23(spec, "tcp,v3");
} else
ret = del_mtab(NULL, spec);
return ret;Quoted 3 lines
Removing the first "!lazy &&" resolved my immediate problem. What I don't understand is why it, and the latter "!lazy", were there in the first place.
To quote from the umount(8) man page:
-l Lazy unmount. Detach the filesystem from the filesystem hierar-
chy now, and cleanup all references to the filesystem as soon as
it is not busy anymore. (Requires kernel 2.4.11 or later.)
Which means in an NFS context that no RPC calls (i.e. call to the server) can be made that could possibility hang
Quoted 4 lines
The
do_nfs_umount23()routine seems to be relatively harmless, it either sends the message or it doesn't, but either way it doesn't seem to do anything to the mount information on the local node. So why is it not run if "-l" (lazy) is set?
Take a closer look... nfs_call_umount() makes a clnt_call() which would hang if the server is down, which is the reason its not called.
I hope this helps....
steved.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 18 lines · Steve Dickson
Quoted 17 lines · David Mathog
if (mc) { if (!lazy && strcmp(mc->m.mnt_type, "nfs4") != 0) /* We ignore the error from do_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! */ do_nfs_umount23(mc->m.mnt_fsname, mc->m.mnt_opts); ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir); } else if (*spec != '/') { if (!lazy) ret = do_nfs_umount23(spec, "tcp,v3"); } else ret = del_mtab(NULL, spec); return ret;
Quoted 1 line
Quoted 1 line
Removing the first "!lazy &&" resolved my immediate problem.
Can you explain further what your "immediate problem" was?
Quoted 18 lines
Quoted 3 lines
What I
don't understand is why it, and the latter "!lazy", were there in the first place.To quote from the umount(8) man page:
-l Lazy unmount. Detach the filesystem from the
filesystem hierar-chy now, and cleanup all references to the filesystem
as soon asit is not busy anymore. (Requires kernel 2.4.11 or
later.)Which means in an NFS context that no RPC calls (i.e. call to the server) can be made that could possibility hang
Quoted 8 lines
Quoted 4 lines
The
do_nfs_umount23()routine seems to be relatively harmless, it either sends the message or it doesn't, but either way it doesn't seem to do anything to the mount information on the local node. So why is it not run if "-l" (lazy) is set?Take a closer look...
nfs_call_umount()makes aclnt_call()which would hang if the server is down, which is the reason its not called.I hope this helps....
To clarify that, "-l" is used in cases where there are still outstanding NFS RPCs in the kernel for that mount point, but they can't complete because the server isn't available. Thus the mount point appears busy, and won't umount. "umount -l" is used here to prevent the system shutdown from hanging.
When there may be outstanding NFS requests, the client really shouldn't send the MNT_UMNT. In general, though, MNT_UMNT is entirely advisory, and the client shouldn't wait for it to complete. The server maintains a list of clients that have mounted each export, but that list isn't used for anything. So, it shouldn't matter whether the MNT_UMNT is sent.
One of the changes I made in my IPv6 patches is to shorten the timeout on that clnt_call(). We could even go so far as to make MNT_UMNT entirely asynchronous and not wait for the reply.
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com