Whamcloud - gitweb
LU-11765 ofd: return EAGAIN during 1st CLEANUP_ORPHAN
[fs/lustre-release.git] / lustre / ofd / ofd_fs.c
index 25e59c2..f8c3e2d 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -181,8 +181,12 @@ u64 ofd_seq_last_oid(struct ofd_seq *oseq)
 void ofd_seq_last_oid_set(struct ofd_seq *oseq, u64 id)
 {
        spin_lock(&oseq->os_last_oid_lock);
-       if (likely(ostid_id(&oseq->os_oi) < id))
-               ostid_set_id(&oseq->os_oi, id);
+       if (likely(ostid_id(&oseq->os_oi) < id)) {
+               if (ostid_set_id(&oseq->os_oi, id)) {
+                       CERROR("Bad %llu to set " DOSTID "\n",
+                              (unsigned long long)id, POSTID(&oseq->os_oi));
+               }
+       }
        spin_unlock(&oseq->os_last_oid_lock);
 }
 
@@ -403,6 +407,7 @@ struct ofd_seq *ofd_seq_load(const struct lu_env *env, struct ofd_device *ofd,
        mutex_init(&oseq->os_create_lock);
        spin_lock_init(&oseq->os_last_oid_lock);
        ostid_set_seq(&oseq->os_oi, seq);
+       oseq->os_last_id_synced = 0;
 
        atomic_set(&oseq->os_refc, 1);
 
@@ -412,7 +417,10 @@ struct ofd_seq *ofd_seq_load(const struct lu_env *env, struct ofd_device *ofd,
 
        if (info->fti_attr.la_size == 0) {
                /* object is just created, initialize last id */
-               ofd_seq_last_oid_set(oseq, OFD_INIT_OBJID);
+               if (OBD_FAIL_CHECK(OBD_FAIL_OFD_SET_OID))
+                       ofd_seq_last_oid_set(oseq, 0xffffff00);
+               else
+                       ofd_seq_last_oid_set(oseq, OFD_INIT_OBJID);
                ofd_seq_last_oid_write(env, ofd, oseq);
        } else if (info->fti_attr.la_size == sizeof(lastid)) {
                info->fti_off = 0;