From 45d63565c36f936d196a29288517f69cf348be21 Mon Sep 17 00:00:00 2001 From: huanghua Date: Wed, 26 Jul 2006 07:01:51 +0000 Subject: [PATCH] restore tempprary commentted out code in mdc_locks.c:mdc_intent_lock(); some small fixes in other area --- lustre/ldlm/ldlm_lock.c | 9 ++++++--- lustre/ldlm/ldlm_request.c | 14 ++++++++++---- lustre/llite/llite_lib.c | 1 + lustre/mdc/mdc_locks.c | 8 +++----- lustre/mdt/mdt_fs.c | 5 ++++- lustre/mdt/mdt_handler.c | 27 +++------------------------ 6 files changed, 27 insertions(+), 37 deletions(-) diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 06ac10c..43c4611 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -301,6 +301,7 @@ int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock, lock->l_resource = ldlm_resource_get(ns, NULL, new_resid, lock->l_resource->lr_type, 1); if (lock->l_resource == NULL) { + l_unlock(&ns->ns_lock); LBUG(); RETURN(-ENOMEM); } @@ -1252,9 +1253,11 @@ void ldlm_lock_dump(int level, struct ldlm_lock *lock, int pos) libcfs_nid2str(imp->imp_connection->c_peer.nid), lock->l_remote_handle.cookie); } - CDEBUG_EX(level, " Resource: %p ("LPU64"/"LPU64")\n", lock->l_resource, - lock->l_resource->lr_name.name[0], - lock->l_resource->lr_name.name[1]); + CDEBUG_EX(level, " Resource: %p ("LPU64"/"LPU64"/"LPU64")\n", + lock->l_resource, + lock->l_resource->lr_name.name[0], + lock->l_resource->lr_name.name[1], + lock->l_resource->lr_name.name[2]); CDEBUG_EX(level, " Req mode: %s, grant mode: %s, rc: %u, read: %d, " "write: %d flags: %#x\n", ldlm_lockname[lock->l_req_mode], ldlm_lockname[lock->l_granted_mode], diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 128fe76..e28595e 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -472,11 +472,17 @@ int ldlm_cli_enqueue(struct obd_export *exp, } if (memcmp(reply->lock_desc.l_resource.lr_name.name, - lock->l_resource->lr_name.name, sizeof(struct ldlm_res_id))) { - CDEBUG(D_INFO, "remote intent success, locking %ld " - "instead of %ld\n", + lock->l_resource->lr_name.name, + sizeof(struct ldlm_res_id))) { + CDEBUG(D_INFO, "remote intent success, locking " + "(%ld,%ld,%ld) instead of " + "(%ld,%ld,%ld)\n", (long)reply->lock_desc.l_resource.lr_name.name[0], - (long)lock->l_resource->lr_name.name[0]); + (long)reply->lock_desc.l_resource.lr_name.name[1], + (long)reply->lock_desc.l_resource.lr_name.name[2], + (long)lock->l_resource->lr_name.name[0], + (long)lock->l_resource->lr_name.name[1], + (long)lock->l_resource->lr_name.name[2]); ldlm_lock_change_resource(ns, lock, reply->lock_desc.l_resource.lr_name); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index c433750..e17ec1c 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1404,6 +1404,7 @@ void ll_delete_inode(struct inode *inode) if (rc) { CERROR("fid_delete() failed, rc %d\n", rc); } + clear_inode(inode); EXIT; } diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 5b5590c..edb4e20 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -676,11 +676,9 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, /* If we were revalidating a fid/name pair, mark the intent in * case we fail and get called again from lookup */ - if (fid_is_sane(&op_data->fid2)){ -/* FIXME: This is commented out by huanghua@clusterfs.com, - * if anything wrong, please restore that */ -// !it_disposition(it, DISP_OPEN_CREATE)) { -// it_set_disposition(it, DISP_ENQ_COMPLETE); + if (fid_is_sane(&op_data->fid2) && + !it_disposition(it, DISP_OPEN_CREATE)) { + it_set_disposition(it, DISP_ENQ_COMPLETE); /* Also: did we find the same inode? */ if (memcmp(&op_data->fid2, &mdt_body->fid1, sizeof(op_data->fid2))) RETURN(-ESTALE); diff --git a/lustre/mdt/mdt_fs.c b/lustre/mdt/mdt_fs.c index 1bd5a50..97b887f 100644 --- a/lustre/mdt/mdt_fs.c +++ b/lustre/mdt/mdt_fs.c @@ -428,12 +428,15 @@ static int mdt_txn_stop_cb(const struct lu_context *ctx, mti->mti_transno = ++ mdt->mdt_last_transno; } else { /* replay */ + CDEBUG(D_HA, "replaying transno: "LPD64" stopped\n", + mti->mti_transno); if (mti->mti_transno > mdt->mdt_last_transno) mdt->mdt_last_transno = mti->mti_transno; } spin_unlock(&mdt->mdt_transno_lock); /* save transno for the commit callback */ txni->txi_transno = mti->mti_transno; + CDEBUG(D_HA, "transno "LPD64" stopped\n", txni->txi_transno); /* TODO: write last_rcvd */ @@ -452,7 +455,7 @@ static int mdt_txn_commit_cb(const struct lu_context *ctx, txi = lu_context_key_get(&txn->th_ctx, &mdt_txn_key); if (txi->txi_transno > mdt->mdt_last_committed) { mdt->mdt_last_committed = txi->txi_transno; - ptlrpc_commit_replies (obd); + ptlrpc_commit_replies(obd); } CDEBUG(D_HA, "%s: transno "LPD64" committed\n", obd->obd_name, txi->txi_transno); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index f945871..73cc9c3 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -603,6 +603,7 @@ static int mdt_readpage(struct mdt_thread_info *info) int rc; int i; ENTRY; + RETURN(-EOPNOTSUPP); if (MDT_FAIL_CHECK(OBD_FAIL_MDS_READPAGE_PACK)) RETURN(-ENOMEM); @@ -1119,29 +1120,6 @@ int mdt_update_last_transno(struct mdt_thread_info *info, int rc) LASSERT(mdt != NULL); last_committed = mdt->mdt_last_committed; -#if 0 - last_transno = req->rq_reqmsg->transno; - if (rc != 0) { - if (last_transno != 0) { - CERROR("replay %s transno "LPU64" failed: rc %d\n", - libcfs_nid2str(req->rq_export->exp_connection->c_peer.nid), - last_transno, rc); - last_transno = 0; - } - } else { /* rc == 0 */ - spin_lock(&mdt->mdt_transno_lock); - if (last_transno == 0) { - last_transno = ++mdt->mdt_last_transno; - } else { - if (last_transno > mdt->mdt_last_transno) - mdt->mdt_last_transno = last_transno; - } - spin_unlock(&mdt->mdt_transno_lock); - } - - /*last_committed = (mdt->mdt_last_committed);*/ - last_committed = last_transno; -#endif if (rc == 0) { last_transno = info->mti_transno; CDEBUG(D_INFO, "last_transno = %llu, last_committed = %llu\n", @@ -1150,7 +1128,7 @@ int mdt_update_last_transno(struct mdt_thread_info *info, int rc) last_transno = 0; CERROR("replay %s transno "LPU64" failed: rc %d\n", libcfs_nid2str(exp->exp_connection->c_peer.nid), - last_transno, rc); + info->mti_transno, rc); } req->rq_repmsg->transno = req->rq_transno = last_transno; req->rq_repmsg->last_xid = req->rq_xid; @@ -1271,6 +1249,7 @@ static void mdt_thread_info_init(struct ptlrpc_request *req, info->mti_fail_id = OBD_FAIL_MDS_ALL_REPLY_NET; info->mti_ctxt = req->rq_svc_thread->t_ctx; + info->mti_transno = req->rq_reqmsg->transno; /* it can be NULL while CONNECT */ if (req->rq_export) info->mti_mdt = mdt_dev(req->rq_export->exp_obd->obd_lu_dev); -- 1.8.3.1