* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
obj->oo_attr.la_gid, rc);
oid = obj->oo_db->db_object;
- if (obj->oo_destroy == OSD_DESTROY_SYNC) {
+ if (unlikely(obj->oo_destroy == OSD_DESTROY_NONE)) {
+ /* this may happen if the destroy wasn't declared
+ * e.g. when the object is created and then destroyed
+ * in the same transaction - we don't need additional
+ * space for destroy specifically */
+ 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 "LPU64": 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 "LPU64": rc = %d\n",
out:
/* not needed in the cache anymore */
set_bit(LU_OBJECT_HEARD_BANSHEE, &dt->do_lu.lo_header->loh_flags);
-
+ if (rc == 0)
+ obj->oo_destroyed = 1;
RETURN (0);
}
LASSERT(osd_invariant(obj));
- down_read(&obj->oo_sem);
+ down_read_nested(&obj->oo_sem, role);
}
static void osd_object_write_lock(const struct lu_env *env,
LASSERT(osd_invariant(obj));
- down_write(&obj->oo_sem);
+ down_write_nested(&obj->oo_sem, role);
}
static void osd_object_read_unlock(const struct lu_env *env,
/* to follow ZFS on-disk format we need
* to initialize parent dnode properly */
zapid = 0;
- if (hint && hint->dah_parent)
+ if (hint != NULL && hint->dah_parent != NULL &&
+ !dt_object_remote(hint->dah_parent))
zapid = osd_dt_obj(hint->dah_parent)->oo_db->db_object;
db = osd_create_type_f(dof->dof_type)(env, obj, attr, zapid, oh);
ENTRY;
+ if (!dt_object_exists(dt))
+ RETURN(-ENOENT);
+
LASSERT(osd_invariant(obj));
- LASSERT(dt_object_exists(dt));
LASSERT(obj->oo_sa_hdl != NULL);
oh = container_of0(handle, struct osd_thandle, ot_super);
write_unlock(&obj->oo_attr_lock);
rc = osd_object_sa_update(obj, SA_ZPL_LINKS(osd), &nlink, 8, oh);
- return rc;
+ RETURN(rc);
}
static int osd_object_sync(const struct lu_env *env, struct dt_object *dt,