From d9869f25f25583da5dadd21c6f99d8204a041321 Mon Sep 17 00:00:00 2001 From: Bruno Faccini Date: Thu, 19 May 2016 17:04:39 +0200 Subject: [PATCH] LU-8165 target: detect race by checking last_rcvd slot index MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit A race can occur on Server during Client connection and concurent eviction, when Client's last_rcvd slot index has still not been assigned (-1). This patch adds a check to address such condition. Signed-off-by: Bruno Faccini Change-Id: Ifead82719a0dc9411f1b79d6c8c59eb9ef339fa5 Reviewed-on: http://review.whamcloud.com/20328 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Alex Zhuravlev Reviewed-by: Grégoire Pichon Reviewed-by: Oleg Drokin --- lustre/target/tgt_lastrcvd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lustre/target/tgt_lastrcvd.c b/lustre/target/tgt_lastrcvd.c index bb3c07d..8b98d61 100644 --- a/lustre/target/tgt_lastrcvd.c +++ b/lustre/target/tgt_lastrcvd.c @@ -1049,6 +1049,14 @@ int tgt_client_del(const struct lu_env *env, struct obd_export *exp) exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT) RETURN(0); + /* Slot may be not yet assigned, use case is race between Client + * reconnect and forced eviction */ + if (ted->ted_lr_idx < 0) { + CWARN("%s: client with UUID '%s' not in bitmap\n", + tgt->lut_obd->obd_name, ted->ted_lcd->lcd_uuid); + RETURN(0); + } + CDEBUG(D_INFO, "%s: del client at idx %u, off %lld, UUID '%s'\n", tgt->lut_obd->obd_name, ted->ted_lr_idx, ted->ted_lr_off, ted->ted_lcd->lcd_uuid); -- 1.8.3.1