diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c
index 39cea5ae27979bf729acf5150c4b3005712086e0..e432aa479b9f6592c39e59c0a4e3a9c05615ca2a 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);