From e227ac0348431eecc1ddadf5d1907c8348741519 Mon Sep 17 00:00:00 2001
From: Chuck Lever <chuck.lever@oracle.com>
Date: Mon, 24 Sep 2007 11:29:31 -0400
Subject: [PATCH] umount.nfs: umount doesn't recognize a busy file system

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 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c
index 4311473..e7f37ef 100644
--- a/utils/mount/nfsumount.c
+++ b/utils/mount/nfsumount.c
@@ -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) {
-- 
2.39.5