int rc;
ENTRY;
+ if (!inode) {
+ CDEBUG(D_INODE, "%s: child '%.*s' lacks inode: rc = -2\n",
+ osd_name(dev), namelen, name);
+ RETURN(-ENOENT);
+ }
+
rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
&info->oti_ost_attrs);
if (rc != 0 && rc != -ENODATA) {
RETURN(0);
scrub->os_lf_scanned++;
- child = osd_ios_lookup_one_len(name, parent, namelen);
+ child = osd_lookup_one_len_unlocked(dev, name, parent, namelen);
if (IS_ERR(child)) {
CDEBUG(D_LFSCK, "%s: cannot lookup child '%.*s': rc = %d\n",
osd_name(dev), namelen, name, (int)PTR_ERR(child));
RETURN(0);
+ } else if (!child->d_inode) {
+ dput(child);
+ CDEBUG(D_INODE, "%s: child '%.*s' lacks inode\n",
+ osd_name(dev), namelen, name);
+ RETURN(0);
}
inode = child->d_inode;
if (name[0] == '.')
RETURN(0);
- child = osd_ios_lookup_one_len(name, fill_buf->oifb_dentry, namelen);
+ child = osd_lookup_one_len_unlocked(dev, name, fill_buf->oifb_dentry,
+ namelen);
if (IS_ERR(child))
RETURN(PTR_ERR(child));
if (map->olm_name == NULL)
RETURN(0);
- child = osd_ios_lookup_one_len(name, fill_buf->oifb_dentry, namelen);
+ child = osd_lookup_one_len_unlocked(dev, name, fill_buf->oifb_dentry,
+ namelen);
if (IS_ERR(child))
RETURN(PTR_ERR(child));
{
struct osd_ios_filldir_buf *fill_buf =
(struct osd_ios_filldir_buf *)buf;
+ struct osd_device *dev = fill_buf->oifb_dev;
struct dentry *child;
struct lu_fid tfid;
int rc = 0;
if (name[0] != '[')
RETURN(0);
- child = osd_ios_lookup_one_len(name, fill_buf->oifb_dentry, namelen);
+ child = osd_lookup_one_len_unlocked(dev, name, fill_buf->oifb_dentry,
+ namelen);
if (IS_ERR(child))
RETURN(PTR_ERR(child));
if (map->olm_name == NULL)
RETURN(0);
- child = osd_ios_lookup_one_len(name, fill_buf->oifb_dentry, namelen);
+ child = osd_lookup_one_len_unlocked(dev, name, fill_buf->oifb_dentry,
+ namelen);
if (IS_ERR(child))
RETURN(PTR_ERR(child));
+ else if (!child->d_inode)
+ GOTO(out_put, rc = -ENOENT);
if (!(map->olm_flags & OLF_NO_OI))
rc = osd_ios_scan_one(fill_buf->oifb_info, dev,
if (rc == 0 && map->olm_flags & OLF_SCAN_SUBITEMS)
rc = osd_ios_new_item(dev, child, map->olm_scandir,
map->olm_filldir);
+out_put:
dput(child);
RETURN(rc);
buf.oifb_items = 0;
#ifdef HAVE_DIR_CONTEXT
buf.ctx.pos = filp->f_pos;
-#ifdef HAVE_ITERATE_SHARED
rc = fops->iterate_shared(filp, &buf.ctx);
-#else
- rc = fops->iterate(filp, &buf.ctx);
-#endif
filp->f_pos = buf.ctx.pos;
#else
rc = fops->readdir(filp, &buf, filldir);
* OI mapping crashed or lost also, then we have to give up under
* double failure cases. */
scrub->os_convert_igif = 1;
- child = osd_ios_lookup_one_len(dot_lustre_name, dentry,
- strlen(dot_lustre_name));
+ child = osd_lookup_one_len_unlocked(dev, dot_lustre_name, dentry,
+ strlen(dot_lustre_name));
if (IS_ERR(child)) {
- rc = PTR_ERR(child);
- if (rc == -ENOENT) {
- /* It is 1.8 MDT device. */
- if (!(sf->sf_flags & SF_UPGRADE)) {
- scrub_file_reset(scrub, dev->od_uuid,
- SF_UPGRADE);
- sf->sf_internal_flags &= ~SIF_NO_HANDLE_OLD_FID;
- rc = scrub_file_store(info->oti_env, scrub);
- } else {
- rc = 0;
- }
+ if (PTR_ERR(child) != -ENOENT)
+ RETURN(PTR_ERR(child));
+ goto out_scrub;
+ }
+
+ /* For lustre-2.x (x <= 3), the ".lustre" has NO FID-in-LMA,
+ * so the client will get IGIF for the ".lustre" object when
+ * the MDT restart.
+ *
+ * From the OI scrub view, when the MDT upgrade to Lustre-2.4,
+ * it does not know whether there are some old clients cached
+ * the ".lustre" IGIF during the upgrading. Two choices:
+ *
+ * 1) Generate IGIF-in-LMA and IGIF-in-OI for the ".lustre".
+ * It will allow the old connected clients to access the
+ * ".lustre" with cached IGIF. But it will cause others
+ * on the MDT failed to check "fid_is_dot_lustre()".
+ *
+ * 2) Use fixed FID {FID_SEQ_DOT_LUSTRE, FID_OID_DOT_LUSTRE, 0}
+ * for ".lustre" in spite of whether there are some clients
+ * cached the ".lustre" IGIF or not. It enables the check
+ * "fid_is_dot_lustre()" on the MDT, although it will cause
+ * that the old connected clients cannot access the ".lustre"
+ * with the cached IGIF.
+ *
+ * Usually, it is rare case for the old connected clients
+ * to access the ".lustre" with cached IGIF. So we prefer
+ * to the solution 2).
+ */
+ rc = osd_ios_scan_one(info, dev, dentry->d_inode,
+ child->d_inode, &LU_DOT_LUSTRE_FID,
+ dot_lustre_name,
+ strlen(dot_lustre_name), 0);
+ if (rc == -ENOENT) {
+out_scrub:
+ /* It is 1.8 MDT device. */
+ if (!(sf->sf_flags & SF_UPGRADE)) {
+ scrub_file_reset(scrub, dev->od_uuid,
+ SF_UPGRADE);
+ sf->sf_internal_flags &= ~SIF_NO_HANDLE_OLD_FID;
+ rc = scrub_file_store(info->oti_env, scrub);
+ } else {
+ rc = 0;
}
- } else {
- /* For lustre-2.x (x <= 3), the ".lustre" has NO FID-in-LMA,
- * so the client will get IGIF for the ".lustre" object when
- * the MDT restart.
- *
- * From the OI scrub view, when the MDT upgrade to Lustre-2.4,
- * it does not know whether there are some old clients cached
- * the ".lustre" IGIF during the upgrading. Two choices:
- *
- * 1) Generate IGIF-in-LMA and IGIF-in-OI for the ".lustre".
- * It will allow the old connected clients to access the
- * ".lustre" with cached IGIF. But it will cause others
- * on the MDT failed to check "fid_is_dot_lustre()".
- *
- * 2) Use fixed FID {FID_SEQ_DOT_LUSTRE, FID_OID_DOT_LUSTRE, 0}
- * for ".lustre" in spite of whether there are some clients
- * cached the ".lustre" IGIF or not. It enables the check
- * "fid_is_dot_lustre()" on the MDT, although it will cause
- * that the old connected clients cannot access the ".lustre"
- * with the cached IGIF.
- *
- * Usually, it is rare case for the old connected clients
- * to access the ".lustre" with cached IGIF. So we prefer
- * to the solution 2). */
- rc = osd_ios_scan_one(info, dev, dentry->d_inode,
- child->d_inode, &LU_DOT_LUSTRE_FID,
- dot_lustre_name,
- strlen(dot_lustre_name), 0);
- if (rc == 0)
- rc = osd_ios_new_item(dev, child, osd_ios_general_scan,
- osd_ios_dl_fill);
- dput(child);
+ } else if (rc == 0) {
+ rc = osd_ios_new_item(dev, child, osd_ios_general_scan,
+ osd_ios_dl_fill);
}
+ dput(child);
RETURN(rc);
}
RETURN(rc);
}
- child = osd_ios_lookup_one_len(ADMIN_USR, dentry, strlen(ADMIN_USR));
- if (!IS_ERR(child)) {
+ child = osd_lookup_one_len_unlocked(dev, ADMIN_USR, dentry,
+ strlen(ADMIN_USR));
+ if (IS_ERR(child)) {
+ rc = PTR_ERR(child);
+ } else {
rc = osd_ios_scan_one(info, dev, dentry->d_inode,
child->d_inode, NULL, ADMIN_USR,
strlen(ADMIN_USR), 0);
dput(child);
- } else {
- rc = PTR_ERR(child);
}
if (rc != 0 && rc != -ENOENT)
- RETURN(rc);
-
- child = osd_ios_lookup_one_len(ADMIN_GRP, dentry, strlen(ADMIN_GRP));
- if (!IS_ERR(child)) {
- rc = osd_ios_scan_one(info, dev, dentry->d_inode,
- child->d_inode, NULL, ADMIN_GRP,
- strlen(ADMIN_GRP), 0);
- dput(child);
- } else {
- rc = PTR_ERR(child);
- }
+ GOTO(out, rc);
- if (rc == -ENOENT)
- rc = 0;
+ child = osd_lookup_one_len_unlocked(dev, ADMIN_GRP, dentry,
+ strlen(ADMIN_GRP));
+ if (IS_ERR(child))
+ GOTO(out, rc = PTR_ERR(child));
- RETURN(rc);
+ rc = osd_ios_scan_one(info, dev, dentry->d_inode,
+ child->d_inode, NULL, ADMIN_GRP,
+ strlen(ADMIN_GRP), 0);
+ dput(child);
+out:
+ RETURN(rc == -ENOENT ? 0 : rc);
}
static void osd_initial_OI_scrub(struct osd_thread_info *info,
continue;
}
- child = osd_ios_lookup_one_len(map->olm_name,
- osd_sb(dev)->s_root,
- map->olm_namelen);
- if (!IS_ERR(child))
- dput(child);
- else if (PTR_ERR(child) == -ENOENT)
+ child = osd_lookup_one_len_unlocked(dev, map->olm_name,
+ osd_sb(dev)->s_root,
+ map->olm_namelen);
+ if (PTR_ERR(child) == -ENOENT ||
+ (!IS_ERR(child) && !child->d_inode))
osd_scrub_refresh_mapping(info, dev, &map->olm_fid,
NULL, DTO_INDEX_DELETE,
true, 0, NULL);
+ if (!IS_ERR(child))
+ dput(child);
map++;
}