Whamcloud - gitweb
LU-17705 ptlrpc: replace synchronize_rcu() with rcu_barrier()
[fs/lustre-release.git] / lustre / ofd / ofd_lvb.c
index 8c6dfbe..f220ded 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * lustre/ofd/ofd_lvb.c
  *
@@ -67,6 +66,20 @@ static int ofd_lvbo_free(struct ldlm_resource *res)
        return 0;
 }
 
+static bool ofd_resync_allowed(struct ofd_device *ofd)
+{
+       struct obd_device *obd = ofd_obd(ofd);
+
+       if (obd->obd_recovery_start == 0)
+               return false;
+
+       if (obd->obd_recovery_start + obd->obd_recovery_time_hard <
+           ktime_get_seconds())
+               return false;
+
+       return true;
+}
+
 /**
  * Implementation of ldlm_valblock_ops::lvbo_init for OFD.
  *
@@ -101,7 +114,7 @@ static int ofd_lvbo_init(struct ldlm_resource *res)
        ofd = ldlm_res_to_ns(res)->ns_lvbp;
        LASSERT(ofd != NULL);
 
-       if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_OST_LVB))
+       if (CFS_FAIL_CHECK(OBD_FAIL_LDLM_OST_LVB))
                RETURN(-ENOMEM);
 
        env = lu_env_find();
@@ -133,8 +146,9 @@ static int ofd_lvbo_init(struct ldlm_resource *res)
                        oseq = ofd_seq_load(env, ofd, fid_seq_is_idif(seq) ?
                                            FID_SEQ_OST_MDT0 : seq);
                        if (!IS_ERR_OR_NULL(oseq)) {
-                               if (!oseq->os_last_id_synced)
-                                       rc = -EAGAIN;
+                               if (!oseq->os_last_id_synced &&
+                                   ofd_resync_allowed(ofd))
+                                       rc = -EINPROGRESS;
                                ofd_seq_put(env, oseq);
                        }
                }
@@ -147,10 +161,13 @@ static int ofd_lvbo_init(struct ldlm_resource *res)
        lvb->lvb_atime = info->fti_attr.la_atime;
        lvb->lvb_ctime = info->fti_attr.la_ctime;
 
-       CDEBUG(D_DLMTRACE, "res: "DFID" initial lvb size: %llu, "
-              "mtime: %#llx, blocks: %#llx\n",
-              PFID(&info->fti_fid), lvb->lvb_size,
-              lvb->lvb_mtime, lvb->lvb_blocks);
+       if (fo->ofo_atime_ondisk == 0)
+               fo->ofo_atime_ondisk = info->fti_attr.la_atime;
+
+       CDEBUG(D_DLMTRACE,
+              "res: "DFID" initial LVB size: %llu, mtime: %#llx, atime: %#llx, ctime: %#llx, blocks: %#llx\n",
+              PFID(&info->fti_fid), lvb->lvb_size, lvb->lvb_mtime,
+              lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks);
 
        info->fti_attr.la_valid = 0;