struct mdd_device *mdd,
struct mdd_object *o)
{
- struct thandle *th = NULL;
+ struct thandle *th;
const struct dt_key *dot = (const struct dt_key *)".";
const struct dt_key *dotdot = (const struct dt_key *)"..";
int rc;
th = dt_trans_create(env, mdd->mdd_child);
if (IS_ERR(th))
RETURN(PTR_ERR(th));
+
rc = dt_declare_delete(env, mdd_object_child(o), dot, th);
if (rc)
GOTO(out, rc);
GOTO(out, rc);
out:
- if (th)
- dt_trans_stop(env, mdd->mdd_child, th);
+ dt_trans_stop(env, mdd->mdd_child, th);
RETURN(rc);
}
struct mdd_object *o,
const struct lu_name *name)
{
- struct thandle *th = NULL;
+ struct thandle *th;
struct lu_fid oldfid;
int rc;
ENTRY;
th = dt_trans_create(env, mdd->mdd_child);
+ if (IS_ERR(th))
+ RETURN(PTR_ERR(th));
+
rc = mdd_declare_links_add(env, o, th, NULL);
if (rc)
GOTO(out, rc);
rc = 0;
out:
- if (th)
- dt_trans_stop(env, mdd->mdd_child, th);
+ dt_trans_stop(env, mdd->mdd_child, th);
RETURN(rc);
}
struct mdd_object *o)
{
struct lustre_mdt_attrs *lma;
- struct thandle *th = NULL;
+ struct thandle *th;
struct lu_fid fid;
struct lu_buf buf;
int rc;
GOTO(out, rc);
rc = mdo_xattr_set(env, o, &buf, XATTR_NAME_LMA, 0, th, BYPASS_CAPA);
out:
- if (th)
- dt_trans_stop(env, mdd->mdd_child, th);
+ dt_trans_stop(env, mdd->mdd_child, th);
RETURN(rc);
}
if (handle == NULL) {
handle = mdd_trans_create(env, mdo2mdd(obj));
if (IS_ERR(handle))
- GOTO(stop, rc = IS_ERR(handle));
+ GOTO(stop, rc = PTR_ERR(handle));
rc = mdd_declare_changelog_store(env, mdd, NULL,
handle);
}
stop:
- if (handle != NULL)
- mdd_trans_stop(env, mdd, rc, handle);
- return rc;
+ if (handle != NULL && !IS_ERR(handle))
+ mdd_trans_stop(env, mdd, rc, handle);
+
+ return rc;
}
/*
int rc = 0;
ENTRY;
- th = mdd_trans_create(env, mdd);
- if (IS_ERR(th)) {
- CERROR("Cannot get thandle\n");
- RETURN(-ENOMEM);
- }
+ th = mdd_trans_create(env, mdd);
+ if (IS_ERR(th)) {
+ CERROR("Cannot get thandle\n");
+ RETURN(PTR_ERR(th));
+ }
+
rc = orph_declare_index_delete(env, obj, th);
if (rc)
GOTO(stop, rc);
th = dt_trans_create(env, dev);
if (IS_ERR(th))
- GOTO(out_lock, rc = PTR_ERR(th));
+ GOTO(out_los, rc = PTR_ERR(th));
dti->dti_attr.la_valid = LA_MODE | LA_TYPE;
dti->dti_attr.la_mode = S_IFREG | S_IRUGO | S_IWUSR;