+EXPORT_SYMBOL(llog_origin_handle_open);
+
+int llog_origin_handle_destroy(struct ptlrpc_request *req)
+{
+ struct obd_device *disk_obd;
+ struct lvfs_run_ctxt saved;
+ struct llogd_body *body;
+ struct llog_logid *logid = NULL;
+ struct llog_ctxt *ctxt;
+ int rc;
+
+ ENTRY;
+
+ body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY);
+ if (body == NULL)
+ RETURN(-EFAULT);
+
+ if (body->lgd_logid.lgl_oid > 0)
+ logid = &body->lgd_logid;
+
+ if (!(body->lgd_llh_flags & LLOG_F_IS_PLAIN))
+ CERROR("%s: wrong llog flags %x\n",
+ req->rq_export->exp_obd->obd_name, body->lgd_llh_flags);
+
+ ctxt = llog_get_context(req->rq_export->exp_obd, body->lgd_ctxt_idx);
+ if (ctxt == NULL)
+ RETURN(-ENODEV);
+
+ disk_obd = ctxt->loc_exp->exp_obd;
+ push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
+
+ rc = req_capsule_server_pack(&req->rq_pill);
+ /* erase only if no error and logid is valid */
+ if (rc == 0)
+ rc = llog_erase(req->rq_svc_thread->t_env, ctxt, logid, NULL);
+ pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
+ llog_ctxt_put(ctxt);
+ RETURN(rc);
+}
+EXPORT_SYMBOL(llog_origin_handle_destroy);