* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
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;
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);
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])
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)
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);
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;
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);
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);
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);