*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/osd-zfs/osd_object.c
*
char *osd_obj_tag = "osd_object";
static int osd_object_sync_delay_us = -1;
-static struct dt_object_operations osd_obj_ops;
-static struct lu_object_operations osd_lu_obj_ops;
-static struct dt_object_operations osd_obj_otable_it_ops;
+static const struct dt_object_operations osd_obj_ops;
+static const struct lu_object_operations osd_lu_obj_ops;
+static const struct dt_object_operations osd_obj_otable_it_ops;
static void
osd_object_sa_fini(struct osd_object *obj)
GOTO(out, rc = 0);
rc = osd_check_lma(env, obj);
- if ((!rc && !remote) || (rc != -EREMCHG))
+ if (rc != -EREMCHG)
GOTO(out, rc);
+ osd_scrub_refresh_mapping(env, osd, fid, oid, DTO_INDEX_DELETE, true,
+ NULL);
+
trigger:
/* We still have chance to get the valid dnode: for the object that is
* referenced by remote name entry, the object on the local MDT will be
/* It is me to trigger the OI scrub. */
rc1 = osd_scrub_start(env, osd, SS_CLEAR_DRYRUN |
SS_CLEAR_FAILOUT | SS_AUTO_FULL);
- LCONSOLE_WARN("%s: trigger OI scrub by RPC for the "DFID": rc = %d\n",
- osd_name(osd), PFID(fid), rc1);
+ CDEBUG_LIMIT(D_LFSCK | D_CONSOLE | D_WARNING,
+ "%s: trigger OI scrub by RPC for "DFID"/%#llx: rc = %d\n",
+ osd_name(osd), PFID(fid), oid, rc1);
if (!rc) {
LASSERT(remote);
dt_object_fini(&obj->oo_dt);
/* obj doesn't contain an lu_object_header, so we don't need call_rcu */
OBD_SLAB_FREE_PTR(obj, osd_object_kmem);
- if (unlikely(h)) {
- lu_object_header_fini(h);
- OBD_FREE_PRE(h, sizeof(*h), "kfreed");
- kfree_rcu(h, loh_rcu);
- }
+ if (unlikely(h))
+ lu_object_header_free(h);
}
static int
LASSERT(obj->oo_attr.la_size <= osd_sync_destroy_max_size);
rc = -dmu_object_free(osd->od_os, oid, oh->ot_tx);
if (rc)
- CERROR("%s: failed to free %s %llu: rc = %d\n",
+ CERROR("%s: failed to free %s/%#llx: rc = %d\n",
osd->od_svname, buf, oid, rc);
} else if (obj->oo_destroy == OSD_DESTROY_SYNC) {
rc = -dmu_object_free(osd->od_os, oid, oh->ot_tx);
if (rc)
- CERROR("%s: failed to free %s %llu: rc = %d\n",
+ CERROR("%s: failed to free %s/%#llx: rc = %d\n",
osd->od_svname, buf, oid, rc);
} else { /* asynchronous destroy */
char *key = info->oti_key;
rc = osd_zap_add(osd, osd->od_unlinked->dn_object,
osd->od_unlinked, key, 8, 1, &oid, oh->ot_tx);
if (rc)
- CERROR("%s: zap_add_int() failed %s %llu: rc = %d\n",
+ CERROR("%s: zap_add_int() failed %s/%#llx: rc = %d\n",
osd->od_svname, buf, oid, rc);
}
}
read_unlock(&obj->oo_attr_lock);
if (attr->la_valid & LA_FLAGS && attr->la_flags & LUSTRE_ORPHAN_FL)
- CDEBUG(D_INFO, "%s: set orphan flag on "DFID" (%llx/%x)\n",
+ CDEBUG(D_INFO, "%s: set orphan flag on "DFID" (%#llx/%#x)\n",
osd_obj2dev(obj)->od_svname,
PFID(lu_object_fid(&dt->do_lu)),
attr->la_valid, obj->oo_lma_flags);
down_read(&obj->oo_guard);
if (unlikely(!dt_object_exists(dt) || obj->oo_destroyed))
- GOTO(out, rc = 0);
+ GOTO(out_sem, rc = 0);
LASSERT(obj->oo_sa_hdl != NULL);
LASSERT(oh->ot_tx != NULL);
if (!found)
dmu_tx_hold_bonus(oh->ot_tx, obj->oo_dn->dn_object);
if (oh->ot_tx->tx_err != 0)
- GOTO(out, rc = -oh->ot_tx->tx_err);
+ GOTO(out_sem, rc = -oh->ot_tx->tx_err);
if (attr && attr->la_valid & LA_FLAGS) {
/* LMA is usually a part of bonus, no need to declare
osd->od_svname,
attr->la_uid, attr->la_gid, bspace, blksize);
}
+ /* to preserve locking order - qsd_transfer() may need to flush
+ * currently running transaction when we're out of quota. */
+ up_read(&obj->oo_guard);
if (attr && attr->la_valid & LA_UID) {
/* quota enforcement for user */
}
#endif
out:
+ RETURN(rc);
+out_sem:
up_read(&obj->oo_guard);
RETURN(rc);
}
/* we may fix some attributes, better do not change the source */
obj->oo_attr = *attr;
+ obj->oo_attr.la_size = 0;
+ obj->oo_attr.la_nlink = 0;
obj->oo_attr.la_valid |= LA_SIZE | LA_NLINK | LA_TYPE;
#ifdef ZFS_PROJINHERIT
zde->zde_pad = 0;
zde->zde_dnode = dn->dn_object;
- zde->zde_type = IFTODT(attr->la_mode & S_IFMT);
+ zde->zde_type = S_DT(attr->la_mode & S_IFMT);
zapid = osd_get_name_n_idx(env, osd, fid, buf,
sizeof(info->oti_str), &zdn);
return 0;
}
-static struct dt_object_operations osd_obj_ops = {
+static bool osd_check_stale(struct dt_object *dt)
+{
+ return false;
+}
+
+static const struct dt_object_operations osd_obj_ops = {
.do_read_lock = osd_read_lock,
.do_write_lock = osd_write_lock,
.do_read_unlock = osd_read_unlock,
.do_xattr_list = osd_xattr_list,
.do_object_sync = osd_object_sync,
.do_invalidate = osd_invalidate,
+ .do_check_stale = osd_check_stale,
};
-static struct lu_object_operations osd_lu_obj_ops = {
+static const struct lu_object_operations osd_lu_obj_ops = {
.loo_object_init = osd_object_init,
.loo_object_delete = osd_object_delete,
.loo_object_release = osd_object_release,
return 0;
}
-static struct dt_object_operations osd_obj_otable_it_ops = {
+static const struct dt_object_operations osd_obj_otable_it_ops = {
.do_attr_get = osd_otable_it_attr_get,
.do_index_try = osd_index_try,
};