From 6dbe4d07ef6fe52480532eeb7ea24d1588ae216d Mon Sep 17 00:00:00 2001
From: zhanghc <zhanghc>
Date: Tue, 9 Dec 2008 10:15:37 +0000
Subject: [PATCH] b=17495

in osc_precreated, check OSCC_FLAG_NOSPC before
checking last_id/next_id, remove unnecessary
spin_lock on oscc_lock at the same time.

i=Andreas
i=Nathan.Rutman
---
 lustre/osc/osc_create.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c
index 39cea5ae27..e432aa479b 100644
--- a/lustre/osc/osc_create.c
+++ b/lustre/osc/osc_create.c
@@ -286,16 +286,14 @@ int osc_precreate(struct obd_export *exp)
         if (oscc_recovering(oscc))
                 RETURN(2);
 
+        if (oscc->oscc_flags & OSCC_FLAG_NOSPC)
+                RETURN(1000);
+
         if (oscc->oscc_last_id < oscc->oscc_next_id) {
-                spin_lock(&oscc->oscc_lock);
-                if (oscc->oscc_flags & OSCC_FLAG_NOSPC) {
-                        spin_unlock(&oscc->oscc_lock);
-                        RETURN(1000);
-                }
-                if (oscc->oscc_flags & OSCC_FLAG_SYNC_IN_PROGRESS) {
-                        spin_unlock(&oscc->oscc_lock);
+                if (oscc->oscc_flags & OSCC_FLAG_SYNC_IN_PROGRESS)
                         RETURN(1);
-                }
+
+                spin_lock(&oscc->oscc_lock);
                 if (oscc->oscc_flags & OSCC_FLAG_CREATING) {
                         spin_unlock(&oscc->oscc_lock);
                         RETURN(1);
-- 
GitLab