#include <linux/obd_support.h>
#include <linux/obd_class.h>
#include <linux/lustre_net.h>
+#include <linux/lustre_log.h>
#include <portals/types.h>
#include "ptlrpc_internal.h"
}
void
+ptlrpc_save_llog_lock (struct ptlrpc_request *req,
+ struct llog_create_locks *lcl)
+{
+ struct ptlrpc_reply_state *rs = req->rq_reply_state;
+ LASSERT (rs != NULL);
+ LASSERT (rs->rs_llog_locks == NULL);
+
+ rs->rs_llog_locks = lcl;
+}
+
+void
ptlrpc_save_lock (struct ptlrpc_request *req,
struct lustre_handle *lock, int mode)
{
list_for_each_safe (tmp, nxt, &obd->obd_uncommitted_replies) {
struct ptlrpc_reply_state *rs =
list_entry (tmp, struct ptlrpc_reply_state, rs_obd_list);
+ struct llog_create_locks *lcl = rs->rs_llog_locks;
+ rs->rs_llog_locks = NULL;
LASSERT (rs->rs_difficult);
if (rs->rs_transno <= obd->obd_last_committed) {
list_del_init (&rs->rs_obd_list);
ptlrpc_schedule_difficult_reply (rs);
spin_unlock (&svc->srv_lock);
+
+ if (lcl != NULL)
+ llog_create_lock_free(lcl);
}
}
unsigned long flags;
struct obd_export *exp;
struct obd_device *obd;
+ struct llog_create_locks *lcl;
int nlocks;
int been_handled;
char str[PTL_NALFMT_SIZE];
nlocks = rs->rs_nlocks; /* atomic "steal", but */
rs->rs_nlocks = 0; /* locks still on rs_locks! */
+ lcl = rs->rs_llog_locks;
+ rs->rs_llog_locks = NULL;
+
if (nlocks == 0 && !been_handled) {
/* If we see this, we should already have seen the warning
* in mds_steal_ack_locks() */
}
if ((!been_handled && rs->rs_on_net) ||
- nlocks > 0) {
+ nlocks > 0 || lcl != NULL) {
spin_unlock_irqrestore(&svc->srv_lock, flags);
if (!been_handled && rs->rs_on_net) {
ldlm_lock_decref(&rs->rs_locks[nlocks],
rs->rs_modes[nlocks]);
+ if (lcl != NULL)
+ llog_create_lock_free(lcl);
+
spin_lock_irqsave(&svc->srv_lock, flags);
}