LASSERT(atomic_read(&mfd->mfd_refcount) > 0 &&
atomic_read(&mfd->mfd_refcount) < 0x5a5a);
if (atomic_dec_and_test(&mfd->mfd_refcount)) {
- LASSERT(list_empty(&mfd->mfd_handle.h_link));
- OBD_FREE(mfd, sizeof *mfd);
+ OBD_FREE_RCU(mfd, sizeof *mfd, &mfd->mfd_handle);
}
}
if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_ALLOC_OBDO))
GOTO(out_ids, rc = -ENOMEM);
- oinfo.oi_oa = obdo_alloc();
+ OBDO_ALLOC(oinfo.oi_oa);
if (oinfo.oi_oa == NULL)
GOTO(out_ids, rc = -ENOMEM);
oinfo.oi_oa->o_uid = 0; /* must have 0 uid / gid on OST */
if (rc)
GOTO(out_oa, rc);
}
- rc = obd_create(mds->mds_osc_exp, oinfo.oi_oa,
+ rc = obd_create(mds->mds_osc_exp, oinfo.oi_oa,
&oinfo.oi_md, &oti);
if (rc) {
int level = D_ERROR;
GOTO(out_oa, rc);
}
oinfo.oi_md->lsm_object_id = oinfo.oi_oa->o_id;
+ oinfo.oi_md->lsm_object_gr = oinfo.oi_oa->o_gr;
}
if (inode->i_size) {
oinfo.oi_oa->o_size = inode->i_size;
- obdo_from_inode(oinfo.oi_oa, inode, OBD_MD_FLTYPE |
- OBD_MD_FLATIME | OBD_MD_FLMTIME |
+ obdo_from_inode(oinfo.oi_oa, inode, OBD_MD_FLTYPE |
+ OBD_MD_FLATIME | OBD_MD_FLMTIME |
OBD_MD_FLCTIME | OBD_MD_FLSIZE);
/* pack lustre id to OST */
if (IS_ERR(*handle)) {
rc = PTR_ERR(*handle);
*handle = NULL;
- GOTO(out_oa, rc);
+ GOTO(free_diskmd, rc);
}
rc = fsfilt_set_md(obd, inode, *handle, lmm, lmm_size, "lov");
lmm_buf = lustre_msg_buf(req->rq_repmsg, offset, lmm_size);
LASSERT(lmm_buf);
memcpy(lmm_buf, lmm, lmm_size);
+free_diskmd:
obd_free_diskmd(mds->mds_osc_exp, &lmm);
- out_oa:
+out_oa:
oti_free_cookies(&oti);
- obdo_free(oinfo.oi_oa);
- out_ids:
+ OBDO_FREE(oinfo.oi_oa);
+out_ids:
if (rc) {
OBD_FREE(*ids, mds->mds_lov_desc.ld_tgt_count * sizeof(**ids));
*ids = NULL;
rc = mds_finish_open(req, dchild, body, flags, &handle, rec, rep, NULL);
rc = mds_finish_transno(mds, dchild->d_inode, handle,
- req, rc, rep ? rep->lock_policy_res1 : 0);
+ req, rc, rep ? rep->lock_policy_res1 : 0, 0);
/* XXX what do we do here if mds_finish_transno itself failed? */
l_dput(dchild);
if (child_lockh == NULL)
child_lockh = &lockh;
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, child_res_id,
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, &child_res_id,
LDLM_PLAIN, NULL, LCK_EX, &lock_flags,
ldlm_blocking_ast, ldlm_completion_ast,
NULL, NULL, 0, NULL, child_lockh);
if (rec->ur_flags & (MDS_OPEN_CREAT | MDS_OPEN_JOIN_FILE))
parent_mode = LCK_EX;
dparent = mds_fid2locked_dentry(obd, rec->ur_fid1, NULL, parent_mode,
- &parent_lockh, rec->ur_name,
- rec->ur_namelen - 1,
- MDS_INODELOCK_UPDATE);
+ &parent_lockh, MDS_INODELOCK_UPDATE);
if (IS_ERR(dparent)) {
rc = PTR_ERR(dparent);
if (rc != -ENOENT) {
else
child_mode = LCK_CR;
- if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) &&
+ if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) &&
(rec->ur_flags & MDS_OPEN_LOCK)) {
/* In case of replay we do not get a lock assuming that the
caller has it already */
child_res_id.name[0] = dchild->d_inode->i_ino;
child_res_id.name[1] = dchild->d_inode->i_generation;
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, child_res_id,
- LDLM_IBITS, &policy, child_mode,
- &lock_flags, ldlm_blocking_ast,
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, &child_res_id,
+ LDLM_IBITS, &policy, child_mode,
+ &lock_flags, ldlm_blocking_ast,
ldlm_completion_ast, NULL, NULL,
0, NULL, child_lockh);
if (rc != ELDLM_OK)
cleanup:
rc = mds_finish_transno(mds, dchild ? dchild->d_inode : NULL, handle,
- req, rc, rep ? rep->lock_policy_res1 : 0);
+ req, rc, rep ? rep->lock_policy_res1 : 0, 0);
cleanup_no_trans:
switch (cleanup_phase) {
/* trigger dqacq on the owner of child and parent */
lquota_adjust(mds_quota_interface_ref, obd, qcids, qpids, rc,
FSFILT_OP_CREATE);
+
+ /* If we have not taken the "open" lock, we may not return 0 here,
+ because caller expects 0 to mean "lock is taken", and it needs
+ nonzero return here for caller to return EDLM_LOCK_ABORTED to
+ client. Later caller should rewrite the return value back to zero
+ if it to be used any further
+ */
RETURN(rc);
}
* (it will not even _have_ an entry in last_rcvd anymore).
*
* Returns EAGAIN if the client needs to get more data and re-close. */
-int mds_mfd_close(struct ptlrpc_request *req, int offset,
- struct obd_device *obd, struct mds_file_data *mfd,
- int unlink_orphan, struct lov_mds_md *lmm, int lmm_size,
+int mds_mfd_close(struct ptlrpc_request *req, int offset,struct obd_device *obd,
+ struct mds_file_data *mfd, int unlink_orphan,
+ struct lov_mds_md *lmm, int lmm_size,
struct llog_cookie *logcookies, int cookies_size,
__u64 *valid)
{
handle = NULL;
GOTO(cleanup, rc);
}
+
if (lmm != NULL && (*valid & OBD_MD_FLEASIZE) &&
mds_log_op_unlink(obd, lmm, lmm_size,
logcookies, cookies_size) > 0) {
cleanup:
if (req != NULL && reply_body != NULL) {
- rc = mds_finish_transno(mds, pending_dir, handle, req, rc, 0);
+ rc = mds_finish_transno(mds, pending_dir, handle, req, rc, 0, 0);
} else if (handle) {
int err = fsfilt_commit(obd, pending_dir, handle, 0);
if (err) {
RETURN(-EFAULT);
}
- if (body->flags & MDS_BFLAG_UNCOMMITTED_WRITES)
- /* do some stuff */ ;
-
spin_lock(&med->med_open_lock);
mfd = mds_handle2mfd(&body->handle);
if (mfd == NULL) {