umount.nfs: umount doesn't recognize a busy file system
authorChuck Lever <chuck.lever@oracle.com>
Mon, 24 Sep 2007 15:29:31 +0000 (11:29 -0400)
committerNeil Brown <neilb@suse.de>
Tue, 25 Sep 2007 01:50:16 +0000 (11:50 +1000)
umount.nfs shouldn't remove a busy file system from /etc/mtab, and should
report and return an error.  I also added an extra "goto" to make the flow
of control more clear, and to reduce the chance that a future change in
this logic will break it.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/mount/nfsumount.c

index 4311473..e7f37ef 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) {