1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Lustre Lite recovery infrastructure.
6 * Copyright (C) 2002 Cluster File Systems Inc.
9 #define DEBUG_SUBSYSTEM S_LLITE
11 #include <linux/lustre_lite.h>
12 #include <linux/lustre_ha.h>
13 #include <linux/lustre_dlm.h>
14 #include <linux/lustre_idl.h>
16 static int ll_retry_recovery(struct ptlrpc_connection *conn)
22 int ll_recover(struct recovd_data *rd, int phase)
24 struct ptlrpc_connection *conn = class_rd2conn(rd);
25 struct list_head *tmp;
31 case PTLRPC_RECOVD_PHASE_PREPARE:
32 case PTLRPC_RECOVD_PHASE_RECOVER:
33 list_for_each(tmp, &conn->c_imports) {
34 struct obd_import *imp =
35 list_entry(tmp, struct obd_import, imp_chain);
37 if (phase == PTLRPC_RECOVD_PHASE_PREPARE) {
39 spin_lock_irqsave(&imp->imp_lock, flags);
40 imp->imp_level = LUSTRE_CONN_RECOVD;
41 spin_unlock_irqrestore(&imp->imp_lock, flags);
43 imp->imp_recover(imp, phase);
46 if (phase == PTLRPC_RECOVD_PHASE_PREPARE)
47 RETURN(ptlrpc_run_recovery_upcall(conn));
50 case PTLRPC_RECOVD_PHASE_FAILURE:
51 RETURN(ll_retry_recovery(conn));