fops->release(inode, filp);
out:
- RETURN(rc >= 0 ? 0 : rc);
+ if (rc < 0)
+ CDEBUG(D_LFSCK, "%.16s: fail to check LMV EA, inode = %lu/%u,"
+ DFID": rc = %d\n",
+ LDISKFS_SB(inode->i_sb)->s_es->s_volume_name,
+ inode->i_ino, inode->i_generation,
+ PFID(&oic->oic_fid), rc);
+ else
+ rc = 0;
+
+ RETURN(rc);
}
static int osd_fid_lookup(const struct lu_env *env, struct osd_object *obj,
obj->oo_compat_dot_created = 1;
obj->oo_compat_dotdot_created = 1;
- if (!S_ISDIR(inode->i_mode))
- GOTO(out, result = 0);
-
- if (flags & SS_AUTO_PARTIAL)
+ if (S_ISDIR(inode->i_mode) &&
+ (flags & SS_AUTO_PARTIAL || sf->sf_status == SS_SCANNING))
osd_check_lmv(info, dev, inode, oic);
if (!ldiskfs_pdo)
if (bits == 0)
return 0;
- if (bits & LA_ATIME)
- inode->i_atime = *osd_inode_time(env, inode, attr->la_atime);
- if (bits & LA_CTIME)
- inode->i_ctime = *osd_inode_time(env, inode, attr->la_ctime);
- if (bits & LA_MTIME)
- inode->i_mtime = *osd_inode_time(env, inode, attr->la_mtime);
- if (bits & LA_SIZE) {
- LDISKFS_I(inode)->i_disksize = attr->la_size;
- i_size_write(inode, attr->la_size);
- }
+ if (bits & LA_ATIME)
+ inode->i_atime = *osd_inode_time(env, inode, attr->la_atime);
+ if (bits & LA_CTIME)
+ inode->i_ctime = *osd_inode_time(env, inode, attr->la_ctime);
+ if (bits & LA_MTIME)
+ inode->i_mtime = *osd_inode_time(env, inode, attr->la_mtime);
+ if (bits & LA_SIZE) {
+ LDISKFS_I(inode)->i_disksize = attr->la_size;
+ i_size_write(inode, attr->la_size);
+ }
-#if 0
- /* OSD should not change "i_blocks" which is used by quota.
- * "i_blocks" should be changed by ldiskfs only. */
- if (bits & LA_BLOCKS)
- inode->i_blocks = attr->la_blocks;
-#endif
+ /* OSD should not change "i_blocks" which is used by quota.
+ * "i_blocks" should be changed by ldiskfs only. */
if (bits & LA_MODE)
inode->i_mode = (inode->i_mode & S_IFMT) |
(attr->la_mode & ~S_IFMT);
if (bits & LA_RDEV)
inode->i_rdev = attr->la_rdev;
- if (bits & LA_FLAGS) {
- /* always keep S_NOCMTIME */
- inode->i_flags = ll_ext_to_inode_flags(attr->la_flags) |
- S_NOCMTIME;
- }
- return 0;
+ if (bits & LA_FLAGS) {
+ /* always keep S_NOCMTIME */
+ inode->i_flags = ll_ext_to_inode_flags(attr->la_flags) |
+ S_NOCMTIME;
+ }
+ return 0;
}
static int osd_quota_transfer(struct inode *inode, const struct lu_attr *attr)
RETURN(rc);
}
+static int osd_invalidate(const struct lu_env *env, struct dt_object *dt)
+{
+ return 0;
+}
+
/*
* Index operations.
*/
.do_xattr_del = osd_xattr_del,
.do_xattr_list = osd_xattr_list,
.do_object_sync = osd_object_sync,
+ .do_invalidate = osd_invalidate,
};
/**
.do_xattr_del = osd_xattr_del,
.do_xattr_list = osd_xattr_list,
.do_object_sync = osd_object_sync,
+ .do_invalidate = osd_invalidate,
};
static const struct dt_object_operations osd_obj_otable_it_ops = {
}
bh = osd_ldiskfs_find_entry(dir, &dentry->d_name, &de, NULL, hlock);
- if (bh) {
+ if (!IS_ERR(bh)) {
/* If this is not the ".." entry, it might be a remote DNE
* entry and we need to check if the FID is for a remote
* MDT. If the FID is not in the directory entry (e.g.
le32_to_cpu(de->inode));
}
}
- rc = ldiskfs_delete_entry(oh->ot_handle, dir, de, bh);
- brelse(bh);
- } else {
- rc = -ENOENT;
- }
+ rc = ldiskfs_delete_entry(oh->ot_handle, dir, de, bh);
+ brelse(bh);
+ } else {
+ rc = PTR_ERR(bh);
+ }
if (hlock != NULL)
ldiskfs_htree_unlock(hlock);
else
bh = osd_ldiskfs_find_entry(pobj->oo_inode, &child->d_name, &de,
NULL, hlock);
- if (bh != NULL) {
+ if (!IS_ERR(bh)) {
rc1 = ldiskfs_journal_get_write_access(oth->ot_handle,
bh);
if (rc1 == 0) {
LDISKFS_FT_DIR;
ldiskfs_handle_dirty_metadata(oth->ot_handle,
NULL, bh);
- brelse(bh);
}
+ brelse(bh);
}
}
osd_consistency_check(struct osd_thread_info *oti, struct osd_device *dev,
struct osd_idmap_cache *oic)
{
- struct osd_scrub *scrub = &dev->od_scrub;
- struct lu_fid *fid = &oic->oic_fid;
- struct osd_inode_id *id = &oic->oic_lid;
- struct inode *inode = NULL;
- int once = 0;
- int rc;
+ struct osd_scrub *scrub = &dev->od_scrub;
+ struct lu_fid *fid = &oic->oic_fid;
+ struct osd_inode_id *id = &oic->oic_lid;
+ struct inode *inode = NULL;
+ int once = 0;
+ bool insert;
+ int rc;
ENTRY;
if (!fid_is_norm(fid) && !fid_is_igif(fid))
if (rc == -ENOENT) {
__u32 gen = id->oii_gen;
+ insert = true;
if (inode != NULL)
goto trigger;
RETURN(0);
} else if (rc != 0 || osd_id_eq(id, &oti->oti_id)) {
RETURN(rc);
+ } else {
+ insert = false;
}
trigger:
if (thread_is_running(&scrub->os_thread)) {
- rc = osd_oii_insert(dev, oic, rc == -ENOENT);
- /* There is race condition between osd_oi_lookup and OI scrub.
- * The OI scrub finished just after osd_oi_lookup() failure.
- * Under such case, it is unnecessary to trigger OI scrub again,
- * but try to call osd_oi_lookup() again. */
- if (unlikely(rc == -EAGAIN))
- goto again;
-
if (inode == NULL) {
inode = osd_iget(oti, dev, id);
/* The inode has been removed (by race maybe). */
}
}
+ rc = osd_oii_insert(dev, oic, insert);
+ /* There is race condition between osd_oi_lookup and OI scrub.
+ * The OI scrub finished just after osd_oi_lookup() failure.
+ * Under such case, it is unnecessary to trigger OI scrub again,
+ * but try to call osd_oi_lookup() again. */
+ if (unlikely(rc == -EAGAIN))
+ goto again;
+
if (!S_ISDIR(inode->i_mode))
rc = 0;
else
}
bh = osd_ldiskfs_find_entry(dir, &dentry->d_name, &de, NULL, hlock);
- if (bh) {
+ if (!IS_ERR(bh)) {
struct osd_thread_info *oti = osd_oti_get(env);
struct osd_inode_id *id = &oti->oti_id;
struct osd_idmap_cache *oic = &oti->oti_cache;
if (rc != 0)
fid_zero(&oic->oic_fid);
} else {
- rc = -ENOENT;
+ rc = PTR_ERR(bh);
}
GOTO(out, rc);
* For the whole directory, only dot/dotdot entry have no FID-in-dirent
* and needs to get FID from LMA when readdir, it will not affect the
* performance much. */
- if ((bh == NULL) || (le32_to_cpu(de->inode) != inode->i_ino) ||
+ if (IS_ERR(bh) || (le32_to_cpu(de->inode) != inode->i_ino) ||
(dot_dotdot != 0 && !osd_dot_dotdot_has_space(de, dot_dotdot))) {
*attr |= LUDA_IGNORE;
GOTO(out, rc);
out:
- brelse(bh);
+ if (!IS_ERR(bh))
+ brelse(bh);
if (hlock != NULL) {
ldiskfs_htree_unlock(hlock);
} else {
/* Glom up mount options */
if (*options != '\0')
strcat(options, ",");
- strlcat(options, "no_mbcache", PAGE_CACHE_SIZE);
+ strlcat(options, "no_mbcache", PAGE_SIZE);
type = get_fs_type("ldiskfs");
if (!type) {