From 1c6a9dc0a42929b30853b04e850268def6d8e0cf Mon Sep 17 00:00:00 2001
From: huanghua <huanghua>
Date: Sat, 6 Dec 2008 00:53:11 +0000
Subject: [PATCH] Branch HEAD b=17589 i=tappro i=yury.umanets i=adilger

wait a bit before client umount if vfsmnt still has references.
---
 lustre/llite/llite_lib.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index 3c0c61b1c4..6b99d14167 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -1958,9 +1958,19 @@ 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.
+         * schedule() and sleep one second if needed, and hope.
          */
         schedule();
+#ifdef HAVE_UMOUNTBEGIN_VFSMOUNT
+        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));
+        }
+#endif
 
         EXIT;
 }
-- 
GitLab