From bc5c9a284ec74d1b4f9fe01138c3d46ba9f2fcb1 Mon Sep 17 00:00:00 2001
From: rread <rread>
Date: Tue, 10 Feb 2004 08:59:13 +0000
Subject: [PATCH] Fix a merge error in conf-sanity.sh.  Using CMDVERBOSE this
 way was passing "> /dev/null" as an extra argument to the functions, and this
 is not really what we want.  Since I don't think it's all that bad to see the
 output of lconf, anyway, I just deleted the >/dev/null entirely.

While looking into this, I also noticed that mount -f was still
attempting to fetch the log from the MDS. That is fixed, too.
---
 lustre/llite/llite_lib.c    | 15 ++++++++++++++-
 lustre/tests/conf-sanity.sh | 28 ++++++++++------------------
 2 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index f0c778ce8e..2e9dfa40a2 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -650,11 +650,17 @@ static void lustre_manual_cleanup(struct ll_sb_info *sbi)
 
 void lustre_put_super(struct super_block *sb)
 {
+        struct obd_device *obd;
         struct ll_sb_info *sbi = ll_s2sbi(sb);
+        int force_umount;
         ENTRY;
 
         CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
-
+        obd = class_exp2obd(sbi->ll_mdc_exp);
+        if (obd)
+                force_umount = obd->obd_no_recov;
+        obd = NULL;
+        
         lustre_common_put_super(sb);
 
         if (sbi->ll_lmd != NULL) {
@@ -663,6 +669,12 @@ void lustre_put_super(struct super_block *sb)
                 int err;
                 struct config_llog_instance cfg;
 
+                if (force_umount) {
+                        CERROR("force umount, doing manual cleanup\n");
+                        lustre_manual_cleanup(sbi);
+                        GOTO(free_lmd, 0);
+                }
+
                 cfg.cfg_instance = sbi->ll_instance;
                 cfg.cfg_uuid = sbi->ll_sb_uuid;
 
@@ -677,6 +689,7 @@ void lustre_put_super(struct super_block *sb)
                 }
 
                 OBD_FREE(cln_prof, len);
+        free_lmd:
                 OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
                 OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance) + 1);
         }
diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh
index e253076754..34ba23159a 100644
--- a/lustre/tests/conf-sanity.sh
+++ b/lustre/tests/conf-sanity.sh
@@ -21,14 +21,6 @@ init_test_env $@
 
 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
 
-FORCE=${FORCE:-" --force"}
-
-if [ "$VERBOSE" == "true" ]; then
-	CMDVERBOSE=""
-else
-	CMDVERBOSE=" > /dev/null"
-fi
-
 gen_config() {
 	rm -f $XMLCONFIG
 
@@ -51,33 +43,33 @@ gen_second_config() {
 
 start_mds() {
 	echo "start mds service on `facet_active_host mds`"
-	start mds --reformat $MDSLCONFARGS $CMDVERBOSE || return 94
+	start mds --reformat $MDSLCONFARGS  || return 94
 }
 stop_mds() {
 	echo "stop mds service on `facet_active_host mds`"
-	stop mds $@ $CMDVERBOSE || return 97 
+	stop mds $@  || return 97 
 }
 
 start_ost() {
 	echo "start ost service on `facet_active_host ost`"
-	start ost --reformat $OSTLCONFARGS $CMDVERBOSE || return 95
+	start ost --reformat $OSTLCONFARGS  || return 95
 }
 
 stop_ost() {
 	echo "stop ost service on `facet_active_host ost`"
-	stop ost $@ $CMDVERBOSE || return 98 
+	stop ost $@  || return 98 
 }
 
 mount_client() {
 	local MOUNTPATH=$1
 	echo "mount lustre on ${MOUNTPATH}....."
-	zconf_mount `hostname`  $MOUNTPATH $CMDVERBOSE || return 96
+	zconf_mount `hostname`  $MOUNTPATH  || return 96
 }
 
 umount_client() {
 	local MOUNTPATH=$1
 	echo "umount lustre on ${MOUNTPATH}....."
-	zconf_umount `hostname`  $MOUNTPATH $CMDVERBOSE || return 97
+	zconf_umount `hostname`  $MOUNTPATH || return 97
 }
 
 manual_umount_client(){
@@ -136,7 +128,7 @@ run_test 0 "single mount setup"
 test_1() {
 	start_ost
 	echo "start ost second time..."
-	start ost --reformat $OSTLCONFARGS $CMDVERBOSE 
+	start ost --reformat $OSTLCONFARGS 
 	start_mds	
 	mount_client $MOUNT
 	check_mount || return 42
@@ -148,7 +140,7 @@ test_2() {
 	start_ost
 	start_mds	
 	echo "start mds second time.."
-	start mds --reformat $MDSLCONFARGS $CMDVERBOSE 
+	start mds --reformat $MDSLCONFARGS 
 	
 	mount_client $MOUNT  
 	check_mount || return 43
@@ -170,7 +162,7 @@ run_test 3 "mount client twice"
 test_4() {
 	setup
 	touch $DIR/$tfile || return 85
-	stop_ost ${FORCE}
+	stop_ost --force
 	cleanup 
 	eno=$?
 	# ok for ost to fail shutdown
@@ -184,7 +176,7 @@ run_test 4 "force cleanup ost, then cleanup"
 test_5() {
 	setup
 	touch $DIR/$tfile || return 1
-	stop_mds ${FORCE} || return 2
+	stop_mds --force || return 2
 
 	# cleanup may return an error from the failed 
 	# disconnects; for now I'll consider this successful 
-- 
GitLab