From 4533e339c1a329be3d4a4c375dbebb63e302c825 Mon Sep 17 00:00:00 2001
From: shadow <shadow>
Date: Tue, 31 Jul 2007 13:05:25 +0000
Subject: [PATCH] Mark OST as as early accessible if his start SYNC.

b=13148
i=green
i=adilger
---
 lustre/ChangeLog        |  7 +++++++
 lustre/osc/osc_create.c | 10 +++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 1dd0526606..09397fe8a2 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -654,6 +654,13 @@ Details    : If a OST has no remain object, system will block on the creating
 	     pre-created objects when available, instead of blocking on an
 	     empty osc while others are not empty.  If we must block, we block
 	     for the shortest possible period of time.
+
+Severity   : normal
+Bugzilla   : 13148
+Frequency  : only in recovery
+Description: Mark OST as as early accessible if his start SYNC.
+Details    : osc_precreate return flag early accessible if oscc marked as 
+             OSCC_FLAG_SYNC_IN_PROGRESS.
 	     
 --------------------------------------------------------------------------------
 
diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c
index e8fc4a9349..f2c842d2ce 100644
--- a/lustre/osc/osc_create.c
+++ b/lustre/osc/osc_create.c
@@ -256,9 +256,17 @@ int osc_precreate(struct obd_export *exp, int need_create)
                 RETURN(2);
 
         if (oscc->oscc_last_id < oscc->oscc_next_id) {
+                spin_lock(&oscc->oscc_lock);
+                if (oscc->oscc_flags & OSCC_FLAG_SYNC_IN_PROGRESS) {
+                        spin_unlock(&oscc->oscc_lock);
+                        RETURN(1);
+                }
                 if (oscc->oscc_flags & OSCC_FLAG_NOSPC ||
-                    oscc_recovering(oscc))
+                    oscc->oscc_flags & OSCC_FLAG_RECOVERING) {
+                        spin_unlock(&oscc->oscc_lock);
                         RETURN(2);
+                }
+                spin_unlock(&oscc->oscc_lock);
 
                 if (oscc->oscc_flags & OSCC_FLAG_CREATING)
                         RETURN(1);
-- 
GitLab