From c7d61cf7497944fde258697f13b34e452bf5d4a1 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Fri, 26 May 2017 04:00:11 +0000 Subject: [PATCH] Revert "LU-8359 ldlm: Wrong evict during failover" Mike points out that this patch actaully does not fix anything and just adds another problem instead This reverts commit c60e949e3b9f7ff19e1a644210cc764ee150ad8b. Change-Id: I727eaee8dace8dd429451e4b6fcefbf66b940c30 Reviewed-on: https://review.whamcloud.com/27300 Reviewed-by: Oleg Drokin Tested-by: Oleg Drokin --- lustre/include/lustre_export.h | 1 + lustre/include/obd_class.h | 3 ++- lustre/mdt/mdt_handler.c | 6 ++++-- lustre/ofd/ofd_obd.c | 4 +++- lustre/target/tgt_lastrcvd.c | 7 +++---- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lustre/include/lustre_export.h b/lustre/include/lustre_export.h index 7aa1dff..7299b68 100644 --- a/lustre/include/lustre_export.h +++ b/lustre/include/lustre_export.h @@ -164,6 +164,7 @@ do { \ enum obd_option { OBD_OPT_FORCE = 0x0001, + OBD_OPT_FAILOVER = 0x0002, OBD_OPT_ABORT_RECOV = 0x0004, }; diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 5ae50e0..0eb7578 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -335,7 +335,8 @@ void class_disconnect_stale_exports(struct obd_device *, int (*test_export)(struct obd_export *)); static inline enum obd_option exp_flags_from_obd(struct obd_device *obd) { - return ((obd->obd_force ? OBD_OPT_FORCE : 0) | + return ((obd->obd_fail ? OBD_OPT_FAILOVER : 0) | + (obd->obd_force ? OBD_OPT_FORCE : 0) | (obd->obd_abort_recovery ? OBD_OPT_ABORT_RECOV : 0) | 0); } diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 61a84ce..e902a3e 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5499,7 +5499,7 @@ static int mdt_export_cleanup(struct obd_export *exp) rc = mdt_ctxt_add_dirty_flag(&env, info, mfd); /* Don't unlink orphan on failover umount, LU-184 */ - if (exp->exp_obd->obd_fail) { + if (exp->exp_flags & OBD_OPT_FAILOVER) { ma->ma_valid = MA_FLAGS; ma->ma_attr_flags |= MDS_KEEP_ORPHAN; } @@ -5508,7 +5508,9 @@ static int mdt_export_cleanup(struct obd_export *exp) } info->mti_mdt = NULL; /* cleanup client slot early */ - tgt_client_del(&env, exp); + /* Do not erase record for recoverable client. */ + if (!(exp->exp_flags & OBD_OPT_FAILOVER) || exp->exp_failed) + tgt_client_del(&env, exp); lu_env_fini(&env); RETURN(rc); diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index 1cc1e1d..03489fe 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -436,7 +436,9 @@ int ofd_obd_disconnect(struct obd_export *exp) tgt_grant_discard(exp); - if (exp->exp_obd->obd_replayable) { + /* Do not erase record for recoverable client. */ + if (exp->exp_obd->obd_replayable && + (!exp->exp_obd->obd_fail || exp->exp_failed)) { rc = lu_env_init(&env, LCT_DT_THREAD); if (rc) GOTO(out, rc); diff --git a/lustre/target/tgt_lastrcvd.c b/lustre/target/tgt_lastrcvd.c index 3a55026..c7aecdf 100644 --- a/lustre/target/tgt_lastrcvd.c +++ b/lustre/target/tgt_lastrcvd.c @@ -1079,10 +1079,6 @@ int tgt_client_del(const struct lu_env *env, struct obd_export *exp) RETURN(-EINVAL); } - /* Do not erase record for recoverable client. */ - if (exp->exp_obd->obd_fail) - RETURN(0); - /* XXX if lcd_uuid were a real obd_uuid, I could use obd_uuid_equals */ if (!strcmp((char *)ted->ted_lcd->lcd_uuid, (char *)tgt->lut_obd->obd_uuid.uuid) || @@ -1109,6 +1105,9 @@ int tgt_client_del(const struct lu_env *env, struct obd_export *exp) LBUG(); } + /* Do not erase record for recoverable client. */ + if (exp->exp_flags & OBD_OPT_FAILOVER) + RETURN(0); if (OBD_FAIL_CHECK(OBD_FAIL_TGT_CLIENT_DEL)) RETURN(0); -- 1.8.3.1