Whamcloud - gitweb
LU-5266 ldlm: granting the same lock twice on recovery
[fs/lustre-release.git] / lustre / fld / fld_handler.c
index e40b61a..eae79ea 100644 (file)
@@ -180,7 +180,10 @@ int fld_update_from_controller(const struct lu_env *env,
                        if (lsra->lsra_lsr[i].lsr_index != index)
                                GOTO(out, rc = -EINVAL);
 
+                       mutex_lock(&fld->lsf_lock);
                        rc1 = fld_insert_entry(env, fld, &lsra->lsra_lsr[i]);
+                       mutex_unlock(&fld->lsf_lock);
+
                        if (rc1 != 0)
                                GOTO(out, rc = rc1);
                }
@@ -250,15 +253,13 @@ int fld_server_lookup(const struct lu_env *env, struct lu_server_fld *fld,
        rc = fld_name_to_index(fld->lsf_name, &index);
        if (rc < 0)
                RETURN(rc);
-       else
-               rc = 0;
 
-       if (index == 0) {
+       if (index == 0 && rc == LDD_F_SV_TYPE_MDT) {
                /* On server side, all entries should be in cache.
                 * If we can not find it in cache, just return error */
                CERROR("%s: Cannot find sequence "LPX64": rc = %d\n",
-                      fld->lsf_name, seq, -EIO);
-               RETURN(-EIO);
+                      fld->lsf_name, seq, -ENOENT);
+               RETURN(-ENOENT);
        } else {
                if (fld->lsf_control_exp == NULL) {
                        CERROR("%s: lookup "LPX64", but not connects to MDT0"
@@ -465,7 +466,7 @@ int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld,
                RETURN(rc);
        }
 
-       rc = fld_index_init(env, fld, dt);
+       rc = fld_index_init(env, fld, dt, type);
        if (rc)
                GOTO(out_cache, rc);