*
* This should be called without the parent
* i_mutex held, and will take the i_mutex itself.
- *
- * Unlike osd_lookup_one_len dentry with NULL d_inode is valid
*/
struct dentry *osd_lookup_one_len_unlocked(const char *name,
struct dentry *base, int len)
* @name: pathname component to lookup
* @base: base directory to lookup from
* @len: maximum length @len should be interpreted to
- *
- * Treat found dentry with NULL d_inode as an -ENOENT error so LFSCK
- * can repair the file.
*/
struct dentry *osd_ios_lookup_one_len(const char *name, struct dentry *base,
int len)
return dentry;
}
- if (dentry->d_inode == NULL) {
- dput(dentry);
- return ERR_PTR(-ENOENT);
- }
-
return dentry;
}
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) {
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;
child = osd_ios_lookup_one_len(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);
scrub->os_convert_igif = 1;
child = osd_ios_lookup_one_len(dot_lustre_name, dentry,
strlen(dot_lustre_name));
- if (IS_ERR(child)) {
+ if (IS_ERR(child) && PTR_ERR(child) != -ENOENT) {
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;
- }
+ } else if (IS_ERR(child) || !child->d_inode) {
+ /* 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 (!IS_ERR(child))
+ dput(child);
} 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
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)
+ 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++;
}