]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/nfsumount.c
Don't fail an unmount just because we couldn't contact the NFS server.
[nfs-utils.git] / utils / mount / nfsumount.c
index 4311473b5536f892ad65492b601479c77f394831..9e9cd16a66e8c5d959e07dc8a129716d97adbe9a 100644 (file)
@@ -102,10 +102,14 @@ static int del_mtab(const char *spec, const char *node)
        } else
                res = umount (node);
 
-       if (res < 0 && remount && errno == EBUSY && spec) {
-               res = try_remount(spec, node);
-               if (!res)
+       if (res < 0) {
+               if (remount && errno == EBUSY && spec) {
+                       res = try_remount(spec, node);
+                       if (res)
+                               goto writemtab;
                        return 0;
+               } else
+                       umnt_err = errno;
        }
 
        if (res >= 0) {
@@ -344,10 +348,9 @@ int nfsumount(int argc, char *argv[])
 
        ret = 0;
        if (mc) {
-               if (!lazy)
+               if (!lazy && strcmp(mc->m.mnt_type, "nfs4") != 0)
                        ret = do_nfs_umount(mc->m.mnt_fsname, mc->m.mnt_opts);
-               if (!ret || force)
-                       ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir);
+               ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir) ?: ret;
        } else if (*spec != '/') {
                if (!lazy)
                        ret = do_nfs_umount(spec, "tcp,v3");