+ obd_ping(req->rq_export);
+ return req_capsule_server_pack(&req->rq_pill);
+}
+
+void target_committed_to_req(struct ptlrpc_request *req)
+{
+ struct obd_device *obd;
+
+ if (req == NULL || req->rq_export == NULL)
+ return;
+
+ obd = req->rq_export->exp_obd;
+ if (obd == NULL)
+ return;
+
+ if (!obd->obd_no_transno && req->rq_repmsg != NULL)
+ lustre_msg_set_last_committed(req->rq_repmsg,
+ obd->obd_last_committed);
+ else
+ DEBUG_REQ(D_IOCTL, req, "not sending last_committed update");
+
+ CDEBUG(D_INFO, "last_committed "LPU64", transno "LPU64", xid "LPU64"\n",
+ obd->obd_last_committed, req->rq_transno, req->rq_xid);
+}
+
+EXPORT_SYMBOL(target_committed_to_req);
+
+#ifdef HAVE_QUOTA_SUPPORT
+int target_handle_qc_callback(struct ptlrpc_request *req)
+{
+ struct obd_quotactl *oqctl;
+ struct client_obd *cli = &req->rq_export->exp_obd->u.cli;
+
+ oqctl = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
+ if (oqctl == NULL)
+ RETURN(-EPROTO);
+
+ cli->cl_qchk_stat = oqctl->qc_stat;
+
+ return 0;
+}
+
+int target_handle_dqacq_callback(struct ptlrpc_request *req)
+{
+#ifdef __KERNEL__
+ struct obd_device *obd = req->rq_export->exp_obd;
+ struct obd_device *master_obd;
+ struct lustre_quota_ctxt *qctxt;
+ struct qunit_data *qdata;
+ void* rep;
+ struct qunit_data_old *qdata_old;
+ int rc = 0;
+ ENTRY;
+
+ rc = req_capsule_server_pack(&req->rq_pill);
+ if (rc) {
+ CERROR("packing reply failed!: rc = %d\n", rc);
+ RETURN(rc);
+ }
+
+ LASSERT(req->rq_export);
+
+ /* fixed for bug10707 */
+ if ((req->rq_export->exp_connect_flags & OBD_CONNECT_QUOTA64) &&
+ !OBD_FAIL_CHECK(OBD_FAIL_QUOTA_QD_COUNT_32BIT)) {
+ CDEBUG(D_QUOTA, "qd_count is 64bit!\n");
+ rep = req_capsule_server_get(&req->rq_pill,
+ &RMF_QUNIT_DATA);
+ LASSERT(rep);
+ qdata = req_capsule_client_swab_get(&req->rq_pill,
+ &RMF_QUNIT_DATA,
+ (void*)lustre_swab_qdata);
+ } else {
+ CDEBUG(D_QUOTA, "qd_count is 32bit!\n");
+ rep = req_capsule_server_get(&req->rq_pill, &RMF_QUNIT_DATA);
+ LASSERT(rep);
+ qdata_old = req_capsule_client_swab_get(&req->rq_pill,
+ &RMF_QUNIT_DATA,
+ (void*)lustre_swab_qdata_old);
+ qdata = lustre_quota_old_to_new(qdata_old);
+ }
+
+ if (qdata == NULL)
+ RETURN(-EPROTO);
+
+ /* we use the observer */
+ LASSERT(obd->obd_observer && obd->obd_observer->obd_observer);
+ master_obd = obd->obd_observer->obd_observer;
+ qctxt = &master_obd->u.obt.obt_qctxt;
+
+ LASSERT(qctxt->lqc_handler);
+ rc = qctxt->lqc_handler(master_obd, qdata,
+ lustre_msg_get_opc(req->rq_reqmsg));
+ if (rc && rc != -EDQUOT)
+ CDEBUG(rc == -EBUSY ? D_QUOTA : D_ERROR,
+ "dqacq failed! (rc:%d)\n", rc);
+
+ /* the qd_count might be changed in lqc_handler */
+ if ((req->rq_export->exp_connect_flags & OBD_CONNECT_QUOTA64) &&
+ !OBD_FAIL_CHECK(OBD_FAIL_QUOTA_QD_COUNT_32BIT)) {
+ memcpy(rep, qdata, sizeof(*qdata));
+ } else {
+ qdata_old = lustre_quota_new_to_old(qdata);
+ memcpy(rep, qdata_old, sizeof(*qdata_old));
+ }
+ req->rq_status = rc;
+ rc = ptlrpc_reply(req);
+
+ RETURN(rc);
+#else
+ return 0;
+#endif /* !__KERNEL__ */