}
if (rc != 0) {
- if (imp->imp_state != LUSTRE_IMP_CLOSED) {
+ if (imp->imp_state != LUSTRE_IMP_CLOSED && !imp->imp_deactive) {
/* Since LWP is not replayable, so it will keep
* trying unless umount happens, otherwise it would
* cause unecessary failure of the application. */
{
struct lu_seq_range res = { 0 };
struct lu_fld_target *target;
+ struct lu_fld_target *origin;
int rc;
ENTRY;
/* Can not find it in the cache */
target = fld_client_get_target(fld, seq);
LASSERT(target != NULL);
-
+ origin = target;
+again:
CDEBUG(D_INFO, "%s: Lookup fld entry (seq: "LPX64") on "
"target %s (idx "LPU64")\n", fld->lcf_name, seq,
fld_target_name(target), target->ft_idx);
rc = fld_client_rpc(target->ft_exp, &res, FLD_QUERY, NULL);
}
+ if (rc == -ESHUTDOWN) {
+ /* If fld lookup failed because the target has been shutdown,
+ * then try next target in the list, until trying all targets
+ * or fld lookup succeeds */
+ spin_lock(&fld->lcf_lock);
+ if (target->ft_chain.next == fld->lcf_targets.prev)
+ target = list_entry(fld->lcf_targets.next,
+ struct lu_fld_target, ft_chain);
+ else
+ target = list_entry(target->ft_chain.next,
+ struct lu_fld_target,
+ ft_chain);
+ spin_unlock(&fld->lcf_lock);
+ if (target != origin)
+ goto again;
+ }
if (rc == 0) {
*mds = res.lsr_index;
fld_cache_insert(fld->lcf_cache, &res);