*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
static void mdt_steal_ack_locks(struct ptlrpc_request *req)
{
struct ptlrpc_service_part *svcpt;
- struct obd_export *exp = req->rq_export;
- struct list_head *tmp;
- struct ptlrpc_reply_state *oldrep;
- int i;
+ struct obd_export *exp = req->rq_export;
+ struct list_head *tmp;
+ struct ptlrpc_reply_state *rs;
+ int i;
/* CAVEAT EMPTOR: spinlock order */
spin_lock(&exp->exp_lock);
list_for_each(tmp, &exp->exp_outstanding_replies) {
- oldrep = list_entry(tmp, struct ptlrpc_reply_state,
+ rs = list_entry(tmp, struct ptlrpc_reply_state,
rs_exp_list);
- if (oldrep->rs_xid != req->rq_xid)
- continue;
+ if (rs->rs_xid != req->rq_xid)
+ continue;
- if (oldrep->rs_opc != lustre_msg_get_opc(req->rq_reqmsg))
- CERROR ("Resent req xid "LPU64" has mismatched opc: "
- "new %d old %d\n", req->rq_xid,
- lustre_msg_get_opc(req->rq_reqmsg),
- oldrep->rs_opc);
+ if (rs->rs_opc != lustre_msg_get_opc(req->rq_reqmsg))
+ CERROR("%s: Resent req xid %llu has mismatched opc: "
+ "new %d old %d\n", exp->exp_obd->obd_name,
+ req->rq_xid, lustre_msg_get_opc(req->rq_reqmsg),
+ rs->rs_opc);
- svcpt = oldrep->rs_svcpt;
- spin_lock(&svcpt->scp_rep_lock);
+ svcpt = rs->rs_svcpt;
- list_del_init(&oldrep->rs_exp_list);
-
- CDEBUG(D_HA, "Stealing %d locks from rs %p x"LPD64".t"LPD64
+ CDEBUG(D_HA, "Stealing %d locks from rs %p x%lld.t%lld"
" o%d NID %s\n",
- oldrep->rs_nlocks, oldrep,
- oldrep->rs_xid, oldrep->rs_transno, oldrep->rs_opc,
+ rs->rs_nlocks, rs,
+ rs->rs_xid, rs->rs_transno, rs->rs_opc,
libcfs_nid2str(exp->exp_connection->c_peer.nid));
- for (i = 0; i < oldrep->rs_nlocks; i++)
- ptlrpc_save_lock(req, &oldrep->rs_locks[i],
- oldrep->rs_modes[i], 0);
- oldrep->rs_nlocks = 0;
+ spin_lock(&svcpt->scp_rep_lock);
+ list_del_init(&rs->rs_exp_list);
+
+ spin_lock(&rs->rs_lock);
+ for (i = 0; i < rs->rs_nlocks; i++)
+ ptlrpc_save_lock(req, &rs->rs_locks[i],
+ rs->rs_modes[i], rs->rs_no_ack,
+ rs->rs_convert_lock);
+ rs->rs_nlocks = 0;
- DEBUG_REQ(D_HA, req, "stole locks for");
- spin_lock(&oldrep->rs_lock);
- ptlrpc_schedule_difficult_reply(oldrep);
- spin_unlock(&oldrep->rs_lock);
+ DEBUG_REQ(D_HA, req, "stole locks for");
+ ptlrpc_schedule_difficult_reply(rs);
+ spin_unlock(&rs->rs_lock);
spin_unlock(&svcpt->scp_rep_lock);
break;
}
spin_unlock(&exp->exp_lock);
+
+ /* if exp_disconnected, decref stolen locks */
+ if (exp->exp_disconnected) {
+ rs = req->rq_reply_state;
+
+ for (i = 0; i < rs->rs_nlocks; i++)
+ ldlm_lock_decref(&rs->rs_locks[i], rs->rs_modes[i]);
+
+ rs->rs_nlocks = 0;
+ }
}
__u64 mdt_req_from_lrd(struct ptlrpc_request *req,
LASSERT(trd != NULL);
lrd = &trd->trd_reply;
- DEBUG_REQ(D_HA, req, "restoring transno "LPD64"/status %d",
+ DEBUG_REQ(D_HA, req, "restoring transno %lld/status %d",
lrd->lrd_transno, lrd->lrd_result);
req->rq_transno = lrd->lrd_transno;
lustre_msg_set_transno(req->rq_repmsg, req->rq_transno);
lustre_msg_set_status(req->rq_repmsg, req->rq_status);
- DEBUG_REQ(D_RPCTRACE, req, "restoring transno "LPD64"/status %d",
+ DEBUG_REQ(D_RPCTRACE, req, "restoring transno %lld/status %d",
req->rq_transno, req->rq_status);
mdt_steal_ack_locks(req);