From: Bruno Faccini Date: Thu, 19 May 2016 15:04:39 +0000 (+0200) Subject: LU-8165 target: detect race by checking last_rcvd slot index X-Git-Tag: 2.8.58~17 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=d9869f25f25583da5dadd21c6f99d8204a041321;p=fs%2Flustre-release.git LU-8165 target: detect race by checking last_rcvd slot index 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 --- 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);