Whamcloud - gitweb
LU-13227 ofd: update lvb before dropping server lock
[fs/lustre-release.git] / lustre / ofd / ofd_fs.c
index 0a1c87f..7fbce7b 100644 (file)
@@ -310,11 +310,10 @@ static void ofd_fld_fini(const struct lu_env *env, struct ofd_device *ofd)
  */
 void ofd_seqs_free(const struct lu_env *env, struct ofd_device *ofd)
 {
-       struct ofd_seq          *oseq;
-       struct ofd_seq          *tmp;
-       struct list_head         dispose;
+       struct ofd_seq *oseq;
+       struct ofd_seq *tmp;
+       LIST_HEAD(dispose);
 
-       INIT_LIST_HEAD(&dispose);
        write_lock(&ofd->ofd_seq_list_lock);
        list_for_each_entry_safe(oseq, tmp, &ofd->ofd_seq_list, os_list)
                list_move(&oseq->os_list, &dispose);
@@ -407,8 +406,10 @@ 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);
+       atomic_set(&oseq->os_precreate_in_progress, 0);
 
        rc = dt_attr_get(env, dob, &info->fti_attr);
        if (rc)
@@ -416,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;