* GPL HEADER END
*/
/*
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
*/
/*
* lustre/osd-ldiskfs/osd_scrub.c
GOTO(out, rc);
}
+ /* The inode has been reused as EA inode, ignore it. */
+ if (unlikely(osd_is_ea_inode(inode)))
+ GOTO(out, rc = 0);
+
sf->sf_flags |= SF_UPGRADE;
sf->sf_internal_flags &= ~SIF_NO_HANDLE_OLD_FID;
dev->od_check_ff = 1;
rc = 0;
GOTO(out, rc);
}
+
+ /* The inode has been reused as EA inode, ignore it. */
+ if (unlikely(osd_is_ea_inode(inode)))
+ GOTO(out, rc = 0);
}
if (!scrub->os_partial_scan)
return rc;
}
-static void osd_scrub_post(struct osd_scrub *scrub, int result)
+static int osd_scrub_post(struct osd_scrub *scrub, int result)
{
struct scrub_file *sf = &scrub->os_file;
+ int rc;
ENTRY;
CDEBUG(D_LFSCK, "%.16s: OI scrub post, result = %d\n",
}
sf->sf_run_time += cfs_duration_sec(cfs_time_current() + HALF_SEC -
scrub->os_time_last_checkpoint);
- result = osd_scrub_file_store(scrub);
+ rc = osd_scrub_file_store(scrub);
up_write(&scrub->os_rwsem);
- EXIT;
+ RETURN(rc < 0 ? rc : result);
}
/* iteration engine */
RETURN(rc);
}
+ /* It is an EA inode, no OI mapping for it, skip it. */
+ if (osd_is_ea_inode(inode))
+ GOTO(put, rc = SCRUB_NEXT_CONTINUE);
+
if (scrub &&
ldiskfs_test_inode_state(inode, LDISKFS_STATE_LUSTRE_NOSCRUB)) {
/* Only skip it for the first OI scrub accessing. */
GOTO(post, rc);
post:
- osd_scrub_post(scrub, rc);
+ rc = osd_scrub_post(scrub, rc);
CDEBUG(D_LFSCK, "%.16s: OI scrub: stop, pos = %u: rc = %d\n",
osd_scrub2name(scrub), scrub->os_pos_current, rc);
struct dentry *dentry;
dentry = ll_lookup_one_len(name, parent, namelen);
- if (!IS_ERR(dentry) && dentry->d_inode == NULL) {
+ if (IS_ERR(dentry)) {
+ int rc = PTR_ERR(dentry);
+
+ if (rc != -ENOENT)
+ CERROR("Fail to find %.*s in %.*s (%lu/%u): rc = %d\n",
+ namelen, name, parent->d_name.len,
+ parent->d_name.name, parent->d_inode->i_ino,
+ parent->d_inode->i_generation, rc);
+
+ return dentry;
+ }
+
+ if (dentry->d_inode == NULL) {
dput(dentry);
return ERR_PTR(-ENOENT);
}
GOTO(cleanup_inode, rc);
} else {
if (memcmp(sf->sf_uuid, es->s_uuid, 16) != 0) {
+ struct obd_uuid *old_uuid;
+ struct obd_uuid *new_uuid;
+
+ OBD_ALLOC_PTR(old_uuid);
+ OBD_ALLOC_PTR(new_uuid);
+ if (old_uuid == NULL || new_uuid == NULL) {
+ CERROR("%.16s: UUID has been changed, but"
+ "failed to allocate RAM for report\n",
+ LDISKFS_SB(sb)->s_es->s_volume_name);
+ } else {
+ class_uuid_unparse(sf->sf_uuid, old_uuid);
+ class_uuid_unparse(es->s_uuid, new_uuid);
+ CERROR("%.16s: UUID has been changed from "
+ "%s to %s\n",
+ LDISKFS_SB(sb)->s_es->s_volume_name,
+ old_uuid->uuid, new_uuid->uuid);
+ }
osd_scrub_file_reset(scrub, es->s_uuid,SF_INCONSISTENT);
dirty = 1;
+ if (old_uuid != NULL)
+ OBD_FREE_PTR(old_uuid);
+ if (new_uuid != NULL)
+ OBD_FREE_PTR(new_uuid);
} else if (sf->sf_status == SS_SCANNING) {
sf->sf_status = SS_CRASHED;
dirty = 1;