if (rc == -ENODATA && !fid_is_igif(rfid) && osd->od_check_ff) {
fid = &lma->lma_self_fid;
rc = osd_get_idif(info, inode, dentry, fid);
- if ((rc > 0) || (rc == -ENODATA && osd->od_lma_self_repair)) {
+ if ((rc > 0) || (rc == -ENODATA && osd->od_index_in_idif)) {
/* For the given OST-object, if it has neither LMA nor
* FID in XATTR_NAME_FID, then the given FID (which is
* contained in the @obj, from client RPC for locating
* the OST-object) is trusted. We use it to generate
* the LMA. */
osd_lma_self_repair(info, osd, inode, rfid,
- fid_is_on_ost(info, osd, fid, OI_CHECK_FLD) ?
- LMAC_FID_ON_OST : 0);
+ LMAC_FID_ON_OST);
RETURN(0);
}
}
fid_to_ostid(fid, oi);
ostid_to_fid(fid1, oi, idx);
if (lu_fid_eq(fid1, rfid)) {
- if (osd->od_lma_self_repair)
+ if (osd->od_index_in_idif)
osd_lma_self_repair(info, osd,
inode, rfid,
LMAC_FID_ON_OST);
osd_sb(osd)->s_root->d_inode,
mode);
if (!IS_ERR(inode)) {
- /* Do not update file c/mtime in ldiskfs.
- * NB: don't need any lock because no contention at this
- * early stage */
- inode->i_flags |= S_NOCMTIME;
+ /* Do not update file c/mtime in ldiskfs. */
+ inode->i_flags |= S_NOCMTIME;
/* For new created object, it must be consistent,
* and it is unnecessary to scrub against it. */
ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NOSCRUB);
+
obj->oo_inode = inode;
result = 0;
} else {
result = osd_create_type_f(dof->dof_type)(info, obj, attr, hint, dof,
th);
- if (result == 0) {
+ if (result == 0) {
osd_attr_init(info, obj, attr, dof);
osd_object_init0(obj);
- /* bz 24037 */
- if (obj->oo_inode && (obj->oo_inode->i_state & I_NEW))
- unlock_new_inode(obj->oo_inode);
- }
+ }
+
+ if (obj->oo_inode != NULL) {
+ LASSERT(obj->oo_inode->i_state & I_NEW);
+
+ unlock_new_inode(obj->oo_inode);
+ }
/* restore previous umask value */
current->fs->umask = umask;
RETURN(local);
}
+ ldiskfs_set_inode_state(local, LDISKFS_STATE_LUSTRE_NOSCRUB);
+ unlock_new_inode(local);
+
/* Set special LMA flag for local agent inode */
rc = osd_ea_fid_set(info, local, fid, 0, LMAI_AGENT);
if (rc != 0) {
osd_trans_declare_rb(env, th, OSD_OT_REF_ADD);
result = __osd_object_create(info, obj, attr, hint, dof, th);
- if (result == 0)
- result = osd_ea_fid_set(info, obj->oo_inode, fid,
+ if (result == 0) {
+ if (fid_is_idif(fid) &&
+ !osd_dev(dt->do_lu.lo_dev)->od_index_in_idif) {
+ struct lu_fid *tfid = &info->oti_fid;
+ struct ost_id *oi = &info->oti_ostid;
+
+ fid_to_ostid(fid, oi);
+ ostid_to_fid(tfid, oi, 0);
+ result = osd_ea_fid_set(info, obj->oo_inode, tfid,
+ LMAC_FID_ON_OST, 0);
+ } else {
+ result = osd_ea_fid_set(info, obj->oo_inode, fid,
fid_is_on_ost(info, osd_obj2dev(obj),
fid, OI_CHECK_FLD) ?
LMAC_FID_ON_OST : 0, 0);
+ }
+ }
if (result == 0)
result = __osd_oi_insert(env, obj, fid, th);
/* done with de, release bh */
brelse(bh);
if (rc != 0) {
- if (unlikely(ino == osd_remote_parent_ino(dev)))
+ if (unlikely(ino == osd_remote_parent_ino(dev))) {
+ const char *name = (const char *)key;
+
/* If the parent is on remote MDT, and there
* is no FID-in-dirent, then we have to get
* the parent FID from the linkEA. */
- rc = osd_get_pfid_from_linkea(env, obj, fid);
- else
+ if (likely(strlen(name) == 2 &&
+ name[0] == '.' && name[1] == '.'))
+ rc = osd_get_pfid_from_linkea(env, obj,
+ fid);
+ } else {
rc = osd_ea_fid_get(env, obj, ino, fid, id);
+ }
} else {
osd_id_gen(id, ino, OSD_OII_NOGEN);
}
/* If the parent is on remote MDT, and there
* is no FID-in-dirent, then we have to get
* the parent FID from the linkEA. */
- osd_get_pfid_from_linkea(env, obj, fid);
+ if (!fid_is_sane(fid) &&
+ it->oie_dirent->oied_namelen == 2 &&
+ it->oie_dirent->oied_name[0] == '.' &&
+ it->oie_dirent->oied_name[1] == '.')
+ osd_get_pfid_from_linkea(env, obj, fid);
} else {
rc = osd_dirent_check_repair(env, obj, it, fid, id,
&attr);
} else {
attr &= ~LU_DIRENT_ATTRS_MASK;
if (!fid_is_sane(fid)) {
- if (OBD_FAIL_CHECK(OBD_FAIL_FID_LOOKUP) &&
- likely(it->oie_dirent->oied_namelen != 2 ||
- it->oie_dirent->oied_name[0] != '.' ||
- it->oie_dirent->oied_name[1] != '.'))
- RETURN(-ENOENT);
-
- if (unlikely(ino == osd_remote_parent_ino(dev)))
+ if (it->oie_dirent->oied_namelen == 2 &&
+ it->oie_dirent->oied_name[0] == '.' &&
+ it->oie_dirent->oied_name[1] == '.') {
/* If the parent is on remote MDT, and there
* is no FID-in-dirent, then we have to get
* the parent FID from the linkEA. */
- rc = osd_get_pfid_from_linkea(env, obj, fid);
- else
+ if (ino == osd_remote_parent_ino(dev))
+ rc = osd_get_pfid_from_linkea(env, obj,
+ fid);
+ } else {
+ if (OBD_FAIL_CHECK(OBD_FAIL_FID_LOOKUP))
+ RETURN(-ENOENT);
+
rc = osd_ea_fid_get(env, obj, ino, fid, id);
+ }
} else {
osd_id_gen(id, ino, OSD_OII_NOGEN);
}
if (rc != 0)
GOTO(out_site, rc);
- /* self-repair LMA by default */
- o->od_lma_self_repair = 1;
-
INIT_LIST_HEAD(&o->od_ios_list);
/* setup scrub, including OI files initialization */
rc = osd_scrub_setup(env, o);
}
static int osd_prepare(const struct lu_env *env, struct lu_device *pdev,
- struct lu_device *dev)
+ struct lu_device *dev)
{
- struct osd_device *osd = osd_dev(dev);
- int result = 0;
+ struct osd_device *osd = osd_dev(dev);
+ struct lr_server_data *lsd =
+ &osd->od_dt_dev.dd_lu_dev.ld_site->ls_tgt->lut_lsd;
+ int result = 0;
ENTRY;
if (osd->od_quota_slave != NULL) {
RETURN(result);
}
+ if (lsd->lsd_feature_incompat & OBD_COMPAT_OST) {
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 52, 0)
+ if (lsd->lsd_feature_rocompat & OBD_ROCOMPAT_IDX_IN_IDIF) {
+ osd->od_index_in_idif = 1;
+ } else {
+ osd->od_index_in_idif = 0;
+ result = osd_register_proc_index_in_idif(osd);
+ if (result != 0)
+ RETURN(result);
+ }
+#else
+ osd->od_index_in_idif = 1;
+#endif
+ }
+
result = osd_fid_init(env, osd);
RETURN(result);
.ldt_ctx_tags = LCT_LOCAL,
};
+static int osd_health_check(const struct lu_env *env, struct obd_device *obd)
+{
+ struct osd_device *osd = osd_dev(obd->obd_lu_dev);
+ struct super_block *sb = osd_sb(osd);
+
+ return (osd->od_mnt == NULL || sb->s_flags & MS_RDONLY);
+}
+
/*
* lprocfs legacy support.
*/
.o_connect = osd_obd_connect,
.o_disconnect = osd_obd_disconnect,
.o_fid_alloc = osd_fid_alloc,
+ .o_health_check = osd_health_check,
};
static int __init osd_mod_init(void)