__osd_object_create() should free newly created
object upon error.
Signed-off-by: Isaac Huang <he.huang@intel.com>
Change-Id: Ie1d487765b8b4e85c3136161f21ab8260a6177b2
Reviewed-on: http://review.whamcloud.com/10362
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
- spin_lock(&uos->lock);
- uos->objects++;
- spin_unlock(&uos->lock);
-
/* Assert that the transaction has been assigned to a
transaction group. */
LASSERT(tx->tx_txg != 0);
/* Assert that the transaction has been assigned to a
transaction group. */
LASSERT(tx->tx_txg != 0);
oid = dmu_object_alloc(uos->os, DMU_OT_PLAIN_FILE_CONTENTS, 0,
DMU_OT_SA, DN_MAX_BONUSLEN, tx);
rc = -sa_buf_hold(uos->os, oid, tag, dbp);
oid = dmu_object_alloc(uos->os, DMU_OT_PLAIN_FILE_CONTENTS, 0,
DMU_OT_SA, DN_MAX_BONUSLEN, tx);
rc = -sa_buf_hold(uos->os, oid, tag, dbp);
+ LASSERTF(rc == 0, "sa_buf_hold "LPU64" failed: %d\n", oid, rc);
LASSERT(la->la_valid & LA_MODE);
la->la_size = 0;
la->la_nlink = 1;
LASSERT(la->la_valid & LA_MODE);
la->la_size = 0;
la->la_nlink = 1;
- return __osd_attr_init(env, uos, oid, tx, la, parent);
+ rc = __osd_attr_init(env, uos, oid, tx, la, parent);
+ if (rc != 0) {
+ sa_buf_rele(*dbp, tag);
+ *dbp = NULL;
+ dmu_object_free(uos->os, oid, tx);
+ return rc;
+ }
+
+ spin_lock(&uos->lock);
+ uos->objects++;
+ spin_unlock(&uos->lock);
+ return 0;