}
 
 static int lov_init_sub(const struct lu_env *env, struct lov_object *lov,
-                       struct cl_object *stripe,
-                       struct lov_layout_raid0 *r0, int idx)
+                       struct cl_object *stripe, struct lov_layout_raid0 *r0,
+                       int idx)
 {
        struct cl_object_header *hdr;
        struct cl_object_header *subhdr;
 
        hdr    = cl_object_header(lov2cl(lov));
        subhdr = cl_object_header(stripe);
-       parent = subhdr->coh_parent;
 
        oinfo = lov->lo_lsm->lsm_oinfo[idx];
        CDEBUG(D_INODE, DFID"@%p[%d] -> "DFID"@%p: ostid: "DOSTID
               PFID(&hdr->coh_lu.loh_fid), hdr, POSTID(&oinfo->loi_oi),
               oinfo->loi_ost_idx, oinfo->loi_ost_gen);
 
+       /* reuse ->coh_attr_guard to protect coh_parent change */
+       spin_lock(&subhdr->coh_attr_guard);
+       parent = subhdr->coh_parent;
        if (parent == NULL) {
                subhdr->coh_parent = hdr;
+               spin_unlock(&subhdr->coh_attr_guard);
                subhdr->coh_nesting = hdr->coh_nesting + 1;
                lu_object_ref_add(&stripe->co_lu, "lov-parent", lov);
                r0->lo_sub[idx] = cl2lovsub(stripe);
                struct lov_object *old_lov;
                unsigned int mask = D_INODE;
 
+               spin_unlock(&subhdr->coh_attr_guard);
                old_obj = lu_object_locate(&parent->coh_lu, &lov_device_type);
                LASSERT(old_obj != NULL);
                old_lov = cl2lov(lu2cl(old_obj));
 
        struct lovsub_device *lsd  = lu2lovsub_dev(d);
        struct lu_device     *next = cl2lu_dev(lsd->acid_next);
 
+       if (atomic_read(&d->ld_ref) && d->ld_site) {
+               LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL);
+               lu_site_print(env, d->ld_site, &msgdata, lu_cdebug_printer);
+       }
        cl_device_fini(lu2cl_dev(d));
        OBD_FREE_PTR(lsd);
        return next;