]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
umount.nfs: Harden umount.nfs error reporting nfs-utils-1-1-7-rc1
authorChuck Lever <chuck.lever@oracle.com>
Mon, 18 May 2009 17:29:38 +0000 (13:29 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 18 May 2009 17:29:38 +0000 (13:29 -0400)
Add additional error reporting to nfs_advise_umount().
These messages can be displayed if the "-v" option
is specified with umount.nfs.  Normally these
messages do not appear.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/network.c
utils/mount/nfsumount.c

index d93e98d03b6a906b281a9f2aef42bb018840d9c1..04a62abb2eb26433175efca086bd30aaef026352 100644 (file)
@@ -819,17 +819,24 @@ int nfs_advise_umount(const struct sockaddr *sap, const socklen_t salen,
        CLIENT *client;
        enum clnt_stat res = 0;
 
-       if (nfs_probe_mntport(sap, salen, &mnt_pmap) == 0)
-               return 0;
-
        memcpy(saddr, sap, salen);
+       if (nfs_probe_mntport(saddr, salen, &mnt_pmap) == 0) {
+               if (verbose)
+                       nfs_error(_("%s: Failed to discover mountd port%s"),
+                               progname, clnt_spcreateerror(""));
+               return 0;
+       }
        nfs_set_port(saddr, mnt_pmap.pm_port);
 
        client = nfs_get_priv_rpcclient(saddr, salen, mnt_pmap.pm_prot,
                                        mnt_pmap.pm_prog, mnt_pmap.pm_vers,
                                        &timeout);
-       if (client == NULL)
+       if (client == NULL) {
+               if (verbose)
+                       nfs_error(_("%s: Failed to create RPC client%s"),
+                               progname, clnt_spcreateerror(""));
                return 0;
+       }
 
        client->cl_auth = authunix_create_default();
 
@@ -837,13 +844,15 @@ int nfs_advise_umount(const struct sockaddr *sap, const socklen_t salen,
                        (xdrproc_t)xdr_dirpath, (caddr_t)argp,
                        (xdrproc_t)xdr_void, NULL,
                        timeout);
+       if (verbose && res != RPC_SUCCESS)
+               nfs_error(_("%s: UMNT call failed: %s"),
+                       progname, clnt_sperrno(res));
 
        auth_destroy(client->cl_auth);
        CLNT_DESTROY(client);
 
        if (res != RPC_SUCCESS)
                return 0;
-
        return 1;
 }
 
index 4b2e53054b83ed515ae5990e88a584d364e2d117..9b48cc9a63239d9c92eb89edf31cdfd56476ae72 100644 (file)
@@ -182,14 +182,15 @@ static int nfs_umount_do_umnt(struct mount_options *options,
                return EX_FAIL;
        }
 
-       if (nfs_name_to_address(*hostname, sap, &salen)) {
-               if (nfs_advise_umount(sap, salen, &mnt_pmap, dirname) != 0)
-                       return EX_SUCCESS;
-               else
-                       nfs_error(_("%s: Server failed to unmount '%s:%s'"),
-                                       progname, *hostname, *dirname);
-       }
-       return EX_FAIL;
+       if (nfs_name_to_address(*hostname, sap, &salen) == 0)
+               /* nfs_name_to_address reports any errors */
+               return EX_FAIL;
+
+       if (nfs_advise_umount(sap, salen, &mnt_pmap, dirname) == 0)
+               /* nfs_advise_umount reports any errors */
+               return EX_FAIL;
+
+       return EX_SUCCESS;
 }
 
 /*