From 6ba71587ac2ca5e9800ae5a6244d490b93227bc8 Mon Sep 17 00:00:00 2001
From: huanghua <huanghua>
Date: Wed, 3 Dec 2008 02:23:23 +0000
Subject: [PATCH] Branch HEAD b=17589 i=yong.fan i=yury.umanets

wait a bit while umount client if there is still ref count on mnt.
---
 lustre/llite/llite_lib.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index a2a6c3e31a..2ed0051d59 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -1958,9 +1958,16 @@ void ll_umount_begin(struct super_block *sb)
 
         /* Really, we'd like to wait until there are no requests outstanding,
          * and then continue.  For now, we just invalidate the requests,
-         * schedule, and hope.
+         * sleep 1 second, and hope it is OK.
          */
-        schedule();
+        if (atomic_read(&vfsmnt->mnt_count) > 2) {
+                cfs_schedule_timeout(CFS_TASK_INTERRUPTIBLE,
+                                     cfs_time_seconds(1));
+                if (atomic_read(&vfsmnt->mnt_count) > 2)
+                        LCONSOLE_WARN("Mount still busy with %d refs! You "
+                                      "may try to umount it a bit later\n",
+                                      atomic_read(&vfsmnt->mnt_count));
+        }
 
         EXIT;
 }
-- 
GitLab