Whamcloud - gitweb
LU-7055 osd: move dput() out of osd_ost_fini()'s rwlock
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_compat.c
index a4323d0..cec04db 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -62,19 +62,14 @@ static void osd_push_ctxt(const struct osd_device *dev,
                           struct lvfs_run_ctxt *newctxt,
                           struct lvfs_run_ctxt *save)
 {
-        OBD_SET_CTXT_MAGIC(newctxt);
-        newctxt->pwdmnt = dev->od_mnt;
-        newctxt->pwd = dev->od_mnt->mnt_root;
-        newctxt->fs = get_ds();
-
-        push_ctxt(save, newctxt, NULL);
-}
-
-static void osd_pop_ctxt(const struct osd_device *dev,
-                        struct lvfs_run_ctxt *new,
-                        struct lvfs_run_ctxt *save)
-{
-       pop_ctxt(save, new, NULL);
+       OBD_SET_CTXT_MAGIC(newctxt);
+       newctxt->pwdmnt = dev->od_mnt;
+       newctxt->pwd = dev->od_mnt->mnt_root;
+       newctxt->fs = get_ds();
+       newctxt->umask = current_umask();
+       newctxt->dt = NULL;
+
+       push_ctxt(save, newctxt);
 }
 
 /* utility to make a directory */
@@ -125,7 +120,7 @@ out_up:
        return dchild;
 }
 
-int osd_last_rcvd_subdir_count(struct osd_device *osd)
+static int osd_last_rcvd_subdir_count(struct osd_device *osd)
 {
         struct lr_server_data lsd;
         struct dentry        *dlast;
@@ -190,7 +185,6 @@ static int osd_mdt_init(const struct lu_env *env, struct osd_device *dev)
        if (IS_ERR(d))
                GOTO(cleanup, rc = PTR_ERR(d));
 
-       ldiskfs_set_inode_state(d->d_inode, LDISKFS_STATE_LUSTRE_NO_OI);
        omm->omm_remote_parent = d;
 
        /* Set LMA for remote parent inode */
@@ -200,7 +194,7 @@ static int osd_mdt_init(const struct lu_env *env, struct osd_device *dev)
        GOTO(cleanup, rc);
 
 cleanup:
-       pop_ctxt(&save, &new, NULL);
+       pop_ctxt(&save, &new);
        if (rc) {
                if (omm->omm_remote_parent != NULL)
                        dput(omm->omm_remote_parent);
@@ -231,6 +225,7 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd,
        struct osd_thread_info  *oti = osd_oti_get(env);
        struct lustre_mdt_attrs *lma = &oti->oti_mdt_attrs;
        char                    *name = oti->oti_name;
+       struct osd_thread_info  *info = osd_oti_get(env);
        struct dentry           *dentry;
        struct dentry           *parent;
        int                     rc;
@@ -253,8 +248,8 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd,
        dentry = osd_child_dentry_by_inode(env, parent->d_inode,
                                           name, strlen(name));
        mutex_lock(&parent->d_inode->i_mutex);
-       rc = osd_ldiskfs_add_entry(oh->ot_handle, dentry, obj->oo_inode,
-                                  NULL);
+       rc = osd_ldiskfs_add_entry(info, oh->ot_handle, dentry,
+                                  obj->oo_inode, NULL);
        CDEBUG(D_INODE, "%s: add %s:%lu to remote parent %lu.\n", osd_name(osd),
               name, obj->oo_inode->i_ino, parent->d_inode->i_ino);
        ldiskfs_inc_count(oh->ot_handle, parent->d_inode);
@@ -375,23 +370,21 @@ static int osd_ost_init(const struct lu_env *env, struct osd_device *dev)
 
        /* to get subdir count from last_rcvd */
        rc = osd_last_rcvd_subdir_count(dev);
-       if (rc < 0) {
-               OBD_FREE_PTR(dev->od_ost_map);
-               RETURN(rc);
-       }
+       if (rc < 0)
+               GOTO(cleanup_alloc, rc);
 
        dev->od_ost_map->om_subdir_count = rc;
         rc = 0;
 
-       CFS_INIT_LIST_HEAD(&dev->od_ost_map->om_seq_list);
+       INIT_LIST_HEAD(&dev->od_ost_map->om_seq_list);
        rwlock_init(&dev->od_ost_map->om_seq_list_lock);
-       sema_init(&dev->od_ost_map->om_dir_init_sem, 1);
+       mutex_init(&dev->od_ost_map->om_dir_init_mutex);
 
         osd_push_ctxt(dev, &new, &save);
 
        d = ll_lookup_one_len("O", rootd, strlen("O"));
        if (IS_ERR(d))
-               GOTO(cleanup, rc = PTR_ERR(d));
+               GOTO(cleanup_ctxt, rc = PTR_ERR(d));
        if (d->d_inode == NULL) {
                dput(d);
                /* The lookup() may be called again inside simple_mkdir().
@@ -399,40 +392,39 @@ static int osd_ost_init(const struct lu_env *env, struct osd_device *dev)
                 * mount time, it will not affect the whole performance. */
                d = simple_mkdir(rootd, dev->od_mnt, "O", 0755, 1);
                if (IS_ERR(d))
-                       GOTO(cleanup, rc = PTR_ERR(d));
+                       GOTO(cleanup_ctxt, rc = PTR_ERR(d));
 
                /* It is quite probably that the device is new formatted. */
                dev->od_maybe_new = 1;
        }
 
        inode = d->d_inode;
-       ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
        dev->od_ost_map->om_root = d;
 
        /* 'What the @fid is' is not imporatant, because the object
         * has no OI mapping, and only is visible inside the OSD.*/
        lu_igif_build(fid, inode->i_ino, inode->i_generation);
        rc = osd_ea_fid_set(info, inode, fid,
-                           LMAC_NOT_IN_OI | LMAC_FID_ON_OST, 0);
+                   LMAC_NOT_IN_OI | LMAC_FID_ON_OST, 0);
+       if (rc)
+               GOTO(cleanup_dentry, rc);
 
-       GOTO(cleanup, rc);
+       pop_ctxt(&save, &new);
+       RETURN(0);
 
-cleanup:
-       osd_pop_ctxt(dev, &new, &save);
-        if (IS_ERR(d)) {
-                OBD_FREE_PTR(dev->od_ost_map);
-                RETURN(PTR_ERR(d));
-        }
+cleanup_dentry:
+       dput(d);
+cleanup_ctxt:
+       pop_ctxt(&save, &new);
+cleanup_alloc:
+       OBD_FREE_PTR(dev->od_ost_map);
        return rc;
 }
 
-static void osd_seq_free(struct osd_obj_map *map,
-                        struct osd_obj_seq *osd_seq)
+static void osd_seq_free(struct osd_obj_seq *osd_seq)
 {
        int j;
 
-       cfs_list_del_init(&osd_seq->oos_seq_list);
-
        if (osd_seq->oos_dirs) {
                for (j = 0; j < osd_seq->oos_subdir_count; j++) {
                        if (osd_seq->oos_dirs[j])
@@ -459,10 +451,12 @@ static void osd_ost_fini(struct osd_device *osd)
                return;
 
        write_lock(&map->om_seq_list_lock);
-       cfs_list_for_each_entry_safe(osd_seq, tmp,
-                                    &map->om_seq_list,
-                                    oos_seq_list) {
-               osd_seq_free(map, osd_seq);
+       list_for_each_entry_safe(osd_seq, tmp, &map->om_seq_list,
+                                oos_seq_list) {
+               list_del_init(&osd_seq->oos_seq_list);
+               write_unlock(&map->om_seq_list_lock);
+               osd_seq_free(osd_seq);
+               write_lock(&map->om_seq_list_lock);
        }
        write_unlock(&map->om_seq_list_lock);
        if (map->om_root)
@@ -484,22 +478,24 @@ int osd_obj_map_init(const struct lu_env *env, struct osd_device *dev)
 
        /* prepare structures for MDS */
        rc = osd_mdt_init(env, dev);
+       if (rc)
+               osd_ost_fini(dev);
 
         RETURN(rc);
 }
 
-struct osd_obj_seq *osd_seq_find_locked(struct osd_obj_map *map, obd_seq seq)
+static struct osd_obj_seq *osd_seq_find_locked(struct osd_obj_map *map, u64 seq)
 {
        struct osd_obj_seq *osd_seq;
 
-       cfs_list_for_each_entry(osd_seq, &map->om_seq_list, oos_seq_list) {
+       list_for_each_entry(osd_seq, &map->om_seq_list, oos_seq_list) {
                if (osd_seq->oos_seq == seq)
                        return osd_seq;
        }
        return NULL;
 }
 
-struct osd_obj_seq *osd_seq_find(struct osd_obj_map *map, obd_seq seq)
+static struct osd_obj_seq *osd_seq_find(struct osd_obj_map *map, u64 seq)
 {
        struct osd_obj_seq *osd_seq;
 
@@ -527,10 +523,9 @@ static int osd_obj_update_entry(struct osd_thread_info *info,
                                struct dentry *dir, const char *name,
                                const struct lu_fid *fid,
                                const struct osd_inode_id *id,
-                               struct thandle *th)
+                               handle_t *th)
 {
        struct inode               *parent = dir->d_inode;
-       struct osd_thandle         *oh;
        struct dentry              *child;
        struct ldiskfs_dir_entry_2 *de;
        struct buffer_head         *bh;
@@ -542,9 +537,8 @@ static int osd_obj_update_entry(struct osd_thread_info *info,
        int                         rc;
        ENTRY;
 
-       oh = container_of(th, struct osd_thandle, ot_super);
-       LASSERT(oh->ot_handle != NULL);
-       LASSERT(oh->ot_handle->h_transaction != NULL);
+       LASSERT(th != NULL);
+       LASSERT(th->h_transaction != NULL);
 
        child = &info->oti_child_dentry;
        child->d_parent = dir;
@@ -570,25 +564,29 @@ static int osd_obj_update_entry(struct osd_thread_info *info,
                GOTO(out, rc);
        }
 
+       /* The EA inode should NOT be in OI, old OI scrub may added
+        * such OI mapping by wrong, replace it. */
+       if (unlikely(osd_is_ea_inode(inode))) {
+               iput(inode);
+               goto update;
+       }
+
        rc = osd_get_lma(info, inode, dentry, lma);
        if (rc == -ENODATA) {
                rc = osd_get_idif(info, inode, dentry, oi_fid);
-               if (rc > 0) {
+               if (rc > 0 || rc == -ENODATA) {
                        oi_fid = NULL;
                        rc = 0;
                }
        }
        iput(inode);
 
-       /* If the OST-object has neither FID-in-LMA nor FID-in-ff, it is
-        * either a crashed object or a uninitialized one. Replace it. */
-       if (rc == -ENODATA || oi_fid == NULL)
-               goto update;
-
        if (rc != 0)
                GOTO(out, rc);
 
-       if (lu_fid_eq(fid, oi_fid)) {
+       /* If the OST-object has neither FID-in-LMA nor FID-in-ff, it is
+        * either a crashed object or a uninitialized one. Replace it. */
+       if (oi_fid != NULL && lu_fid_eq(fid, oi_fid)) {
                CERROR("%s: the FID "DFID" is used by two objects: "
                       "%u/%u %u/%u\n", osd_name(osd), PFID(fid),
                       oi_id->oii_ino, oi_id->oii_gen,
@@ -596,6 +594,45 @@ static int osd_obj_update_entry(struct osd_thread_info *info,
                GOTO(out, rc = -EEXIST);
        }
 
+       if (fid_is_idif(fid) && oi_fid != NULL && fid_is_idif(oi_fid)) {
+               __u32 idx1 = fid_idif_ost_idx(fid);
+               __u32 idx2 = fid_idif_ost_idx(oi_fid);
+               struct ost_id *ostid = &info->oti_ostid;
+               struct lu_fid *tfid = &info->oti_fid3;
+
+               LASSERTF(idx1 == 0 || idx1 == osd->od_index,
+                        "invalid given FID "DFID", not match the "
+                        "device index %u\n", PFID(fid), osd->od_index);
+
+               if (idx1 != idx2) {
+                       if (idx1 == 0 && idx2 == osd->od_index) {
+                               fid_to_ostid(fid, ostid);
+                               ostid_to_fid(tfid, ostid, idx2);
+                               if (lu_fid_eq(tfid, oi_fid)) {
+                                       CERROR("%s: the FID "DFID" is used by "
+                                              "two objects(2): %u/%u %u/%u\n",
+                                              osd_name(osd), PFID(fid),
+                                              oi_id->oii_ino, oi_id->oii_gen,
+                                              id->oii_ino, id->oii_gen);
+
+                                       GOTO(out, rc = -EEXIST);
+                               }
+                       } else if (idx2 == 0 && idx1 == osd->od_index) {
+                               fid_to_ostid(oi_fid, ostid);
+                               ostid_to_fid(tfid, ostid, idx1);
+                               if (lu_fid_eq(tfid, fid)) {
+                                       CERROR("%s: the FID "DFID" is used by "
+                                              "two objects(2): %u/%u %u/%u\n",
+                                              osd_name(osd), PFID(fid),
+                                              oi_id->oii_ino, oi_id->oii_gen,
+                                              id->oii_ino, id->oii_gen);
+
+                                       GOTO(out, rc = -EEXIST);
+                               }
+                       }
+               }
+       }
+
 update:
        /* There may be temporary inconsistency: On one hand, the new
         * object may be referenced by multiple entries, which is out
@@ -605,12 +642,12 @@ update:
         * is still valid. Since it was referenced by an invalid entry,
         * making it as invisible temporary may be not worse. OI scrub
         * will process it later. */
-       rc = ldiskfs_journal_get_write_access(oh->ot_handle, bh);
+       rc = ldiskfs_journal_get_write_access(th, bh);
        if (rc != 0)
                GOTO(out, rc);
 
        de->inode = cpu_to_le32(id->oii_ino);
-       rc = ldiskfs_journal_dirty_metadata(oh->ot_handle, bh);
+       rc = ldiskfs_handle_dirty_metadata(th, NULL, bh);
 
        GOTO(out, rc);
 
@@ -623,19 +660,17 @@ out:
 static int osd_obj_del_entry(struct osd_thread_info *info,
                             struct osd_device *osd,
                             struct dentry *dird, char *name,
-                            struct thandle *th)
+                            handle_t *th)
 {
        struct ldiskfs_dir_entry_2 *de;
        struct buffer_head         *bh;
-       struct osd_thandle         *oh;
        struct dentry              *child;
        struct inode               *dir = dird->d_inode;
        int                         rc;
        ENTRY;
 
-       oh = container_of(th, struct osd_thandle, ot_super);
-       LASSERT(oh->ot_handle != NULL);
-       LASSERT(oh->ot_handle->h_transaction != NULL);
+       LASSERT(th != NULL);
+       LASSERT(th->h_transaction != NULL);
 
 
        child = &info->oti_child_dentry;
@@ -650,7 +685,7 @@ static int osd_obj_del_entry(struct osd_thread_info *info,
        rc = -ENOENT;
        bh = osd_ldiskfs_find_entry(dir, &child->d_name, &de, NULL, NULL);
        if (bh) {
-               rc = ldiskfs_delete_entry(oh->ot_handle, dir, de, bh);
+               rc = ldiskfs_delete_entry(th, dir, de, bh);
                brelse(bh);
        }
        mutex_unlock(&dir->i_mutex);
@@ -658,13 +693,12 @@ static int osd_obj_del_entry(struct osd_thread_info *info,
        RETURN(rc);
 }
 
-int osd_obj_add_entry(struct osd_thread_info *info,
-                     struct osd_device *osd,
-                     struct dentry *dir, char *name,
-                     const struct osd_inode_id *id,
-                     struct thandle *th)
+static int osd_obj_add_entry(struct osd_thread_info *info,
+                            struct osd_device *osd,
+                            struct dentry *dir, char *name,
+                            const struct osd_inode_id *id,
+                            handle_t *th)
 {
-       struct osd_thandle *oh;
        struct dentry *child;
        struct inode *inode;
        int rc;
@@ -674,11 +708,18 @@ int osd_obj_add_entry(struct osd_thread_info *info,
        if (OBD_FAIL_CHECK(OBD_FAIL_OSD_COMPAT_NO_ENTRY))
                RETURN(0);
 
-       oh = container_of(th, struct osd_thandle, ot_super);
-       LASSERT(oh->ot_handle != NULL);
-       LASSERT(oh->ot_handle->h_transaction != NULL);
+       LASSERT(th != NULL);
+       LASSERT(th->h_transaction != NULL);
+
+       inode = info->oti_inode;
+       if (unlikely(inode == NULL)) {
+               struct ldiskfs_inode_info *lii;
+               OBD_ALLOC_PTR(lii);
+               if (lii == NULL)
+                       RETURN(-ENOMEM);
+               inode = info->oti_inode = &lii->vfs_inode;
+       }
 
-       inode = &info->oti_inode;
        inode->i_sb = osd_sb(osd);
        osd_id_to_inode(inode, id);
        inode->i_mode = S_IFREG; /* for type in ldiskfs dir entry */
@@ -695,7 +736,7 @@ int osd_obj_add_entry(struct osd_thread_info *info,
 
        ll_vfs_dq_init(dir->d_inode);
        mutex_lock(&dir->d_inode->i_mutex);
-       rc = osd_ldiskfs_add_entry(oh->ot_handle, child, inode, NULL);
+       rc = osd_ldiskfs_add_entry(info, th, child, inode, NULL);
        mutex_unlock(&dir->d_inode->i_mutex);
 
        RETURN(rc);
@@ -708,7 +749,7 @@ int osd_obj_add_entry(struct osd_thread_info *info,
  * debug messages to objects in the future, and the legacy space
  * of FID_SEQ_OST_MDT0 will be unused in the future.
  **/
-static inline void osd_seq_name(char *seq_name, size_t name_size, obd_seq seq)
+static inline void osd_seq_name(char *seq_name, size_t name_size, u64 seq)
 {
        snprintf(seq_name, name_size,
                 (fid_seq_is_rsvd(seq) ||
@@ -717,7 +758,7 @@ static inline void osd_seq_name(char *seq_name, size_t name_size, obd_seq seq)
 }
 
 static inline void osd_oid_name(char *name, size_t name_size,
-                               const struct lu_fid *fid, obd_id id)
+                               const struct lu_fid *fid, u64 id)
 {
        snprintf(name, name_size,
                 (fid_seq_is_rsvd(fid_seq(fid)) ||
@@ -754,7 +795,6 @@ static int osd_seq_load_locked(struct osd_thread_info *info,
                GOTO(out_put, rc = -EFAULT);
 
        inode = seq_dir->d_inode;
-       ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
        osd_seq->oos_root = seq_dir;
 
        /* 'What the @fid is' is not imporatant, because the object
@@ -785,7 +825,6 @@ static int osd_seq_load_locked(struct osd_thread_info *info,
                }
 
                inode = dir->d_inode;
-               ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
                osd_seq->oos_dirs[i] = dir;
 
                /* 'What the @fid is' is not imporatant, because the object
@@ -814,7 +853,7 @@ out_err:
 }
 
 static struct osd_obj_seq *osd_seq_load(struct osd_thread_info *info,
-                                       struct osd_device *osd, obd_seq seq)
+                                       struct osd_device *osd, u64 seq)
 {
        struct osd_obj_map      *map;
        struct osd_obj_seq      *osd_seq;
@@ -830,7 +869,7 @@ static struct osd_obj_seq *osd_seq_load(struct osd_thread_info *info,
                RETURN(osd_seq);
 
        /* Serializing init process */
-       down(&map->om_dir_init_sem);
+       mutex_lock(&map->om_dir_init_mutex);
 
        /* Check whether the seq has been added */
        read_lock(&map->om_seq_list_lock);
@@ -845,7 +884,7 @@ static struct osd_obj_seq *osd_seq_load(struct osd_thread_info *info,
        if (osd_seq == NULL)
                GOTO(cleanup, rc = -ENOMEM);
 
-       CFS_INIT_LIST_HEAD(&osd_seq->oos_seq_list);
+       INIT_LIST_HEAD(&osd_seq->oos_seq_list);
        osd_seq->oos_seq = seq;
        /* Init subdir count to be 32, but each seq can have
         * different subdir count */
@@ -855,11 +894,11 @@ static struct osd_obj_seq *osd_seq_load(struct osd_thread_info *info,
                GOTO(cleanup, rc);
 
        write_lock(&map->om_seq_list_lock);
-       cfs_list_add(&osd_seq->oos_seq_list, &map->om_seq_list);
+       list_add(&osd_seq->oos_seq_list, &map->om_seq_list);
        write_unlock(&map->om_seq_list_lock);
 
 cleanup:
-       up(&map->om_dir_init_sem);
+       mutex_unlock(&map->om_dir_init_mutex);
        if (rc != 0) {
                if (osd_seq != NULL)
                        OBD_FREE_PTR(osd_seq);
@@ -921,8 +960,11 @@ int osd_obj_map_lookup(struct osd_thread_info *info, struct osd_device *dev,
        brelse(bh);
 
        inode = osd_iget(info, dev, id);
-       if (IS_ERR(inode))
-               RETURN(PTR_ERR(inode));
+       if (IS_ERR(inode)) {
+               int rc = PTR_ERR(inode);
+
+               RETURN(rc == -ENOENT ? -ESTALE : rc);
+       }
 
        iput(inode);
        RETURN(0);
@@ -932,13 +974,13 @@ int osd_obj_map_insert(struct osd_thread_info *info,
                       struct osd_device *osd,
                       const struct lu_fid *fid,
                       const struct osd_inode_id *id,
-                      struct thandle *th)
+                      handle_t *th)
 {
        struct osd_obj_map      *map;
        struct osd_obj_seq      *osd_seq;
        struct dentry           *d;
        struct ost_id           *ostid = &info->oti_ostid;
-       obd_id                   oid;
+       u64                      oid;
        int                     dirn, rc = 0;
        char                    name[32];
        ENTRY;
@@ -975,7 +1017,7 @@ again:
 }
 
 int osd_obj_map_delete(struct osd_thread_info *info, struct osd_device *osd,
-                      const struct lu_fid *fid, struct thandle *th)
+                      const struct lu_fid *fid, handle_t *th)
 {
        struct osd_obj_map      *map;
        struct osd_obj_seq      *osd_seq;
@@ -1009,7 +1051,7 @@ int osd_obj_map_update(struct osd_thread_info *info,
                       struct osd_device *osd,
                       const struct lu_fid *fid,
                       const struct osd_inode_id *id,
-                      struct thandle *th)
+                      handle_t *th)
 {
        struct osd_obj_seq      *osd_seq;
        struct dentry           *d;
@@ -1114,28 +1156,17 @@ int osd_obj_map_recover(struct osd_thread_info *info,
                 *      So keep it there before we have suitable solution. */
                brelse(bh);
                mutex_unlock(&dir->i_mutex);
+               mutex_unlock(&src_parent->i_mutex);
+               ldiskfs_journal_stop(jh);
 
                rc = -EEXIST;
                /* If the src object has never been modified, then remove it. */
                if (inode->i_size == 0 && inode->i_mode & S_ISUID &&
                    inode->i_mode & S_ISGID) {
-                       bh = osd_ldiskfs_find_entry(src_parent, &src_child->d_name,
-                                                   &de, NULL, NULL);
-                       if (unlikely(bh == NULL)) {
-                               mutex_unlock(&src_parent->i_mutex);
-                               ldiskfs_journal_stop(jh);
-                               RETURN(0);
-                       }
-
-                       rc = ldiskfs_delete_entry(jh, src_parent, de, bh);
-                       brelse(bh);
-                       if (rc == 0) {
-                               drop_nlink(inode);
-                               ll_dirty_inode(inode, I_DIRTY_DATASYNC);
-                       }
+                       rc = ll_vfs_unlink(src_parent, src_child);
+                       if (unlikely(rc == -ENOENT))
+                               rc = 0;
                }
-               mutex_unlock(&src_parent->i_mutex);
-               ldiskfs_journal_stop(jh);
                RETURN(rc);
        }
 
@@ -1149,7 +1180,7 @@ int osd_obj_map_recover(struct osd_thread_info *info,
        if (rc != 0)
                GOTO(unlock, rc);
 
-       rc = osd_ldiskfs_add_entry(jh, tgt_child, inode, NULL);
+       rc = osd_ldiskfs_add_entry(info, jh, tgt_child, inode, NULL);
 
        GOTO(unlock, rc);
 
@@ -1189,10 +1220,10 @@ osd_object_spec_find(struct osd_thread_info *info, struct osd_device *osd,
 
 int osd_obj_spec_update(struct osd_thread_info *info, struct osd_device *osd,
                        const struct lu_fid *fid, const struct osd_inode_id *id,
-                       struct thandle *th)
+                       handle_t *th)
 {
        struct dentry   *root;
-       char            *name;
+       char            *name = NULL;
        int              rc;
        ENTRY;
 
@@ -1210,10 +1241,10 @@ int osd_obj_spec_update(struct osd_thread_info *info, struct osd_device *osd,
 
 int osd_obj_spec_insert(struct osd_thread_info *info, struct osd_device *osd,
                        const struct lu_fid *fid, const struct osd_inode_id *id,
-                       struct thandle *th)
+                       handle_t *th)
 {
        struct dentry   *root;
-       char            *name;
+       char            *name = NULL;
        int              rc;
        ENTRY;
 
@@ -1235,7 +1266,7 @@ int osd_obj_spec_lookup(struct osd_thread_info *info, struct osd_device *osd,
        struct dentry   *root;
        struct dentry   *dentry;
        struct inode    *inode;
-       char            *name;
+       char            *name = NULL;
        int             rc = -ENOENT;
        ENTRY;