X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosd-ldiskfs%2Fosd_compat.c;h=cec04db5613bf6adf5b9dc36f4e571ca5ea83124;hp=5291dcda7879f0a1dc59e5035fb819e0c84fc5eb;hb=ae70c9e898b8230f26f659bfd85665230ea49720;hpb=0754bc8f2623bea184111af216f7567608db35b6 diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c index 5291dcd..cec04db 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -225,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; @@ -247,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); @@ -420,13 +421,10 @@ cleanup_alloc: 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; - 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]) @@ -455,7 +453,10 @@ static void osd_ost_fini(struct osd_device *osd) write_lock(&map->om_seq_list_lock); list_for_each_entry_safe(osd_seq, tmp, &map->om_seq_list, oos_seq_list) { - osd_seq_free(map, osd_seq); + 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) @@ -563,6 +564,13 @@ 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); @@ -586,7 +594,7 @@ static int osd_obj_update_entry(struct osd_thread_info *info, GOTO(out, rc = -EEXIST); } - if (fid_is_idif(fid) && fid_is_idif(oi_fid)) { + 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; @@ -705,10 +713,11 @@ static int osd_obj_add_entry(struct osd_thread_info *info, inode = info->oti_inode; if (unlikely(inode == NULL)) { - OBD_ALLOC_PTR(inode); - if (inode == NULL) + struct ldiskfs_inode_info *lii; + OBD_ALLOC_PTR(lii); + if (lii == NULL) RETURN(-ENOMEM); - info->oti_inode = inode; + inode = info->oti_inode = &lii->vfs_inode; } inode->i_sb = osd_sb(osd); @@ -727,7 +736,7 @@ static 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(th, child, inode, NULL); + rc = osd_ldiskfs_add_entry(info, th, child, inode, NULL); mutex_unlock(&dir->d_inode->i_mutex); RETURN(rc); @@ -1171,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);